From b7889ed69430e42a42b1c3d58a6745f700755370 Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Fri, 6 Dec 2019 21:20:19 -0500 Subject: [PATCH] fix i2c scan --- src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py index bd44474..aae81e5 100644 --- a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py +++ b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py @@ -279,12 +279,12 @@ class MCP2221: found = [] for addr in range(start, end+1): # try a write - self.i2c_writeto(addr, b'\x00') + try: + self.i2c_writeto(addr, b'\x00') + except RuntimeError: # no reply! + continue # store if success - if self._i2c_status() == 0x00: - found.append(addr) - # cancel and continue - self._i2c_cancel() + found.append(addr) return found #---------------------------------------------------------------- -- 2.49.0