]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge pull request #356 from carsonmcdonald/expose_mcp2221_retry_failure 5.5.4
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Mon, 19 Oct 2020 14:25:43 +0000 (08:25 -0600)
committerGitHub <noreply@github.com>
Mon, 19 Oct 2020 14:25:43 +0000 (08:25 -0600)
If the number of retries is exceeded raise an error

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
+            else:
+                raise RuntimeError("I2C read error: max retries reached.")
 
             # move data into buffer
             chunk = min(end - start, 60)