]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
If the number of retries is exceeded raise an error
authorCarson McDonald <carson@ioncannon.net>
Sun, 18 Oct 2020 13:30:37 +0000 (09:30 -0400)
committerCarson McDonald <carson@ioncannon.net>
Sun, 18 Oct 2020 14:18:22 +0000 (10:18 -0400)
src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py

index 0275e66b92d7f0da4ff57fb50b476415eced4aac..e01eb7b1e59f5222ebd4edf31eafb740688510fd 100644 (file)
@@ -285,6 +285,8 @@ class MCP2221:
                     continue
                 if resp[2] in (RESP_READ_COMPL, RESP_READ_PARTIAL):
                     break
                     continue
                 if resp[2] in (RESP_READ_COMPL, RESP_READ_PARTIAL):
                     break
+            else:
+                raise RuntimeError("I2C read error: max retries reached.")
 
             # move data into buffer
             chunk = min(end - start, 60)
 
             # move data into buffer
             chunk = min(end - start, 60)