FreeRTOS:
Common I/O
AWS IoT Common I/O library
|
Return to main page ↑ |
Macros | |
#define | IOT_TIMER_SUCCESS ( 0 ) |
Return values used by timer driver. More... | |
#define | IOT_TIMER_INVALID_VALUE ( 1 ) |
#define | IOT_TIMER_FUNCTION_NOT_SUPPORTED ( 2 ) |
#define | IOT_TIMER_NOT_RUNNING ( 3 ) |
#define | IOT_TIMER_SET_FAILED ( 4 ) |
Typedefs | |
typedef struct IotTimerDescriptor * | IotTimerHandle_t |
IotTimerHandle_t type is the timer handle returned by calling iot_timer_open() this is initialized in open and returned to caller. Caller must pass this pointer to the rest of the APIs. | |
typedef void(* | IotTimerCallback_t) (void *pvUserContext) |
timer callback notification type. This callback is used for notifying the caller when the setup timer expires. More... | |
Functions | |
IotTimerHandle_t | iot_timer_open (int32_t lTimerInstance) |
iot_timer_open is used to initialize the timer. This function will start the timer. More... | |
void | iot_timer_set_callback (IotTimerHandle_t const pxTimerHandle, IotTimerCallback_t xCallback, void *pvUserContext) |
iot_timer_set_callback is used to set the callback to be called when the timer reaches the count (delay) set by the caller. Callers can set the delay using the iot_timer_delay API. More... | |
int32_t | iot_timer_start (IotTimerHandle_t const pxTimerHandle) |
iot_timer_start is used to start the timer counter. This call only makes the timer counter running, and does not setup any match values etc.. More... | |
int32_t | iot_timer_stop (IotTimerHandle_t const pxTimerHandle) |
iot_timer_stop is used to stop the timer counter if the timer is running. More... | |
int32_t | iot_timer_get_value (IotTimerHandle_t const pxTimerHandle, uint64_t *ullMicroSeconds) |
iot_timer_get_value is used to get the current timer value in micro seconds. More... | |
int32_t | iot_timer_delay (IotTimerHandle_t const pxTimerHandle, uint32_t ulDelayMicroSeconds) |
iot_timer_delay is used to set up a delay/wake-up time in microseconds. The caller can use this API to delay current execution until the specified microSeconds. A callback is called once the delay is expired (i,e the amount of microseconds is passed from the time the API is called). If no callback is registered by the caller, then once the delay is expired, caller cannot be notified, but this mechanism can be useful to wake up the target from sleep. More... | |
int32_t | iot_timer_cancel (IotTimerHandle_t const pxTimerHandle) |
iot_timer_cancel is used to cancel any existing delay call. If a call to iot_timer_delay() was made earlier, calling iot_timer_cancel will cancel that delay call, so no call-back will be called. More... | |
int32_t | iot_timer_close (IotTimerHandle_t const pxTimerHandle) |
iot_timer_close is used to de-initializes the timer, stops the timer if it was started and cancels the delay calls, and resets the timer value. More... | |
#define IOT_TIMER_SUCCESS ( 0 ) |
Return values used by timer driver.
Timer operation completed successfully.
#define IOT_TIMER_INVALID_VALUE ( 1 ) |
At least one parameter is invalid.
#define IOT_TIMER_FUNCTION_NOT_SUPPORTED ( 2 ) |
Timer operation not supported.
#define IOT_TIMER_NOT_RUNNING ( 3 ) |
Timer not running.
#define IOT_TIMER_SET_FAILED ( 4 ) |
Timer set failed.
typedef void( * IotTimerCallback_t) (void *pvUserContext) |
timer callback notification type. This callback is used for notifying the caller when the setup timer expires.
[in] | pvUserContext | User Context passed when setting the callback. |
IotTimerHandle_t iot_timer_open | ( | int32_t | lTimerInstance | ) |
iot_timer_open is used to initialize the timer. This function will start the timer.
[in] | lTimerInstance | instance of the timer to initialize. |
void iot_timer_set_callback | ( | IotTimerHandle_t const | pxTimerHandle, |
IotTimerCallback_t | xCallback, | ||
void * | pvUserContext | ||
) |
iot_timer_set_callback is used to set the callback to be called when the timer reaches the count (delay) set by the caller. Callers can set the delay using the iot_timer_delay API.
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |
[in] | xCallback | The callback function to be called. |
[in] | pvUserContext | The user context to be passed when callback is called. |
int32_t iot_timer_start | ( | IotTimerHandle_t const | pxTimerHandle | ) |
iot_timer_start is used to start the timer counter. This call only makes the timer counter running, and does not setup any match values etc..
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |
int32_t iot_timer_stop | ( | IotTimerHandle_t const | pxTimerHandle | ) |
iot_timer_stop is used to stop the timer counter if the timer is running.
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |
int32_t iot_timer_get_value | ( | IotTimerHandle_t const | pxTimerHandle, |
uint64_t * | ullMicroSeconds | ||
) |
iot_timer_get_value is used to get the current timer value in micro seconds.
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |
[out] | ullMicroSeconds | current timer count in microseconds. |
int32_t iot_timer_delay | ( | IotTimerHandle_t const | pxTimerHandle, |
uint32_t | ulDelayMicroSeconds | ||
) |
iot_timer_delay is used to set up a delay/wake-up time in microseconds. The caller can use this API to delay current execution until the specified microSeconds. A callback is called once the delay is expired (i,e the amount of microseconds is passed from the time the API is called). If no callback is registered by the caller, then once the delay is expired, caller cannot be notified, but this mechanism can be useful to wake up the target from sleep.
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |
[in] | ulDelayMicroSeconds | delay time in micro seconds |
Example timer delay execution The callback function is called to signal when the timer reaches the count (delay) set by the caller.
int32_t iot_timer_cancel | ( | IotTimerHandle_t const | pxTimerHandle | ) |
iot_timer_cancel is used to cancel any existing delay call. If a call to iot_timer_delay() was made earlier, calling iot_timer_cancel will cancel that delay call, so no call-back will be called.
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |
int32_t iot_timer_close | ( | IotTimerHandle_t const | pxTimerHandle | ) |
iot_timer_close is used to de-initializes the timer, stops the timer if it was started and cancels the delay calls, and resets the timer value.
[in] | pxTimerHandle | handle to Timer interface returned in iot_timer_open() |