Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBAudio_HelloWorld by
Revision 1:d712dff4f9ca, committed 2011-11-30
- Comitter:
- samux
- Date:
- Wed Nov 30 10:31:06 2011 +0000
- Parent:
- 0:3a00949fdb07
- Child:
- 2:6a0a685c93e5
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 30 09:49:14 2011 +0000
+++ b/main.cpp Wed Nov 30 10:31:06 2011 +0000
@@ -12,21 +12,21 @@
#define NB_CHA 1
// length of an audio packet: each ms, we receive 48 * 16bits ->48 * 2 bytes. as there is one channel, the length will be 48 * 2 * 1
-#define LENGTH_PACKET 48 * 2 * 1
+#define AUDIO_LENGTH_PACKET 48 * 2 * 1
// USBAudio
USBAudio audio(FREQ, NB_CHA);
int main() {
- uint8_t buf[LENGTH_PACKET];
+ int16_t buf[AUDIO_LENGTH_PACKET/2];
while (1) {
// read an audio packet
- audio.read(buf);
+ audio.read((uint8_t *)buf);
// print packet received
pc.printf("recv: ");
- for(int i = 0; i < LENGTH_PACKET; i++) {
+ for(int i = 0; i < AUDIO_LENGTH_PACKET/2; i++) {
pc.printf("%d ", buf[i]);
}
pc.printf("\r\n");
