aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-15 13:30:45 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-15 13:30:45 +0200
commit20f442e5f5aa6a4fcf07f65e2f446a3c0ff8e4f2 (patch)
tree99f2422681eaa34a6f21b54d86e67115c291d5ce /main
parentdbe08a8cd3d29cee7ba1adae4841c0a831784f31 (diff)
WIP freertos + Arduino workaround
Diffstat (limited to 'main')
-rw-r--r--main/i2c.c4
-rw-r--r--main/pbdrv.c8
2 files changed, 10 insertions, 2 deletions
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 <hardware/i2c.h>
#include <hardware/gpio.h>
@@ -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);
+}
+