adds a USB serial port to your design
Dependents: Example_WatchDog_Timer
Diff: USBSerial/USBSerial.h
- Revision:
- 78:772335cfca9a
- Parent:
- 77:3e96144c2bf2
- Parent:
- 75:9e53252fac92
- Child:
- 79:ac72418e2b64
diff -r 3e96144c2bf2 -r 772335cfca9a USBSerial/USBSerial.h --- a/USBSerial/USBSerial.h Mon Nov 26 20:46:02 2018 +0000 +++ b/USBSerial/USBSerial.h Mon Nov 26 21:00:06 2018 +0000 @@ -134,7 +134,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); } } @@ -145,11 +145,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