Chapter 2. API Reference
*
//
If this callback has executed the required number of times, stop the
*
// timer.
*
if( *puxVariableToIncrement
*
{
*
//
This
*
xTimerStop( xExpiredTimer, staticDONT_BLOCK );
*
}
*
}
*
*
*
void main( void )
*
{
*
//
Create the software
*
//
than the normal xTimerCreate() API
pointer
→
*
//
to the StaticTimer_t structure that will hold the software timer
*
// structure.
will be
→
*
//
allocated dynamically, just
*
xTimer
=
Helps debugging
→
*
timer
in
ticks.
→
*
timer.
→
*
variable incremented by the software
→
*
execute when the timer
→
*
hold the software timer
→
*
*
//
The scheduler has
*
xReturned
*
*
// ...
*
//
Create tasks
*
// ...
*
*
//
Starting the scheduler will start the timers running
already
→
*
//
been
set
*
vTaskStartScheduler();
*
*
//
Should
*
for( ;; );
*
}
*
Return If the timer is created then a handle to the created timer is returned. If pxTimerBuffer was NULL
then NULL is returned.
Parameters
• pcTimerName: A text name that is assigned to the timer. This is done purely to assist debugging.
The kernel itself only ever references a timer by its handle, and never by its name.
• xTimerPeriodInTicks: The timer period. The time is defined in tick periods so the con-
stant portTICK_PERIOD_MS can be used to convert a time that has been specified in millisec-
onds. For example, if the timer must expire after 100 ticks, then xTimerPeriodInTicks should be
set to 100. Alternatively, if the timer must expire after 500ms, then xPeriod can be set to ( 500
/ portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or equal to 1000. The
timer period must be greater than 0.
• uxAutoReload: If uxAutoReload is set to pdTRUE then the timer will expire repeatedly with a
Espressif Systems
==
is
called
from
a
time.
If the parameter
xTimerCreateStatic( "T1",
only.
Not used by
expires.
structure.
not
started yet so a block time
=
xTimerStart( xTimer,
here.
into the active
state.
not
reach
here.
Submit Document Feedback
5
)
timer callback so must
xTimerCreateStatic() has an extra parameter
function.
is
passed
as
NULL then the
as if
xTimerCreate() had been
//
FreeRTOS.
xTimerPeriod,
//
pdTRUE,
//
( void
*
) &uxVariableToIncrement,
timer's callback function
prvTimerCallback,
//
&xTimerBuffer );
//
0
);
917
(continued from previous page)
not
block.
The parameter
is
a␣
structure␣
called.
Text name
for
the
task.
The period of
the␣
This
is
an
auto-reload␣
//
The function
to␣
The buffer that
will␣
is not
used.
as
they
have␣
Release v4.4
A␣
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?