Rtos API example
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. |
Function Documentation
int ticker_get_next_timestamp | ( | const ticker_data_t *const | ticker, |
timestamp_t * | timestamp | ||
) |
Read the next event's timestamp.
- Parameters:
-
ticker The ticker object. timestamp The timestamp object.
- Returns:
- 1 if timestamp is pending event, 0 if there's no event pending
Definition at line 384 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:
-
ticker The ticker object. obj The event object to be inserted to the queue timestamp The event's timestamp id The event object
Definition at line 289 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:
-
ticker The ticker object. obj The event object to be inserted to the queue timestamp The event's timestamp id The event object
Definition at line 308 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:
-
ticker The ticker object.
Definition at line 258 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:
-
ticker The ticker object.
- Returns:
- The current timestamp
Definition at line 372 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:
-
ticker The ticker object.
- Returns:
- The current timestamp
Definition at line 377 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:
-
ticker The ticker object. obj The event object to be removed from the queue
Definition at line 348 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:
-
ticker The ticker object. handler A handler to be set
Definition at line 252 of file mbed_ticker_api.c.
Generated on Sun Jul 17 2022 08:25:38 by 1.7.2