Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Remove stop kwarg and use write_then_readinto.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Aug 21, 2019
1 parent 63ef37e commit 976c75f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions adafruit_lsm303.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ def mag_rate(self, value):
def _read_u8(self, device, address):
with device as i2c:
self._BUFFER[0] = address & 0xFF
i2c.write(self._BUFFER, end=1, stop=False)
i2c.readinto(self._BUFFER, end=1)
i2c.write_then_readinto(self._BUFFER, self._BUFFER,
out_end=1, in_end=1)
return self._BUFFER[0]

def _write_u8(self, device, address, val):
Expand All @@ -254,5 +254,4 @@ def _write_u8(self, device, address, val):
def _read_bytes(device, address, count, buf):
with device as i2c:
buf[0] = address & 0xFF
i2c.write(buf, end=1, stop=False)
i2c.readinto(buf, end=count)
i2c.write_then_readinto(buf, buf, out_end=1, in_end=count)

0 comments on commit 976c75f

Please sign in to comment.