Samuel Mokrani / Mbed 2 deprecated USBAudio_micro

Dependencies:   USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Fri Dec 16 17:06:49 2011 +0000
Parent:
0:539ec61e1fbb
Child:
2:7d8bdeb3753b
Commit message:
same interface for the M0 and the M3

Changed in this revision

USBDevice/USBAudio/USBAudio.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice/USBAudio/USBAudio.cpp	Fri Dec 16 12:31:41 2011 +0000
+++ b/USBDevice/USBAudio/USBAudio.cpp	Fri Dec 16 17:06:49 2011 +0000
@@ -67,22 +67,25 @@
 bool USBAudio::write(uint8_t * buf) {
     readIN = false;
     SOF_handler = false;
-    USBDevice::writeNB(EP3IN, buf, 16, 16);
-    while(!SOF_handler);
-    if(interruptIN) {
-        while(!readIN);
+    if (interruptIN) {
+        USBDevice::writeNB(EP3IN, buf, 16, 16);
+    } else {
+        buf_stream = buf;
     }
+    while (!SOF_handler);
+    if (interruptIN) {
+        while (!readIN);
+    }
+    buf_stream = NULL;
     return true;
 }
 
 
 // Called in ISR context on each start of frame
 void USBAudio::SOF(int frameNumber) {
-    int16_t buf[8];
-    for (int i = 0; i < 8; i++) {
-        buf[i] = (i % 2) ? -255 : 255;
+    if (buf_stream != NULL) {
+        USBDevice::writeNB(EP3IN, (uint8_t *)buf_stream, 16, 16);
     }
-    //USBDevice::writeNB(EP3IN, (uint8_t *)buf, 16, 16);
     SOF_handler = true;
 }