diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-04-25 14:28:45 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-04-25 14:28:45 +0200 |
commit | 0ef1ae11846bfcbbd63e22d1dfecf579f4069c80 (patch) | |
tree | a89b805533db8438159e6e0bcf470ceb4310d227 /main/main.cpp | |
parent | 04111f06c66f6f935651903e85bda36d6f05d349 (diff) |
WIP FreeRTOS
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/main/main.cpp b/main/main.cpp index 9fd3123..d118de2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1,12 +1,23 @@ -#include <stdio.h> - #include "config.h" -#include "pico/stdlib.h" -#include "pico/cyw43_arch.h" +#include <FreeRTOS.h> +#include <task.h> + +#include <pico/stdlib.h> +#include <pico/stdio.h> +#include <pico/cyw43_arch.h> const unsigned int LED_PIN = CYW43_WL_GPIO_LED_PIN; +void blink_task() { + while (true) { + cyw43_arch_gpio_put(LED_PIN, 0); + sleep_ms(250); + cyw43_arch_gpio_put(LED_PIN, 1); + sleep_ms(250); + } +} + int main() { stdio_init_all(); sleep_ms(2000); @@ -16,6 +27,8 @@ int main() { return 1; } cyw43_arch_gpio_put(LED_PIN, 1); + + printf("initialised\n"); cyw43_arch_enable_sta_mode(); @@ -26,11 +39,7 @@ int main() { } printf("connected\n"); - while (true) { - cyw43_arch_gpio_put(LED_PIN, 0); - sleep_ms(250); - cyw43_arch_gpio_put(LED_PIN, 1); - sleep_ms(250); - } + xTaskCreate((TaskFunction_t) blink_task, "blink", 128, NULL, 1, NULL); + vTaskStartScheduler(); } |