cc2640软件用c语言开发,CC2640R2F&TI-RTOS 拿到 TI CC2640R2F 开发板 第三件事就是使用 TI-RTOS 创建 一个任务 和 使用 信号量 超时来闪烁 LED灯...

/** 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 );

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值