CH32V307_FreeRTOS_Hello/src/main.c

40 lines
813 B
C
Raw Normal View History

2022-04-30 10:07:26 +00:00
// SPDX-License-Identifier: MIT
#include <stdio.h>
#include "debug.h"
#include "board.h"
2022-05-01 13:45:10 +00:00
#include "FreeRTOS.h"
#include "task.h"
2022-05-02 14:13:35 +00:00
const char *compile_dt = __DATE__ " " __TIME__;
2022-05-01 13:45:10 +00:00
void vTaskHello(void *pvParameters);
2022-04-30 10:07:26 +00:00
int main(void) {
/* Initialize board components. */
BOARD_SystemClock_Config();
BOARD_IOMUX_Init();
BOARD_Peripheral_Init();
/* Initialize UART for libc function calls. */
USART_Printf_Init(115200);
2022-05-02 14:13:35 +00:00
printf("FreeRTOS demo compiled AT %s\r\n", compile_dt);
2022-05-01 13:45:10 +00:00
xTaskCreate(vTaskHello, "HELLO", 256, NULL, 4, NULL);
2022-04-30 10:07:26 +00:00
2022-05-01 13:45:10 +00:00
vTaskStartScheduler();
2022-04-30 10:07:26 +00:00
2023-04-10 15:59:21 +00:00
for (;;) {
2022-05-01 13:45:10 +00:00
/* Never reaches here. */
2022-04-30 10:07:26 +00:00
}
}
2022-05-01 13:45:10 +00:00
void vTaskHello(void *pvParameters) {
2023-04-10 15:59:21 +00:00
for (;;) {
2022-05-01 13:45:10 +00:00
printf("Hello world? @%lu\r\n", xTaskGetTickCount());
vTaskDelay(pdMS_TO_TICKS(500));
}
}