aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-04-25 17:30:41 +0200
committerlonkaars <loek@pipeframe.xyz>2024-04-25 17:30:41 +0200
commitcee744e2bd419c0fc47f2b8bb315f183929d1113 (patch)
treeb83c36e28c9539027f6209ce3606e1dbac8e2d5d /main
parent6df58f546db68047fe38f3809ee4f6cbff4c6f89 (diff)
WIP making LwIP and FreeRTOS friends
Diffstat (limited to 'main')
-rw-r--r--main/CMakeLists.txt4
-rw-r--r--main/config.def.h2
-rw-r--r--main/lwipopts.h10
-rw-r--r--main/main.cpp17
4 files changed, 22 insertions, 11 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 7c18f56..27b3822 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -18,9 +18,11 @@ add_executable(main
)
pico_enable_stdio_usb(main 1)
-# pico_enable_stdio_uart(main 1)
+pico_enable_stdio_uart(main 0)
pico_add_extra_outputs(main)
+include_directories(lib/pico-sdk/lib/lwip/contrib/ports/freertos/include)
+
target_include_directories(main PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(main
pico_cyw43_arch_lwip_threadsafe_background
diff --git a/main/config.def.h b/main/config.def.h
index 376c58a..c6852ef 100644
--- a/main/config.def.h
+++ b/main/config.def.h
@@ -10,5 +10,7 @@
#include <cyw43_country.h>
#define CONF_NET_COUNTRY CYW43_COUNTRY_NETHERLANDS
+#define CONF_SRV_PORT 9191
+
#define LED_PIN CYW43_WL_GPIO_LED_PIN
diff --git a/main/lwipopts.h b/main/lwipopts.h
index 75a57ee..71c85b2 100644
--- a/main/lwipopts.h
+++ b/main/lwipopts.h
@@ -1,13 +1,7 @@
#pragma once
-// allow override in some examples
-#ifndef NO_SYS
-#define NO_SYS 1
-#endif
-
-#ifndef LWIP_SOCKET
-#define LWIP_SOCKET 0
-#endif
+#define NO_SYS 0
+#define LWIP_SOCKET 1
#if PICO_CYW43_ARCH_POLL
#define MEM_LIBC_MALLOC 1
diff --git a/main/main.cpp b/main/main.cpp
index d85c76e..d9d5e56 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2,10 +2,15 @@
#include <task.h>
#include <pico/stdlib.h>
+#include <pico/time.h>
#include "config.h"
#include "init.h"
+#include <lwip/sockets.h>
+#include <lwip/sys.h>
+#include <lwip/opt.h>
+
void blink_task() {
while (true) {
cyw43_arch_gpio_put(LED_PIN, 0);
@@ -18,7 +23,15 @@ void blink_task() {
int main() {
init();
- xTaskCreate((TaskFunction_t) blink_task, "blink", 128, NULL, 1, NULL);
- vTaskStartScheduler();
+ 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", 128, NULL, 1, NULL);
+ // vTaskStartScheduler();
}