Modified USBAudio to call a callback function when audio an packets is received.

Dependents:   usb_sound_effects

Fork of USBDevice by mbed official

Revision:
21:8133879e4fb4
Parent:
4:eaa07ce86d49
--- a/USBAudio/USBAudio.h	Fri Mar 01 13:10:29 2013 +0000
+++ b/USBAudio/USBAudio.h	Thu Mar 27 21:26:37 2014 +0000
@@ -145,6 +145,14 @@
         updateVol.attach(tptr, mptr);
     }
 
+    /** Attach a callback to service incomming audio packets.
+     *
+     * @param function Function to attach
+     *
+     */
+    void attachReadCallback(void(*fptr)(void)) {
+        readCallback.attach(fptr);
+    }
 
 protected:
 
@@ -277,6 +285,9 @@
     // callback to update volume
     FunctionPointer updateVol;
     
+    // callback to service incomming audio packet
+    FunctionPointer readCallback;
+    
     // boolean showing that the SOF handler has been called. Useful for readNB.
     volatile bool SOF_handler;