aboutsummaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp27
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();
}