写一个简单的LED任务测试一下,如下图:- #include "gd32f30x.h"
- #include "led.h"
- #include "systick.h"
- #include <stdio.h>
- #include "FreeRTOS.h"
- #include "task.h"
- #define LED1_TASK_PRIO ( tskIDLE_PRIORITY + 2 )
- void LED1_task(void * pvParameters);
- int main(void)
- {
- /* 设置优先级分组为4,16个优先级全是抢占优先级 */
- nvic_priority_group_set(NVIC_PRIGROUP_PRE4_SUB0);
-
- GW_LedInit(LED1);
- GW_LedInit(LED2);
- xTaskCreate(LED1_task, "LED1", configMINIMAL_STACK_SIZE, NULL, LED1_TASK_PRIO, NULL);
- /* start scheduler */
- vTaskStartScheduler();
- while(1){
- }
- }
- void LED1_task(void * pvParameters)
- {
- for( ;; ){
- /* toggle LED2 each 500ms */
- GW_LedToggle(LED1);
- vTaskDelay(300);
- }
- }
|