From 5e953fcb265f95b7dbb04888c64fe7cbf58b57ec Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 16:05:25 -0700 Subject: [PATCH 1/2] Remove stop kwarg and use write_then_readinto. See https://github.com/adafruit/circuitpython/issues/2082 for details. --- adafruit_ds3231.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adafruit_ds3231.py b/adafruit_ds3231.py index 15559cf..4f96a53 100644 --- a/adafruit_ds3231.py +++ b/adafruit_ds3231.py @@ -101,8 +101,7 @@ def __init__(self, i2c): buf = bytearray(2) buf[0] = 0x0e with self.i2c_device as i2c_device: - i2c_device.write(buf, end=1, stop=False) - i2c_device.readinto(buf, start=1) + i2c.write_then_readinto(buf, buf, out_end=1, in_start=1) if (buf[1] & 0b00011000) != 0b00011000: raise ValueError("Unable to find DS3231 at i2c address 0x68.") From df2037bddd5614fdb53d8220fe9fa547a5602cf9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 26 Aug 2019 17:14:26 -0700 Subject: [PATCH 2/2] Correct to i2c_device --- adafruit_ds3231.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ds3231.py b/adafruit_ds3231.py index 4f96a53..4655a2e 100644 --- a/adafruit_ds3231.py +++ b/adafruit_ds3231.py @@ -101,7 +101,7 @@ def __init__(self, i2c): buf = bytearray(2) buf[0] = 0x0e with self.i2c_device as i2c_device: - i2c.write_then_readinto(buf, buf, out_end=1, in_start=1) + i2c_device.write_then_readinto(buf, buf, out_end=1, in_start=1) if (buf[1] & 0b00011000) != 0b00011000: raise ValueError("Unable to find DS3231 at i2c address 0x68.")