Kazuki Yamamoto / USBCDCMSC

Dependents:   USBMSD_CDC_11U35test

Revision:
2:8f01347859d0
Parent:
1:0c31d9b30900
Child:
3:178491b4d4f3
--- a/USBCDCMSC.h	Tue Apr 21 16:42:12 2015 +0000
+++ b/USBCDCMSC.h	Wed Apr 22 04:54:29 2015 +0000
@@ -172,18 +172,59 @@
     */
     bool readEP_NB(uint8_t * buffer, uint32_t * size);
 
+    /*
+    * Called by USBDevice on Endpoint0 request. Warning: Called in ISR context
+    * This is used to handle extensions to standard requests
+    * and class specific requests
+    *
+    * @returns true if class handles this request
+    */
     virtual bool USBCallback_request();
+
+    /*
+    * Called by USBDevice on Endpoint0 request completion
+    * if the 'notify' flag has been set to true. Warning: Called in ISR context
+    *
+    * In this case it is used to indicate that a HID report has
+    * been received from the host on endpoint 0
+    *
+    * @param buf buffer received on endpoint 0
+    * @param length length of this buffer
+    */
+    virtual void USBCallback_requestCompleted(uint8_t *buf, uint32_t length); //from USBCDC class
+
+    /*
+    * Called by USBDevice layer. Set configuration of the device.
+    * For instance, you can add all endpoints that you need on this function.
+    *
+    * @param configuration Number of the configuration
+    */
     virtual bool USBCallback_setConfiguration(uint8_t configuration);
 
+    /*
+    * Called by USBCallback_requestCompleted when CDC line coding is changed
+    * Warning: Called in ISR
+    *
+    * @param baud The baud rate
+    * @param bits The number of bits in a word (5-8)
+    * @param parity The parity
+    * @param stop The number of stop bits (1 or 2)
+    */
+    virtual void lineCodingChanged(int baud, int bits, int parity, int stop){
+        if (settingsChangedCallback) {
+            settingsChangedCallback(baud, bits, parity, stop);
+        }
+    }
+
     virtual bool EP2_OUT_callback();
 
     /*
-    * Callback called when a packet is received
+    * Callback called when a MSD packet is received
     */
     virtual bool EP3_OUT_callback();
 
     /*
-    * Callback called when a packet has been sent
+    * Callback called when a MSD packet has been sent
     */
     virtual bool EP3_IN_callback();
 
@@ -274,6 +315,7 @@
     int disk_sectors();
     int disk_size();
 
+    void (*settingsChangedCallback)(int baud, int bits, int parity, int stop);
 };
 
 #endif