diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-09 15:18:51 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-09 15:18:51 +0200 |
commit | 21bfc93676c56e2265f330170d319da2c480987d (patch) | |
tree | 78caa1526cf0c570118d893e52df3301eb9e02a8 /main/main.cpp | |
parent | efc9870fb1ddd286954fc056b79dddf39f68353a (diff) |
working FreeRTOS + lwIP blink/wifi connect example again
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/main/main.cpp b/main/main.cpp index ace9f01..c97a808 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -7,11 +7,13 @@ #include "config.h" #include "init.h" -#include <lwip/sockets.h> -#include <lwip/sys.h> -#include <lwip/opt.h> +// #include <lwip/sockets.h> +// #include <lwip/sys.h> +// #include <lwip/opt.h> void blink_task() { + await_init(); // `blink_task` uses GPIO + while (true) { cyw43_arch_gpio_put(LED_PIN, 0); vTaskDelay(250 / portTICK_PERIOD_MS); @@ -20,18 +22,21 @@ void blink_task() { } } +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(); - for (int i = 5; i > 0; i--) { - printf("starting in %d...\n", i); - sleep_ms(1000); - } - - // this should compile but not work - lwip_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + 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); - xTaskCreate((TaskFunction_t) blink_task, "blink", 128, NULL, 1, NULL); vTaskStartScheduler(); } |