diff options
author | ThomasintAnker <thomasintanker1@gmail.com> | 2024-05-31 15:06:06 +0200 |
---|---|---|
committer | ThomasintAnker <thomasintanker1@gmail.com> | 2024-05-31 15:06:06 +0200 |
commit | 0278037aaf3fd497aae57d90f2638ceda3b12a6d (patch) | |
tree | 3354a14d4551b9524108d02971bfa42fc1ad4993 /main | |
parent | b865921e5dcf2ae2d6532b88eba1a0a49998eb27 (diff) | |
parent | 18d06c79b9f6a625eb218a15c8216556fb99dc02 (diff) |
Merge branch 'wip/client' into wip/i2c-communication
Diffstat (limited to 'main')
-rw-r--r-- | main/CMakeLists.txt | 4 | ||||
-rw-r--r-- | main/sock.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 30685a4..6390d7c 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -7,7 +7,7 @@ set(PICO_BOARD pico_w) include(lib/pico-sdk/pico_sdk_init.cmake) include(lib/FreeRTOS-Kernel/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake) -include(../proto/include.cmake) +include(../i2ctcp/include.cmake) project(puzzlebox_main C CXX ASM) @@ -33,7 +33,7 @@ target_link_libraries(main hardware_i2c FreeRTOS-Kernel FreeRTOS-Kernel-Heap4 - puzbus + i2ctcp mpack ) diff --git a/main/sock.c b/main/sock.c index 434694f..33da03c 100644 --- a/main/sock.c +++ b/main/sock.c @@ -10,18 +10,18 @@ #include "init.h" #include "config.h" -#include "puzbusv1.h" +#include "i2ctcpv1.h" #include "sock.h" extern QueueHandle_t queue; struct netconn* current_connection = NULL; -struct pb_msg recv_msg; +i2ctcp_msg_t recv_msg; void i2c_send(uint16_t addr, const char * data, size_t data_size) { if (current_connection == NULL) return; - struct pb_msg send_msg = { + i2ctcp_msg_t send_msg = { .addr = addr, .data = (char *) data, .length = data_size, @@ -30,7 +30,7 @@ void i2c_send(uint16_t addr, const char * data, size_t data_size) { char * buf; size_t buf_sz; - if (!pb_write(&send_msg, &buf, &buf_sz)) return; + if (!i2ctcp_write(&send_msg, &buf, &buf_sz)) return; // NOTE: netconn does return an error code, but the data needs to be freed // whether netconn throws an error or not, so it remains unused @@ -62,7 +62,7 @@ void i2c_recv(uint16_t addr, const char * data, size_t data_size) { } void recv_handler(struct netconn* conn, struct netbuf* buf) { - pb_read_reset(&recv_msg); + i2ctcp_read_reset(&recv_msg); do { char* data; @@ -71,7 +71,7 @@ void recv_handler(struct netconn* conn, struct netbuf* buf) { // continue early if more data is needed to complete message printf("yeetus deletus defeatus"); - if (!pb_read(&recv_msg, data, len)) continue; + if (!i2ctcp_read(&recv_msg, data, len)) continue; printf("yeetus deletus defeatus v2!"); // forward received message to puzzle bus |