Espressif ESP32-S2 Programming Manual page 938

Table of Contents

Advertisement

Chapter 2. API Reference
* //
key
is
pressed, an LCD back-light
* //
without a key being pressed, then the LCD back-light
* //
this case, the timer
* //
the xTimerReset() function, the key press event handler
* //
service
routine.
*
* //
The callback function assigned to the one-shot
* //
parameter
*
void vBacklightTimerCallback( TimerHandle_t pxTimer )
*
{
*
//
The timer expired, therefore
*
//
was
pressed.
*
vSetBacklightState( BACKLIGHT_OFF );
*
}
*
* //
The key press interrupt service
*
void vKeyPressEventInterruptHandler( void )
*
{
*
BaseType_t xHigherPriorityTaskWoken
*
*
//
Ensure the LCD back-light
*
//
responsible
*
//
key
inactivity.
*
//
call FreeRTOS API functions that end
*
vSetBacklightState( BACKLIGHT_ON );
*
*
//
xTimerStartFromISR()
*
//
as
both cause the timer to re-calculate its expiry
*
//
xHigherPriorityTaskWoken was initialised to pdFALSE when it was
*
//
declared
*
if( xTimerStartFromISR( xBacklightTimer, &xHigherPriorityTaskWoken )
pdPASS )
*
{
*
//
The start command was
*
//
action
*
}
*
*
//
Perform the rest of the key processing
*
*
//
If xHigherPriorityTaskWoken equals pdTRUE, then a context switch
*
//
should be
*
//
from
inside
*
// compiler.
*
//
actual syntax
*
if( xHigherPriorityTaskWoken
*
{
*
//
Call the interrupt safe
*
//
depends on the FreeRTOS port being
*
}
*
}
*
Return pdFAIL will be returned if the start command could not be sent to the timer command queue. 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, although the timers expiry time is relative to when xTimerStartFromISR() is actually called.
The timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY configuration
constant.
Parameters
• xTimer: The handle of the timer being started/restarted.
• pxHigherPriorityTaskWoken: The timer service/daemon task spends most of its time in
Espressif Systems
is
a one-shot timer,
is not
used.
Switch off the LCD
for
turning the back-light off after
This
is
an interrupt service routine so can only
or
xTimerResetFromISR() could be called here
(in
this
function).
here.
performed.
The syntax required to perform a context switch
an ISR varies
Inspect the demos
required.
Submit Document Feedback
is
switched
on.
and
unlike the example given
timer.
5
seconds must have passed since a key
back-light.
routine.
=
pdFALSE;
is
on, then restart the timer that
in
"FromISR".
not
executed
successfully.
here.
from
port
to port,
and from
for
the port you are using to find the
!=
pdFALSE )
yield
function here (actual function
used).
927
(continued from previous page)
If
5
seconds
pass
is
switched
off.
is
an interrupt
In this case the
is
5
seconds of
time.
!=␣
Take appropriate
compiler
to
Release v4.4
In
for

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?

Table of Contents

Save PDF