Simple IoT Board用のライブラリです。 ESP8266ライブラリの軽量化 送信のみのソフトシリアルライブラリを含んでいます。

Dependents:   SITB_HttpGetSample SITB_IFTTTSample SITB_INA226PRC AmbientExampleSITB ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SoftSerial_Ticker.h Source File

SoftSerial_Ticker.h

00001 //A modified version of the regular ticker/timeout libraries to allow us to do timeout without losing accuracy
00002 
00003 #ifndef FLEXTICKER_H
00004 #define FLEXTICKER_H
00005 
00006 #include "mbed.h"
00007 
00008 class FlexTicker: public TimerEvent {
00009     public:
00010     template<typename T>
00011     void attach(T* tptr, void (T::*mptr)(void)) {
00012         _function.attach(tptr, mptr);
00013     }
00014  
00015     /** Detach the function
00016      */
00017     void detach() {
00018         remove();
00019     }
00020     
00021     void setNext(int delay) {
00022         insert(event.timestamp + delay);
00023     }
00024     
00025     void prime(void) {
00026         event.timestamp = us_ticker_read();
00027     }
00028  
00029 protected:
00030     virtual void handler() {
00031         _function.call();
00032     }
00033  
00034     unsigned int _delay;
00035     FunctionPointer _function;
00036 };
00037 
00038 #endif