adds a USB serial port to your design

Dependents:   Example_WatchDog_Timer

Revision:
75:9e53252fac92
Parent:
70:2c525a50f1b6
Child:
78:772335cfca9a
--- a/USBSerial/USBSerial.h	Fri Nov 23 18:05:40 2018 +0000
+++ b/USBSerial/USBSerial.h	Sat Nov 24 14:06:47 2018 -0600
@@ -127,7 +127,7 @@
     template<typename T>
     void attach(T* tptr, void (T::*mptr)(void)) {
         if((mptr != NULL) && (tptr != NULL)) {
-            rx.attach(tptr, mptr);
+            rx = Callback<void()>(mptr, tptr);
         }
     }
 
@@ -138,11 +138,20 @@
      */
     void attach(void (*fptr)(void)) {
         if(fptr != NULL) {
-            rx.attach(fptr);
+            rx = Callback<void()>(fptr);
         }
     }
 
     /**
+     * Attach a Callback called when a packet is received
+     *
+     * @param cb Callback to attach
+     */
+    void attach(Callback<void()> &cb) {
+        rx = cb;
+    }
+
+    /**
      * Attach a callback to call when serial's settings are changed.
      *
      * @param fptr function pointer