From adc6e726f672aa7057992af54b286f7632b4fb07 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 9 May 2024 15:38:25 +0200 Subject: stop the c++ --- main/main.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 main/main.c (limited to 'main/main.c') diff --git a/main/main.c b/main/main.c new file mode 100644 index 0000000..c97a808 --- /dev/null +++ b/main/main.c @@ -0,0 +1,42 @@ +#include +#include + +#include +#include + +#include "config.h" +#include "init.h" + +// #include +// #include +// #include + +void blink_task() { + await_init(); // `blink_task` uses GPIO + + while (true) { + cyw43_arch_gpio_put(LED_PIN, 0); + vTaskDelay(250 / portTICK_PERIOD_MS); + cyw43_arch_gpio_put(LED_PIN, 1); + vTaskDelay(250 / portTICK_PERIOD_MS); + } +} + +void test_task() { + int i = 0; + while (true) { + // stdio is initialized synchronously, so no `await_init` is needed + printf("hello #%d...\n", ++i); + vTaskDelay(1000 / portTICK_PERIOD_MS); + } +} + +int main() { + init(); + + xTaskCreate((TaskFunction_t) blink_task, "blink", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL); + xTaskCreate((TaskFunction_t) test_task, "test", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL); + + vTaskStartScheduler(); +} + -- cgit v1.2.3