2022-01-16 threadx的信号量的应用

实验使用的开发板是ART-PI,stm32h750芯片+threadx。创建信号量,实现两个任务之间同步。

第一步:首先通过stm32cubeMX移植了threadx(参考上一篇文章)。

第二步:创建信号量。在

int tx_application_define(VOID *first_unused_memory)里面创建信号量。
//创建信号量
    UINT status;
      status=tx_semaphore_create((TX_SEMAPHORE *) &Semaphore,"semaphore",0);
      if (status != TX_SUCCESS)
      {
          debug("create dynamic semaphore failed.\n");
          return -1;
      }
      else
      {
          debug("create done. dynamic semaphore value = 0.\n");
      }

第三步:创建信号量的线程和串口线程,通过串口打印输出。 

#define  APP_CFG_TASK_SEM_PRIO                     7u
#define  APP_CFG_TASK_SEM_STK_SIZE                 4096u
static  TX_THREAD   AppTaskSEMTCB;
static  uint64_t    AppTaskSEMStk[APP_CFG_TASK_SEM_STK_SIZE/8];
static void AppTaskSEM(ULONG thread_input);

tx_thread_create(&AppT

版权声明:本文为CSDN博主「Believeziwo」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Believeziwo/article/details/122524511

实验使用的开发板是ART-PI,stm32h750芯片+threadx。创建信号量,实现两个任务之间同步。

第一步:首先通过stm32cubeMX移植了threadx(参考上一篇文章)。

第二步:创建信号量。在

int tx_application_define(VOID *first_unused_memory)里面创建信号量。
//创建信号量
    UINT status;
      status=tx_semaphore_create((TX_SEMAPHORE *) &Semaphore,"semaphore",0);
      if (status != TX_SUCCESS)
      {
          debug("create dynamic semaphore failed.\n");
          return -1;
      }
      else
      {
          debug("create done. dynamic semaphore value = 0.\n");
      }

第三步:创建信号量的线程和串口线程,通过串口打印输出。 

#define  APP_CFG_TASK_SEM_PRIO                     7u
#define  APP_CFG_TASK_SEM_STK_SIZE                 4096u
static  TX_THREAD   AppTaskSEMTCB;
static  uint64_t    AppTaskSEMStk[APP_CFG_TASK_SEM_STK_SIZE/8];
static void AppTaskSEM(ULONG thread_input);

tx_thread_create(&AppT

版权声明:本文为CSDN博主「Believeziwo」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Believeziwo/article/details/122524511

生成海报
点赞 0

Believeziwo

我还没有学会写个人说明!

暂无评论

相关推荐

2022-01-16 threadx的信号量的应用

实验使用的开发板是ART-PI,stm32h750芯片+threadx。创建信号量,实现两个任务之间同步。 第一步:首先通过stm32cubeMX移植了threadx(参考上一篇文章)。 第二步:创建信号量。在 int tx_applic

STM32使用各种传感器的demo

各种传感器的demo 最近有假期有空整理了一些传感器的使用方式 激光测距 激光测距是我在完成电磁炮项目用的模块,大家也可以去借鉴我以前的文章,使用起来也是方便,当时涂方便,利用的是串口