From 20f442e5f5aa6a4fcf07f65e2f446a3c0ff8e4f2 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 15 Jun 2024 13:30:45 +0200 Subject: WIP freertos + Arduino workaround --- main/i2c.c | 4 ++++ main/pbdrv.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/i2c.c b/main/i2c.c index cb42ca4..ccd6b46 100644 --- a/main/i2c.c +++ b/main/i2c.c @@ -17,3 +17,7 @@ void bus_task() { vTaskDelete(NULL); } +void pb_route_cmd_magic_res(pb_msg_t * msg) { + printf("got a magic response from 0x%02x!\n", msg->sender); +} + diff --git a/main/pbdrv.c b/main/pbdrv.c index d809b86..0624897 100644 --- a/main/pbdrv.c +++ b/main/pbdrv.c @@ -3,7 +3,7 @@ #include "pb.h" #include "pb-types.h" #include "pb-mod.h" -#include "pb-msg.h" +#include "pb-send.h" #include #include @@ -76,7 +76,7 @@ __weak void pb_i2c_send(i2c_addr_t addr, const uint8_t * buf, size_t sz) { void bus_scan() { i2c_set_slave_mode(PB_I2C, false, PB_MOD_ADDR); - pb_buf_t buf = pb_msg_write_req_magic(); + pb_buf_t buf = pb_send_magic_req(); // check for all 7-bit addresses uint16_t addr_max = 1 << 7; @@ -89,3 +89,7 @@ void bus_scan() { i2c_set_slave_mode(PB_I2C, true, PB_MOD_ADDR); } +void pb_mod_blocking_delay_ms(unsigned long ms) { + vTaskDelay(ms / portTICK_PERIOD_MS); +} + -- cgit v1.2.3