aboutsummaryrefslogtreecommitdiff
path: root/main/i2c.c
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-18 18:34:08 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-18 18:34:08 +0200
commit752dca0a41581282498ccb0d3e2aedb15181e4a8 (patch)
tree8dd27b7e6cff31b05fbc4c8ea0a9d5cec15f2b87 /main/i2c.c
parent35129b2ba8e416f99f4095d93ae748762b0e36fb (diff)
WIP main controller puzzle bus behavior + fix build system / client
Diffstat (limited to 'main/i2c.c')
-rw-r--r--main/i2c.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/i2c.c b/main/i2c.c
index ccd6b46..612075b 100644
--- a/main/i2c.c
+++ b/main/i2c.c
@@ -9,15 +9,19 @@
#include "i2c.h"
#include "pb-mod.h"
#include "pbdrv.h"
+#include "config.h"
+
+i2c_addr_t modules[CFG_PB_MOD_MAX];
+size_t modules_size = 0;
void bus_task() {
- vTaskDelay(1000 / portTICK_PERIOD_MS);
-
bus_scan();
vTaskDelete(NULL);
}
void pb_route_cmd_magic_res(pb_msg_t * msg) {
- printf("got a magic response from 0x%02x!\n", msg->sender);
+ if (modules_size == CFG_PB_MOD_MAX) return;
+ modules[modules_size++] = msg->sender;
+ printf("i2c: registered puzzle module w/ address 0x%02x\n", msg->sender);
}