CMSIS-RTOS RTX API创建一个线程的多个运行实例

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kiti1013/article/details/46446471

代码如下

led底层驱动参考安富莱的吧 我用的原子的开发板 但是底层驱动自己修改了

#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "led.h"
#include "cmsis_os.h"

void Led_Switch(void const*arg)
{
    for(;;)
    {
    Led_on((uint32_t)arg);
    osDelay(500);
    Led_off((uint32_t)arg);
    osDelay(200);
    }
}



osThreadDef(Led_Switch,osPriorityNormal,2,0);


int main(void)
{
    osKernelInitialize();
    LED_Init();
    osThreadCreate(osThread(Led_Switch),(void*)1UL);
    osThreadCreate(osThread(Led_Switch),(void*)0UL);
    osKernelStart();

}




猜你喜欢

转载自blog.csdn.net/kiti1013/article/details/46446471