Software UART program using Infra-Red LED and IR-Detector
Dependents: TestVirtualisation Bf_SoftSerial_IR
SoftSerial_Ticker_IR.h
- Committer:
- kenjiArai
- Date:
- 2018-12-20
- Revision:
- 13:2b5649a1278a
- Parent:
- 12:79d63607bbb1
- Child:
- 14:dc766032cdd6
File content as of revision 13:2b5649a1278a:
// Apply for Infrared LED and IR-Detector // Modified by JH1PJL Dec. 19th, 2018 // A modified version of the regular ticker/timeout libraries // to allow us to do timeout without losing accuracy #ifndef FLEXTICKERIR_H #define FLEXTICKERIR_H #include "mbed.h" class FlexTicker_IR: 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(uint32_t offset) { event.timestamp = us_ticker_read() - offset; } protected: virtual void handler() { _function.call(); } unsigned int _delay; FunctionPointer _function; }; #endif