Junichi Katsu
/
Analog_Temp_Sensor
ワークショップ用に公開しているものです。
Fork of Arch_Analog_Thermistor_Blinker by
Embed:
(wiki syntax)
Show/hide line numbers
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
Generated on Thu Jul 21 2022 09:55:24 by 1.7.2