Skip to content

Commit 537f288

Browse files
authored
Merge pull request #5 from adafruit/reset_fix
update reset
2 parents d9e17c3 + a0e5d1a commit 537f288

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

adafruit_ad569x.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
3434
"""
3535

36+
import time
3637
from micropython import const
3738
from adafruit_bus_device.i2c_device import I2CDevice
3839

@@ -190,8 +191,12 @@ def reset(self):
190191
"""
191192
Soft-reset the AD569x chip.
192193
"""
193-
reset_command = 0x8000
194+
buffer = bytearray([_WRITE_CONTROL, 0x80, 0x00])
194195
try:
195-
self._send_command(_WRITE_CONTROL, reset_command)
196-
except Exception as error:
197-
raise Exception(f"Error during reset: {error}") from error
196+
with self.i2c_device as i2c:
197+
i2c.write(buffer, end=False)
198+
except OSError:
199+
pass
200+
# print(f"Reset may have triggered a NAK, continuing..")
201+
# stabilize after reset
202+
time.sleep(0.01)

0 commit comments

Comments
 (0)