Chapter 2. API Reference
(continued from previous page)
* xBacklightTimer = xTimerCreate( "BacklightTimer", // Just a␣
,→text name, not used by the kernel.
* ( 5000 / portTICK_PERIOD_MS), // The␣
,→timer period in ticks.
* pdFALSE, // The timer␣
,→is a one-shot timer.
* 0, // The id is␣
,→not used by the callback so can take any value.
* vBacklightTimerCallback // The␣
,→callback function that switches the LCD back-light off.
* );
*
* if( xBacklightTimer == NULL )
* {
* // The timer was not created.
* }
* else
* {
* // Start the timer. No block time is specified, and even if one was
* // it would be ignored because the scheduler has not yet been
* // started.
* if( xTimerStart( xBacklightTimer, 0 ) != pdPASS )
* {
* // The timer could not be set into the Active state.
* }
* }
*
* // ...
* // Create tasks here.
* // ...
*
* // Starting the scheduler will start the timer running as it has already
* // been set into the active state.
* vTaskStartScheduler();
*
* // Should not reach here.
* for( ;; );
* }
*
Return pdFAIL will be returned if the reset 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, although the timers expiry time is
relative to when xTimerStart() 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 reset/started/restarted.
• xTicksToWait: Specifies the time, in ticks, that the calling task should be held in the Blocked
state to wait for the reset command to be successfully sent to the timer command queue, should the
queue already be full when xTimerReset() was called. xTicksToWait is ignored if xTimerReset() is
called before the scheduler is started.
xTimerStartFromISR(xTimer, pxHigherPriorityTaskWoken)
BaseType_t xTimerStartFromISR( TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken );
A version of xTimerStart() that can be called from an interrupt service routine.
Example usage:
* // This scenario assumes xBacklightTimer has already been created. When a
(continues on next page)
Espressif Systems 926
Submit Document Feedback
Release v4.4