Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DHT Milkcocoa mbed
SoftSerialSendOnly/SoftSerial_Ticker.h
- Committer:
- jksoft
- Date:
- 2016-04-29
- Revision:
- 0:8ac5bb04e34d
File content as of revision 0:8ac5bb04e34d:
//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"
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