mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

Ticker HAL functions

Ticker HAL functions
[Hal]

Functions

void ticker_set_handler (const ticker_data_t *const ticker, ticker_event_handler handler)
 Initialize a ticker and set the event handler.
void ticker_irq_handler (const ticker_data_t *const ticker)
 IRQ handler that goes through the events to trigger overdue events.
void ticker_remove_event (const ticker_data_t *const ticker, ticker_event_t *obj)
 Remove an event from the queue.
void ticker_insert_event (const ticker_data_t *const ticker, ticker_event_t *obj, timestamp_t timestamp, uint32_t id)
 Insert an event to the queue.
void ticker_insert_event_us (const ticker_data_t *const ticker, ticker_event_t *obj, us_timestamp_t timestamp, uint32_t id)
 Insert an event to the queue.
timestamp_t ticker_read (const ticker_data_t *const ticker)
 Read the current (relative) ticker's timestamp.
us_timestamp_t ticker_read_us (const ticker_data_t *const ticker)
 Read the current (absolute) ticker's timestamp.
int ticker_get_next_timestamp (const ticker_data_t *const ticker, timestamp_t *timestamp)
 Read the next event's timestamp.
void ticker_suspend (const ticker_data_t *const ticker)
 Suspend this ticker.
void ticker_resume (const ticker_data_t *const ticker)
 Resume this ticker.

Function Documentation

int ticker_get_next_timestamp ( const ticker_data_t *const   ticker,
timestamp_t timestamp 
)

Read the next event's timestamp.

Parameters:
tickerThe ticker object.
timestampThe timestamp object.
Returns:
1 if timestamp is pending event, 0 if there's no event pending

Definition at line 431 of file mbed_ticker_api.c.

void ticker_insert_event ( const ticker_data_t *const   ticker,
ticker_event_t obj,
timestamp_t  timestamp,
uint32_t  id 
)

Insert an event to the queue.

The event will be executed in timestamp - ticker_read().

Warning:
This function does not consider timestamp in the past. If an event is inserted with a timestamp less than the current timestamp then the event will be executed in timestamp - ticker_read() us. The internal counter wrap very quickly it is hard to decide weither an event is in the past or in 1 hour.
Note:
prefer the use of ticker_insert_event_us which allows registration of absolute timestamp.
Parameters:
tickerThe ticker object.
objThe event object to be inserted to the queue
timestampThe event's timestamp
idThe event object

Definition at line 329 of file mbed_ticker_api.c.

void ticker_insert_event_us ( const ticker_data_t *const   ticker,
ticker_event_t obj,
us_timestamp_t  timestamp,
uint32_t  id 
)

Insert an event to the queue.

The event will be executed in timestamp - ticker_read_us() us.

Note:
If an event is inserted with a timestamp less than the current timestamp then the event will be scheduled immediately resulting in an instant call to event handler.
Parameters:
tickerThe ticker object.
objThe event object to be inserted to the queue
timestampThe event's timestamp
idThe event object

Definition at line 349 of file mbed_ticker_api.c.

void ticker_irq_handler ( const ticker_data_t *const   ticker )

IRQ handler that goes through the events to trigger overdue events.

Parameters:
tickerThe ticker object.

Definition at line 288 of file mbed_ticker_api.c.

timestamp_t ticker_read ( const ticker_data_t *const   ticker )

Read the current (relative) ticker's timestamp.

Warning:
Return a relative timestamp because the counter wrap every 4294 seconds.
Parameters:
tickerThe ticker object.
Returns:
The current timestamp

Definition at line 412 of file mbed_ticker_api.c.

us_timestamp_t ticker_read_us ( const ticker_data_t *const   ticker )

Read the current (absolute) ticker's timestamp.

Warning:
Return an absolute timestamp counting from the initialization of the ticker.
Parameters:
tickerThe ticker object.
Returns:
The current timestamp

Definition at line 417 of file mbed_ticker_api.c.

void ticker_remove_event ( const ticker_data_t *const   ticker,
ticker_event_t obj 
)

Remove an event from the queue.

Parameters:
tickerThe ticker object.
objThe event object to be removed from the queue

Definition at line 388 of file mbed_ticker_api.c.

void ticker_resume ( const ticker_data_t *const   ticker )

Resume this ticker.

When resumed the ticker will ignore any time that has passed and continue counting up where it left off.

Parameters:
tickerThe ticker object.

Definition at line 455 of file mbed_ticker_api.c.

void ticker_set_handler ( const ticker_data_t *const   ticker,
ticker_event_handler  handler 
)

Initialize a ticker and set the event handler.

Parameters:
tickerThe ticker object.
handlerA handler to be set

Definition at line 279 of file mbed_ticker_api.c.

void ticker_suspend ( const ticker_data_t *const   ticker )

Suspend this ticker.

When suspended reads will always return the same time and no events will be dispatched. When suspended the common layer will only ever call the interface function clear_interrupt() and that is only if ticker_irq_handler is called.

Parameters:
tickerThe ticker object.

Definition at line 446 of file mbed_ticker_api.c.