Hello World Timer Task - Bosch XDK110 Quick Start Manual

Cross-domain development kit
Hide thumbs Also See for XDK110:
Table of Contents

Advertisement

!

2.2 Hello World Timer Task

An other type of tasks beside the operating tasks are the timer tasks. These have the advantage to run an
application periodically without manual implementations of any infinite loops. How to use them will be shown
in the implementation code 3 of the hello world application with timer tasks:
Code 6: Hello World Timer Task Application File - application.c
/* system header files */
#include
<stdio.h>
#include
<BCDS_Basics.h>
/* additional interface header files */
#include
"FreeRTOS.h"
#include
"timers.h"
#include
"BCDS_CmdProcessor.h"
#include
"BCDS_Assert.h"
/* Macro used to define blocktime of a timer */
#define
TIMERBLOCKTIME
#define
TIMER_AUTORELOAD_ON
#define
SECONDS(x)
/* Print string "Hello World" on the console */
void
printHelloWorld(xTimerHandle pxTimer)
{
BCDS_UNUSED(pxTimer);
printf("Hello
}
/* Application to print "hello world" on serial console. */
void
applicationInit(void){
xTimerHandle applicationTimer;
/* create timer task to print Hello World in the output console every three
seconds */
/* Validated for portMAX_DELAY to assist the task to wait Infinitely
(without timing out) and ticks cannot be 0 in FreeRTOS timer. So ticks is
assigned to 1 */
applicationTimer = xTimerCreate(
(char
SECONDS(3),
TIMER_AUTORELOAD_ON,

NULL,
printHelloWorld);
/*start the timer*/
xTimerStart(applicationTimer, TIMERBLOCKTIME);
}
/* This is a template function where the user can write his/her custom
application */
void appInitSystem(void
if
(CmdProcessorHandle == NULL){
printf("Command processor handle is null
assert(false);
}
BCDS_UNUSED(param2);
applicationInit();
}
!
XDK110
© 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.
Workbench First Steps Guide XDK110
UINT32_C(0xffff)
pdTRUE
((portTickType) (x * 1000) / portTICK_RATE_MS)
world\r\n");
* const)
"Test Application to print Hello
* CmdProcessorHandle,
World",

uint32_t
param2){
\n\r");
Page ! 1 7
BCDS

Advertisement

Table of Contents
loading

Table of Contents