@@ -39,123 +39,27 @@ class I2sMaster : public ::modm::PeripheralDriver, public I2s
39
39
* SD (serial data) and WS (word select) signals and connects them.
40
40
*
41
41
* @tparam Signals
42
- * One CK, SD and WS signal are required
42
+ * One CK, SD, WS, MCK signal are required
43
43
* and can be passed out-of-order.
44
44
*/
45
45
template < class ... Signals >
46
46
static void
47
47
connect ();
48
48
49
49
/* *
50
- * Initializes the hardware and sets the baudrate .
50
+ * Initializes the hardware and sets the samplerate .
51
51
*
52
52
* @tparam SystemClock
53
53
* the currently active system clock
54
- * @tparam baudrate
55
- * the desired baudrate in Hz
54
+ * @tparam samplerate
55
+ * the desired sample rate in Hz
56
56
* @tparam tolerance
57
- * the allowed relative tolerance for the resulting baudrate
57
+ * the allowed relative tolerance for the resulting samplerate
58
58
*/
59
- template < class SystemClock , baudrate_t baudrate , percent_t tolerance=5_pct >
59
+ template < class SystemClock , frequency_t samplerate , percent_t tolerance=pct( 0.019 ) >
60
60
static void
61
61
initialize ();
62
62
63
- // / Sets a new data mode.
64
- static void
65
- setDataMode (DataMode mode);
66
-
67
- // / Sets a new data order.
68
- static void
69
- setDataOrder (DataOrder order);
70
-
71
- /* *
72
- * Request access to the spi master within a context.
73
- * You may acquire the spi master multiple times within the same context.
74
- *
75
- * The configuration handler will only be called when aquiring the spi
76
- * master for the first time (if it is not a `nullptr`).
77
- *
78
- * @warning Aquires must be balanced with releases of the **same** context!
79
- * @warning Aquires are persistent even after calling `initialize()`!
80
- *
81
- * @return `0` if another context is using the spi master, otherwise
82
- * `>0` as the number of times this context acquired the master.
83
- */
84
- static uint8_t
85
- acquire (void *ctx, ConfigurationHandler handler = nullptr );
86
-
87
- /* *
88
- * Release access to the spi master within a context.
89
- *
90
- * @warning Releases must be balanced with acquires of the **same** context!
91
- * @warning Releases are persistent even after calling `initialize()`!
92
- *
93
- * @return `0` if nothing can be released anymore (for any context)
94
- * `>0` as the number of times this context can still release the master.
95
- */
96
- static uint8_t
97
- release (void *ctx);
98
-
99
- /* *
100
- * Swap a single byte and wait for completion.
101
- *
102
- * @param data
103
- * data to be sent
104
- * @return received data
105
- */
106
- static uint8_t
107
- transferBlocking (uint8_t data);
108
-
109
- /* *
110
- * Set the data buffers and length with options and starts a transfer.
111
- * This may be hardware accelerated (DMA or Interrupt), but not guaranteed.
112
- *
113
- * @param[in] tx
114
- * pointer to transmit buffer, set to `nullptr` to send dummy bytes
115
- * @param[out] rx
116
- * pointer to receive buffer, set to `nullptr` to discard received bytes
117
- * @param length
118
- * number of bytes to be shifted out
119
- */
120
- static void
121
- transferBlocking (const uint8_t *tx, uint8_t *rx, std::size_t length);
122
-
123
- /* *
124
- * Swap a single byte and wait for completion non-blocking!.
125
- *
126
- * You must call this inside a Protothread or Resumable
127
- * using `PT_CALL` or `RF_CALL` respectively.
128
- * @warning These methods differ from Resumables by lacking context protection!
129
- * You must ensure that only one driver is accessing this resumable function
130
- * by using `acquire(ctx)` and `release(ctx)`.
131
- *
132
- * @param data
133
- * data to be sent
134
- * @return received data
135
- */
136
- static modm::ResumableResult<uint8_t >
137
- transfer (uint8_t data);
138
-
139
- /* *
140
- * Set the data buffers and length with options and
141
- * starts a non-blocking transfer.
142
- * This may be hardware accelerated (DMA or Interrupt), but not guaranteed.
143
- *
144
- * You must call this inside a Protothread or Resumable
145
- * using `PT_CALL` or `RF_CALL` respectively.
146
- * @warning These methods differ from Resumables by lacking context protection!
147
- * You must ensure that only one driver is accessing this resumable function
148
- * by using `acquire(ctx)` and `release(ctx)`.
149
- *
150
- * @param[in] tx
151
- * pointer to transmit buffer, set to `nullptr` to send dummy bytes
152
- * @param[out] rx
153
- * pointer to receive buffer, set to `nullptr` to discard received bytes
154
- * @param length
155
- * number of bytes to be shifted out
156
- */
157
- static modm::ResumableResult<void >
158
- transfer (const uint8_t *tx, uint8_t *rx, std::size_t length);
159
63
#endif
160
64
};
161
65
0 commit comments