API functions needed for timing operations.
More...
#include <stdint.h>
Go to the source code of this file.
|
void | wait (uint16_t delay) |
| Function to delay execution for a specified amount of time.
|
|
void | set_interval (uint16_t delay, timer_callback_t callback) |
| Allows a function callback to be fired continuously after the specified amount of time.
|
|
void | set_timeout (uint16_t delay, timer_callback_t callback) |
| Allows a function callback to be fired a single time after the specified amount of time.
|
|
void | clear_interval () |
| Allows canceling all future callbacks previously initialized by calling set_interval()
|
|
void | clear_timeout () |
| Cancels the callback scheduled previously by set_timeout() before it has occurred.
|
|
◆ wait()
void wait |
( |
uint16_t | delay | ) |
|
Calling wait() will halt execution of the program for the specified amount of time. The delay parameter needs to be specified in 10ms multiples. Important note: only one timing event (ie: by using set_interval, set_timeout, or wait) can be scheduled at a time.
- Parameters
-
delay | Number of milliseconds to block. Will be rounded to the nearest 10ms. |
◆ set_interval()
void set_interval |
( |
uint16_t | delay, |
|
|
timer_callback_t | callback ) |
This setup should be called just once (perhaps in your setup() routine. The callback will be executed after the specified amount of time. The callback will continue to be called until clear_interval is called. Important note: only one timing event (ie: by using set_interval, set_timeout, or wait) can be scheduled at a time.
- Parameters
-
delay | Number of milliseconds to wait in between callback calls. Will be rounded to nearest 10ms. |
callback | The function callback that will be executed on the specified interval. |
◆ set_timeout()
void set_timeout |
( |
uint16_t | delay, |
|
|
timer_callback_t | callback ) |
The callback will be executed just once after the specified amount of time. If you wish to cancel the timeout before the callback has fired call clear_timeout(). Important note: only one timing event (ie: by using set_interval, set_timeout, or wait) can be scheduled at a time.
- Parameters
-
delay | Number of milliseconds to wait in between callback calls. Will be rounded to nearest 10ms. |
callback | The function callback that will be executed on the specified interval. |
◆ clear_interval()
Used to stop all future callbacks previously initialized by set_interval(). Once clear_interval has been called, other timing API calls may be used.
◆ clear_timeout()
Cancels the callback scheduled previously by set_timeout() before it has occurred.