/** data_process.c
*
* Created on: 2018年7月5日
* Author: admin*/#include#include#include#include#include#include"board_led.h"#include"board_uart.h"#include#include"data_process.h"
//Task configuration
#define LF_TASK_PRIORITY 1
#define LF_TASK_STACK_SIZE 256
//Task configuration
Task_Struct lfTask;
Char lfTaskStack[LF_TASK_STACK_SIZE];
Semaphore_Handle semLedFicker;/*********************************************************************
* @fn LedFicker_createTask
*
* @brief Task creation function for the led ficker.
*
* @param None.
*
* @return None.*/
void LedFicker_createTask(void)
{
Task_Params taskParams;//Configure task
Task_Params_init(&taskParams);
taskParams.stack=lfTaskStack;
taskParams.stackSize=LF_TASK_STACK_SIZE;
taskParams.priority=LF_TASK_PRIORITY;
Task_construct(&lfTask, LedFicker_taskFxn, &taskParams, NULL);
}/*********************************************************************
* @fn LedFicker_taskFxn
*
* @brief Application task entry point for the Led Ficker.
*
* @param a0, a1 - not used.
*
* @return None.*/
static voidLedFicker_taskFxn(UArg a0, UArg a1)
{
Semaphore_Params semLedFickerParams;
uint32_t timeoutInTicks= 1000 * (1000/Clock_tickPeriod);
Semaphore_Params_init(&semLedFickerParams);
semLedFicker= Semaphore_create(0, &semLedFickerParams, NULL); /*Memory allocated in here*/
if (semLedFicker == NULL) /*Check if the handle is valid*/{
bspDebugPrintf(true,"semLedFicker could not be created.\r\n");
}else{
bspDebugPrintf(true,"semLedFicker be created.\r\n");
}//Application main loop
for(;;)
{
Semaphore_pend(semLedFicker, timeoutInTicks);//翻转LED灯
ledBoardToggle( ledBlueBoard );
ledBoardToggle( ledRedBoard );
}
}