aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
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);
+}
+