Not work original Lib on F446RE & L432KC . Change usage prime() & setNext() for both TX and RX function due to unexpected behavior (maybe os TimerEvent function problem)
Dependents: BufferedSoftSerial
SoftSerial_Ticker.h
00001 //A modified version of the regular ticker/timeout libraries 00002 // to allow us to do timeout without losing accuracy 00003 00004 // Modified by K.Arai / JH1PJL May 12th, 2020 00005 00006 #ifndef FLEXTICKER_H 00007 #define FLEXTICKER_H 00008 00009 #include "mbed.h" 00010 00011 class FlexTicker: public TimerEvent 00012 { 00013 public: 00014 template<typename T> 00015 void attach(T* tptr, void (T::*mptr)(void)) 00016 { 00017 _function = Callback<void()>(tptr, mptr); 00018 } 00019 00020 /** Detach the function 00021 */ 00022 void detach() 00023 { 00024 remove(); 00025 } 00026 00027 void setNext(int delay) 00028 { 00029 insert(event.timestamp + delay); 00030 } 00031 00032 void prime(int comp_time = 0) 00033 { 00034 event.timestamp = us_ticker_read() + comp_time; 00035 } 00036 00037 protected: 00038 virtual void handler() 00039 { 00040 _function.call(); 00041 } 00042 00043 unsigned int _delay; 00044 Callback<void()> _function; 00045 }; 00046 00047 #endif
Generated on Thu Jul 21 2022 01:12:39 by
![doxygen](doxygen.png)