From 3e7765dd54706eb927b653d1ed8fa03a1f288c88 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 24 Jun 2024 09:45:15 +0200 Subject: ignore some addresses in bus scan --- main/i2c.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main/i2c.c b/main/i2c.c index 87c8161..2237b4d 100644 --- a/main/i2c.c +++ b/main/i2c.c @@ -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); } -- cgit v1.2.3