Workbench First Steps Guide XDK110
XDK110 BCDS
© Bosch Connected Devices and Solutions GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as
copying and passing on to third parties. BOSCH and the symbol are registered trademarks of Robert Bosch GmbH, Germany.
Note: Specifications within this document are subject to change without notice.
Code 11: Implementation of the timer task
!
The first three variable declarations are required properties for the timer task. This includes the periodicity of
the timer, an one second delay and the maximal block time. For more information please refer to the
freeRTOS guide that you can find here.
Additionally to the declaration of a timer handle for the timer task is required. This handle
LightSensorHandle gives direct access to the timer task and can be used for example to start or stop the
task. The next line of code executes the initialization of the light sensor. Finally the last two lines of code
create and start the required timer task. The first one xTimerCreate() creates the timer task and the second
one xTimerStart() starts the timer task.
Finally the first own sensor application is ready be built and flashed to the XDK.
/* Include this beneath BCDS_UNUSED(param2); in appInitSystem() */
uint32_t timerBlockTime = UINT32_MAX;
uint32_t oneSecondDelay = UINT32_C(1000);
uint32_t timerAutoReloadOn = pdTRUE;
xTimerHandle LightSensorHandle = NULL;
initLightSensor();
LightSensorHandle = xTimerCreate((const char *) "readLightSensor",
oneSecondDelay,timerAutoReloadOn, NULL, readLightSensor);
xTimerStart(LightSensorHandle,timerBlockTime);