Mistake on this page?
Report an issue in GitHub or email us
Functions
Ticker HAL functions

Functions

void ticker_set_handler (const ticker_data_t *const ticker, ticker_event_handler handler)
 Initialize a ticker and set the event handler. More...
 
void ticker_irq_handler (const ticker_data_t *const ticker)
 IRQ handler that goes through the events to trigger overdue events. More...
 
void ticker_remove_event (const ticker_data_t *const ticker, ticker_event_t *obj)
 Remove an event from the queue. More...
 
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. More...
 
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. More...
 
timestamp_t ticker_read (const ticker_data_t *const ticker)
 Read the current (relative) ticker's timestamp. More...
 
us_timestamp_t ticker_read_us (const ticker_data_t *const ticker)
 Read the current (absolute) ticker's timestamp. More...
 
int ticker_get_next_timestamp (const ticker_data_t *const ticker, timestamp_t *timestamp)
 Read the next event's timestamp. More...
 
void ticker_suspend (const ticker_data_t *const ticker)
 Suspend this ticker. More...
 
void ticker_resume (const ticker_data_t *const ticker)
 Resume this ticker. More...
 

Detailed Description

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
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
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
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.
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
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
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
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.
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
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.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.