Espressif ESP32-S2 Programming Manual page 934

Table of Contents

Advertisement

Chapter 2. API Reference
Timer functionality is provided by a timer service/daemon task. Many of the public FreeRTOS timer API
functions send commands to the timer service task through a queue called the timer command queue. The
timer command queue is private to the kernel itself and is not directly accessible to application code. The
length of the timer command queue is set by the configTIMER_QUEUE_LENGTH configuration constant.
xTimerStop() stops a timer that was previously started using either of the The xTimerStart(), xTimerReset(),
xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() or xTimerChangePeriodFromISR()
API functions.
Stopping a timer ensures the timer is not in the active state.
The configUSE_TIMERS configuration constant must be set to 1 for xTimerStop() to be available.
Example usage:
Return pdFAIL will be returned if the stop command could not be sent to the timer command queue even
after xTicksToWait ticks had passed. pdPASS will be returned if the command was successfully sent to
the timer command queue. When the command is actually processed will depend on the priority of the
timer service/daemon task relative to other tasks in the system. The timer service/daemon task priority
is set by the configTIMER_TASK_PRIORITY configuration constant.
Parameters
• xTimer: The handle of the timer being stopped.
• xTicksToWait: Specifies the time, in ticks, that the calling task should be held in the Blocked
state to wait for the stop command to be successfully sent to the timer command queue, should the
queue already be full when xTimerStop() was called. xTicksToWait is ignored if xTimerStop() is
called before the scheduler is started.
See the xTimerCreate() API function example usage scenario.
xTimerChangePeriod(xTimer, xNewPeriod, xTicksToWait)
BaseType_t xTimerChangePeriod( TimerHandle_t xTimer, TickType_t xNewPeriod, TickType_t xTick-
sToWait );
Timer functionality is provided by a timer service/daemon task. Many of the public FreeRTOS timer API
functions send commands to the timer service task through a queue called the timer command queue. The
timer command queue is private to the kernel itself and is not directly accessible to application code. The
length of the timer command queue is set by the configTIMER_QUEUE_LENGTH configuration constant.
xTimerChangePeriod() changes the period of a timer that was previously created using the xTimerCreate()
API function.
xTimerChangePeriod() can be called to change the period of an active or dormant state timer.
The configUSE_TIMERS configuration constant must be set to 1 for xTimerChangePeriod() to be available.
Example usage:
* //
This function assumes xTimer has already been
* //
referenced by xTimer
* //
is
deleted.
* //
called, then the period of the timer
* // started.
*
void vAFunction( TimerHandle_t xTimer )
*
{
*
if( xTimerIsTimerActive( xTimer )
equivalently
*
{
*
//
xTimer
*
xTimerDelete( xTimer );
*
}
*
else
*
{
*
//
xTimer
*
//
cause the timer to
*
//
change period command cannot immediately be sent to the timer
Espressif Systems
is
already active when it
If the timer referenced by xTimer
"if( xTimerIsTimerActive( xTimer ) )"
is
already active
is not
active, change its period to
start.
Submit Document Feedback
created.
is
is not
is set
to 500ms
!=
pdFALSE )
//
-
delete
it.
Block
for
a maximum of
923
If the timer
called, then the timer
active when it
is
and
the timer
is
or
more simply
and␣
500ms.
This will also
100
ticks
if
(continues on next page)
Release v4.4
the

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

Table of Contents

Save PDF