Software Serial lib
Dependents: BufferedSoftSerial
Fork of SoftSerial by
SoftSerial_Ticker.h
- Committer:
- jotaemesousa
- Date:
- 2015-05-19
- Revision:
- 12:df8c4d11ebf0
- Parent:
- 6:517082212c00
File content as of revision 12:df8c4d11ebf0:
//A modified version of the regular ticker/timeout libraries to allow us to do timeout without losing accuracy #ifndef FLEXTICKER_H #define FLEXTICKER_H #include "mbed.h" #include "us_ticker_api.h" class FlexTicker: public TimerEvent { public: template<typename T> void attach(T* tptr, void (T::*mptr)(void)) { _function.attach(tptr, mptr); } /** Detach the function */ void detach() { remove(); } void setNext(int delay) { insert(event.timestamp + delay); } void prime(void) { event.timestamp = us_ticker_read(); } protected: virtual void handler() { _function.call(); } unsigned int _delay; FunctionPointer _function; }; #endif