diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-24 09:45:15 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-24 09:45:15 +0200 |
commit | 3e7765dd54706eb927b653d1ed8fa03a1f288c88 (patch) | |
tree | e4d30b24ba91a3740b9cfc35caa749637ae4c5ed | |
parent | 2528775b34f9c0033027931385a4de866ab2749d (diff) |
ignore some addresses in bus scan
-rw-r--r-- | main/i2c.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -12,6 +12,9 @@ #include "pb-buf.h" #include "pb-send.h" +// stolen from lib/pico-sdk/src/rp2_common/hardware_i2c/i2c.c +#define i2c_reserved_addr(addr) (((addr) & 0x78) == 0 || ((addr) & 0x78) == 0x78) + i2c_addr_t modules[CFG_PB_MOD_MAX]; size_t modules_size = 0; @@ -21,6 +24,9 @@ static void bus_scan() { // check for all 7-bit addresses uint16_t addr_max = 1 << 7; for (uint16_t addr = 0x00; addr < addr_max; addr++) { + if (i2c_reserved_addr(addr)) continue; + if (addr == PB_MOD_ADDR) continue; + pb_i2c_send(addr, (uint8_t *) buf.data, buf.size); } |