From c4c479ec61bfbdae427e96cd9c421d8607ac5d40 Mon Sep 17 00:00:00 2001 From: ladyada Date: Sat, 18 Aug 2018 00:22:50 -0400 Subject: [PATCH] update to use write_then_readinto for repeated start, tested on m4 & raspi --- adafruit_mma8451.py | 5 ++--- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/adafruit_mma8451.py b/adafruit_mma8451.py index d483df8..a5c5256 100644 --- a/adafruit_mma8451.py +++ b/adafruit_mma8451.py @@ -126,9 +126,8 @@ def _read_into(self, address, buf, count=None): if count is None: count = len(buf) with self._device as i2c: - buf[0] = address & 0xFF - i2c.write(buf, end=1, stop=False) - i2c.readinto(buf, end=count) + i2c.write_then_readinto(bytes([address & 0xFF]), buf, + in_end=count, stop=False) def _read_u8(self, address): # Read an 8-bit unsigned value from the specified 8-bit address. diff --git a/requirements.txt b/requirements.txt index 3031961..192f4ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ Adafruit-Blinka -adafruit-circuitpython-busdevice +adafruit-circuitpython-busdevice>=2.2.5