Skip to content

Commit a0e5d1a

Browse files
committed
update reset
i was able to reproduce #3. also saw the same behavior that it **_did_** work with other boards (esp32-s3 tft feather and rp2040 feather). i think that the reset() function was raising the error because the DAC was resetting before the command was being acknowledged over I2C (this is noted in the [arduino driver](https://github.com/adafruit/Adafruit_AD569x/blob/6e725d0efbe4010b3971d011c6df82f64d6b0541/Adafruit_AD569x.cpp#L189)). i updated the function to not raise
1 parent d9e17c3 commit a0e5d1a

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)