Mbed OS Reference
Loading...
Searching...
No Matches
LowPowerTickerWrapper Class Reference

Public Member Functions

 LowPowerTickerWrapper (const ticker_data_t *data, const ticker_interface_t *interface, uint32_t min_cycles_between_writes, uint32_t min_cycles_until_match)
 Create a new wrapped low power ticker object. More...
 
void irq_handler (ticker_irq_handler_type handler)
 Interrupt handler called by the underlying driver/hardware. More...
 
void suspend ()
 Suspend wrapper operation and pass through interrupts. More...
 
void resume ()
 Resume wrapper operation and filter interrupts normally. More...
 
bool timeout_pending ()
 Check if a Timeout object is being used. More...
 

Detailed Description

Definition at line 33 of file LowPowerTickerWrapper.h.

Constructor & Destructor Documentation

◆ LowPowerTickerWrapper()

LowPowerTickerWrapper ( const ticker_data_t data,
const ticker_interface_t interface,
uint32_t  min_cycles_between_writes,
uint32_t  min_cycles_until_match 
)

Create a new wrapped low power ticker object.

Parameters
dataLow power ticker data to wrap
interfacenew ticker interface functions
min_cycles_between_writesThe number of whole low power clock periods which must complete before subsequent calls to set_interrupt
min_cycles_until_matchThe minimum number of whole low power clock periods from the current time for which the match timestamp passed to set_interrupt is guaranteed to fire.

N = min_cycles_between_writes

 0       1             N - 1     N     N + 1   N + 2   N + 3
 |-------|------...------|-------|-------|-------|-------|
     ^                                    ^
     |                                    |
 set_interrupt                   Next set_interrupt allowed

N = min_cycles_until_match

 0       1             N - 1     N     N + 1   N + 2   N + 3
 |-------|------...------|-------|-------|-------|-------|
     ^                                   ^
     |                                   |
 set_interrupt              Earliest match timestamp allowed

Member Function Documentation

◆ irq_handler()

void irq_handler ( ticker_irq_handler_type  handler)

Interrupt handler called by the underlying driver/hardware.

Parameters
handlerThe callback which would normally be called by the underlying driver/hardware

◆ suspend()

void suspend ( )

Suspend wrapper operation and pass through interrupts.

This stops to wrapper layer from using the microsecond ticker. This should be called before using the low power ticker APIs directly.

Warning
: Make sure to suspend the LP ticker first (call ticker_suspend()), otherwise the behavior is undefined.

◆ resume()

void resume ( )

Resume wrapper operation and filter interrupts normally.

◆ timeout_pending()

bool timeout_pending ( )

Check if a Timeout object is being used.

Returns
true if Timeout is used for scheduling false otherwise