Timeout driver for event at absolute time
Dependents: demo_TimeoutAbs i2c_lora_slave
Timeout driver for generating event at absolute time, i.e. alarm at 12:00PM instead of alarm in 5 minutes.
This is the same concept as TIMER_ABSTIME in clock_nanosleep().
The purpose is to remove dependency on when attach()
is called, so the event occurs at correct time regardless of any latency in calling attach()
.
This driver doesnt add any functionality over mbed-os library; it only skips the call to ticker_read_us()
in Ticker::setup()
, which just changes a relative time to absolute time.
example use here.
LowPowerTimeoutAbs.h
- Committer:
- Wayne Roberts
- Date:
- 2018-12-07
- Revision:
- 1:ae6b29794806
- Parent:
- 0:900163d530ae
File content as of revision 1:ae6b29794806:
#ifndef MBED_LPABS_H #define MBED_LPABS_H #include "platform/platform.h" #include "TimeoutAbs.h" #include "platform/NonCopyable.h" #if defined (DEVICE_LPTICKER) || defined(DOXYGEN_ONLY) #include "hal/lp_ticker_api.h" namespace mbed { class LowPowerTimeoutAbs : public TimeoutAbs, private NonCopyable<LowPowerTimeoutAbs> { public: LowPowerTimeoutAbs() : TimeoutAbs(get_lp_ticker_data()) { } virtual ~LowPowerTimeoutAbs () { } }; } // namespace mbed #endif #endif