diff --git a/epicardium/FreeRTOSConfig.h b/epicardium/FreeRTOSConfig.h index 51d3fd3b3a483aeba34ad168b752d98fe3bfd108..eb82e8012708be3562e2c66efc620c57a5a479bc 100644 --- a/epicardium/FreeRTOSConfig.h +++ b/epicardium/FreeRTOSConfig.h @@ -43,6 +43,11 @@ #define configUSE_CO_ROUTINES 0 #define configUSE_16_BIT_TICKS 0 #define configUSE_MUTEXES 1 +#define configUSE_TIMERS 1 + +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelay 1 diff --git a/epicardium/support.c b/epicardium/support.c index 7d6fb23863e111c311bf2945a755e4e8bcd2be9c..534506ba3ca22fe6e827b3fe1aca22a1668be853 100644 --- a/epicardium/support.c +++ b/epicardium/support.c @@ -80,3 +80,35 @@ void vApplicationGetIdleTaskMemory( */ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } + +void vApplicationGetTimerTaskMemory( + StaticTask_t **ppxTimerTaskTCBBuffer, + StackType_t **ppxTimerTaskStackBuffer, + uint32_t *pulTimerTaskStackSize +) { + /* + * If the buffers to be provided to the Timer task are declared inside + * this function then they must be declared static - otherwise they will + * be allocated on the stack and so not exists after this function + * exits. + */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH]; + + /* + * Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. + */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* + * Pass out the size of the array pointed to by + * *ppxTimerTaskStackBuffer. Note that, as the array is necessarily of + * type StackType_t, configMINIMAL_STACK_SIZE is specified in words, not + * bytes. + */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; +}