17 #ifndef MBED_SYS_TIMER_H 18 #define MBED_SYS_TIMER_H 20 #include "platform/NonCopyable.h" 21 #include "platform/mbed_atomic.h" 22 #include "drivers/TimerEvent.h" 27 #if defined(TARGET_CORTEX_A) 49 template <
class Period,
bool IRQ = true>
55 using period = Period;
56 using duration = std::chrono::duration<uint64_t, period>;
57 using time_point = std::chrono::time_point<SysTimer>;
58 static const bool is_steady =
false;
67 static_assert(std::ratio_divide<period, highres_period>::den == 1,
"Tick period must be an exact multiple of highres time period");
87 static IRQn_ID_t get_irq_number();
89 static IRQn_Type get_irq_number();
241 using highres_duration_u32 = std::chrono::duration<uint32_t, highres_period>;
242 void handler()
override;
243 void _increment_tick();
244 void _schedule_tick();
245 duration _elapsed_ticks()
const;
246 static void _set_irq_pending();
247 static void _clear_irq_pending();
251 uint32_t _unacknowledged_ticks;
253 bool _wake_time_passed;
256 bool _deep_sleep_locked;
TickerDataClock::period highres_period
period of underlying high-res timer
void cancel_wake()
Cancel any pending wake.
void start_tick()
Schedule an os tick to fire.
TickerDataClock::time_point highres_time_point
time_point type used for underlying high-res timer
Ticker's data structure.
SysTimer()
Default constructor uses LPTICKER if available (so the timer will continue to run in deep sleep)...
Prevents generation of copy constructor and copy assignment operator in derived classes.
highres_time_point get_time() const
Get the time.
bool wake_time_passed() const
Check whether the wake time has passed.
bool wake_time_set() const
Check whether wake timer is active.
time_point get_tick() const
Get the current tick count.
time_point update_and_get_tick()
Update and get the current tick count.
The SysTimer class is used to provide timing for system suspension, and the idle loop in TICKLESS mod...
Base abstraction for timer interrupts.
TickerDataClock::duration highres_duration
duration type used for underlying high-res timer
void set_wake_time(time_point at)
Get the interrupt number for the tick.
void cancel_tick()
Prevent any more scheduled ticks from triggering.
bool ticking() const
Check whether ticker is active.
highres_duration get_time_since_tick() const
Returns time since last tick.
std::chrono::duration< int, period > unacknowledged_ticks() const
Check unacknowledged ticks.
void acknowledge_tick()
Acknowledge an os tick.