aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-03-31 17:01:58 +0200
committerlonkaars <loek@pipeframe.xyz>2024-03-31 17:01:58 +0200
commit4b405fe0f6dbf6c6e377c1b04f20be27d7b7a761 (patch)
tree01cabcbfc7889aac43f44709771f4b5ff8fbc235
parent41932400f68b7af671ee18df958c078e0c8d06e1 (diff)
add led blink + compile_commands.json for CoC autocomplete
-rw-r--r--main/.gitignore1
-rw-r--r--main/CMakeLists.txt1
l---------main/compile_commands.json1
-rw-r--r--main/config.def.h3
-rw-r--r--main/main.cpp13
5 files changed, 18 insertions, 1 deletions
diff --git a/main/.gitignore b/main/.gitignore
index dd1a9a8..7c3ba25 100644
--- a/main/.gitignore
+++ b/main/.gitignore
@@ -1,2 +1,3 @@
config.h
build
+.cache
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 11b12c5..59d1156 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -6,6 +6,7 @@ project(puzzlebox_main C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(PICO_BOARD pico_w)
pico_sdk_init()
diff --git a/main/compile_commands.json b/main/compile_commands.json
new file mode 120000
index 0000000..25eb4b2
--- /dev/null
+++ b/main/compile_commands.json
@@ -0,0 +1 @@
+build/compile_commands.json \ No newline at end of file
diff --git a/main/config.def.h b/main/config.def.h
index a02915f..48de559 100644
--- a/main/config.def.h
+++ b/main/config.def.h
@@ -3,3 +3,6 @@
#define CONF_NET_SSID "network name"
#define CONF_NET_PASS "network password"
+#include "cyw43_country.h"
+#define CONF_NET_COUNTRY CYW43_COUNTRY_NETHERLANDS
+
diff --git a/main/main.cpp b/main/main.cpp
index e3e3b92..9fd3123 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -5,13 +5,17 @@
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
+const unsigned int LED_PIN = CYW43_WL_GPIO_LED_PIN;
+
int main() {
stdio_init_all();
+ sleep_ms(2000);
- if (cyw43_arch_init_with_country(CYW43_COUNTRY_UK)) {
+ if (cyw43_arch_init_with_country(CONF_NET_COUNTRY)) {
printf("failed to initialize\n");
return 1;
}
+ cyw43_arch_gpio_put(LED_PIN, 1);
printf("initialised\n");
cyw43_arch_enable_sta_mode();
@@ -21,5 +25,12 @@ int main() {
return 1;
}
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);
+ }
}