aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-09 15:38:25 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-09 15:38:25 +0200
commitadc6e726f672aa7057992af54b286f7632b4fb07 (patch)
tree9a24f2c67566aa80c6379b160cbceeadedc2966d /main
parent21bfc93676c56e2265f330170d319da2c480987d (diff)
stop the c++
Diffstat (limited to 'main')
-rw-r--r--main/CMakeLists.txt4
-rw-r--r--main/init.c (renamed from main/init.cpp)22
-rw-r--r--main/main.c (renamed from main/main.cpp)0
3 files changed, 14 insertions, 12 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index b86c077..123d1b7 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -13,8 +13,8 @@ project(puzzlebox_main C CXX ASM)
pico_sdk_init()
add_executable(main
- main.cpp
- init.cpp
+ main.c
+ init.c
)
pico_enable_stdio_usb(main 1)
diff --git a/main/init.cpp b/main/init.c
index 48f3774..616cfea 100644
--- a/main/init.cpp
+++ b/main/init.c
@@ -29,6 +29,17 @@ static void init_wifi() {
// TODO: announce hostname(?)
}
+static void async_init() {
+ init_cyw34();
+ init_wifi();
+ // TODO: initialize i2c
+
+ xEventGroupSetBits(init_complete, 1);
+
+ // delete self
+ vTaskDelete(NULL);
+}
+
void init() {
init_complete = xEventGroupCreate();
@@ -36,16 +47,7 @@ void init() {
init_stdio();
// defer other initialization until the task scheduler is running (important)
- xTaskCreate((TaskFunction_t) [](void*) {
- init_cyw34();
- init_wifi();
- // TODO: initialize i2c
-
- xEventGroupSetBits(init_complete, 1);
-
- // delete self
- vTaskDelete(NULL);
- }, "init", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 4, NULL);
+ xTaskCreate((TaskFunction_t) async_init, "init", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 4, NULL);
}
void await_init() {
diff --git a/main/main.cpp b/main/main.c
index c97a808..c97a808 100644
--- a/main/main.cpp
+++ b/main/main.c