You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/unsupported/USBDevice/USBAudio/USBAudio.h
+43Lines changed: 43 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,14 @@ class USBAudio: public USBDevice {
107
107
*/
108
108
boolreadNB(uint8_t * buf);
109
109
110
+
/**
111
+
* read last received packet if some.
112
+
* @param buf pointer on a buffer which will be filled if an audio packet is available
113
+
*
114
+
* @returns the packet length
115
+
*/
116
+
uint32_treadSync(uint8_t *buf);
117
+
110
118
/**
111
119
* Write an audio packet. During a frame, only a single writing (you can't write and read an audio packet during the same frame)can be done using this method.
112
120
*
@@ -115,6 +123,12 @@ class USBAudio: public USBDevice {
115
123
*/
116
124
boolwrite(uint8_t * buf);
117
125
126
+
/**
127
+
* Write packet in endpoint fifo. assuming tx fifo is empty
128
+
* @param buf pointer on the audio packet which will be sent
129
+
*/
130
+
voidwriteSync(uint8_t *buf);
131
+
118
132
/**
119
133
* Write and read an audio packet at the same time (on the same frame)
120
134
*
@@ -133,6 +147,22 @@ class USBAudio: public USBDevice {
133
147
voidattach(void(*fptr)(void)) {
134
148
updateVol.attach(fptr);
135
149
}
150
+
/** attach a handler to Tx Done
151
+
*
152
+
* @param function Function to attach
153
+
*
154
+
*/
155
+
voidattachTx(void(*fptr)(void)) {
156
+
txDone.attach(fptr);
157
+
}
158
+
/** attach a handler to Rx Done
159
+
*
160
+
* @param function Function to attach
161
+
*
162
+
*/
163
+
voidattachRx(void(*fptr)(void)) {
164
+
rxDone.attach(fptr);
165
+
}
136
166
137
167
/** Attach a nonstatic void/void member function to update the volume
138
168
*
@@ -144,6 +174,14 @@ class USBAudio: public USBDevice {
144
174
voidattach(T *tptr, void(T::*mptr)(void)) {
145
175
updateVol.attach(tptr, mptr);
146
176
}
177
+
template<typename T>
178
+
voidattachTx(T *tptr, void(T::*mptr)(void)) {
179
+
txDone.attach(tptr, mptr);
180
+
}
181
+
template<typename T>
182
+
voidattachRx(T *tptr, void(T::*mptr)(void)) {
183
+
rxDone.attach(tptr, mptr);
184
+
}
147
185
148
186
149
187
protected:
@@ -277,6 +315,11 @@ class USBAudio: public USBDevice {
277
315
// callback to update volume
278
316
Callback<void()> updateVol;
279
317
318
+
// callback transmit Done
319
+
Callback<void()> txDone;
320
+
// callback transmit Done
321
+
Callback<void()> rxDone;
322
+
280
323
// boolean showing that the SOF handler has been called. Useful for readNB.
0 commit comments