[uCOS/RTOS]

freertos 中 task notify 的 疑问

[复制链接]
977|1
手机看帖
扫描二维码
随时随地手机跟帖
suxilong|  楼主 | 2019-3-7 19:45 | 显示全部楼层 |阅读模式
想通过一个定时器 调用task notify  的函数实现 task 每一段时间跑一次

而且 config的时候 是开了#define configUSE_TASK_NOTIFICATIONS 1

但是就是一直阻塞没有进入Msg_Process();


#include "FreeRTOS.h"
#include "semphr.h"
#include "projdefs.h"
#include "timers.h"
#include "task.h"

static TaskHandle_t     task_handles;
TimerHandle_t   timer_hadles;


static void timer_generate(void)
{
     //10ms
     xTaskNotifyGive( task_handles );
}

void task(void)
{
      for (;;)
      {
          //阻塞等待 notify
           ulTaskNotifyTake( pdTRUE, portMAX_DELAY );

           Msg_Process();
       }
}


void task_create(void)
{
        OUT_LOG_I("task create");
        xTaskCreate(task,"task",640,NULL,1,&task_handles);
        //每10ms notify 一下
        timer_hadles = xTimerCreate("timer", TIMER_BASE/portTICK_PERIOD_MS, pdTRUE, NULL, timer_generate);
        xTimerStart(timer_hadles, 0);

}



相关帖子

帮你顶住啊!大佬

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:没有最差,只有最懒

55

主题

339

帖子

4

粉丝