Espressif ESP32-S2 Programming Manual page 929

Table of Contents

Advertisement

Chapter 2. API Reference
frequency set by the xTimerPeriodInTicks parameter. If uxAutoReload is set to pdFALSE then the
timer will be a one-shot timer and enter the dormant state after it expires.
• pvTimerID: An identifier that is assigned to the timer being created. Typically this would be used
in the timer callback function to identify which timer expired when the same callback function is
assigned to more than one timer.
• pxCallbackFunction: The function to call when the timer expires. Callback functions must
have the prototype defined by TimerCallbackFunction_t, which is"void vCallbackFunction( Timer-
Handle_t xTimer );".
• pxTimerBuffer: Must point to a variable of type StaticTimer_t, which will be then be used
to hold the software timer's data structures, removing the need for the memory to be allocated
dynamically.
void *pvTimerGetTimerID(const
void *pvTimerGetTimerID( TimerHandle_t xTimer );
Returns the ID assigned to the timer.
IDs are assigned to timers using the pvTimerID parameter of the call to xTimerCreated() that was used to
create the timer, and by calling the vTimerSetTimerID() API function.
If the same callback function is assigned to multiple timers then the timer ID can be used as time specific (timer
local) storage.
Example usage:
Return The ID assigned to the timer being queried.
Parameters
• xTimer: The timer being queried.
See the xTimerCreate() API function example usage scenario.
void
vTimerSetTimerID(TimerHandle_t
void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );
Sets the ID assigned to the timer.
IDs are assigned to timers using the pvTimerID parameter of the call to xTimerCreated() that was used to
create the timer.
If the same callback function is assigned to multiple timers then the timer ID can be used as time specific (timer
local) storage.
Example usage:
Parameters
• xTimer: The timer being updated.
• pvNewID: The ID to assign to the timer.
See the xTimerCreate() API function example usage scenario.
BaseType_t
xTimerIsTimerActive(TimerHandle_t
BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );
Queries a timer to see if it is active or dormant.
A timer will be dormant if: 1) It has been created but not started, or 2) It is an expired one-shot timer that has
not been restarted.
Timers are created in the dormant state. The xTimerStart(), xTimerReset(), xTimerStartFromISR(), xTimer-
ResetFromISR(), xTimerChangePeriod() and xTimerChangePeriodFromISR() API functions can all be used
to transition a timer into the active state.
Example usage:
* //
This function assumes xTimer has already been
*
void vAFunction( TimerHandle_t xTimer )
*
{
Espressif Systems
TimerHandle_t
xTimer)
xTimer, void *pvNewID)
xTimer)
918
Submit Document Feedback
created.
(continues on next page)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF