Skip to content

Commit

Permalink
Merge pull request #16 from tannewt/remove_stop
Browse files Browse the repository at this point in the history
Remove stop kwarg and use write_then_readinto.
  • Loading branch information
kattni authored Aug 27, 2019
2 parents 50b3978 + d14fc34 commit ecb4b4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions adafruit_mcp230xx/mcp230xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def _read_u16le(self, register):
# register.
with self._device as i2c:
_BUFFER[0] = register & 0xFF
i2c.write(_BUFFER, end=1, stop=False)
i2c.readinto(_BUFFER, end=2)
return (_BUFFER[1] << 8) | _BUFFER[0]

i2c.write_then_readinto(_BUFFER, _BUFFER, out_end=1, in_start=1, in_end=3)
return (_BUFFER[2] << 8) | _BUFFER[1]

def _write_u16le(self, register, val):
# Write an unsigned 16 bit little endian value to the specified 8-bit
Expand All @@ -69,9 +69,9 @@ def _read_u8(self, register):
# Read an unsigned 8 bit value from the specified 8-bit register.
with self._device as i2c:
_BUFFER[0] = register & 0xFF
i2c.write(_BUFFER, end=1, stop=False)
i2c.readinto(_BUFFER, end=1)
return _BUFFER[0]

i2c.write_then_readinto(_BUFFER, _BUFFER, out_end=1, in_start=1, in_end=2)
return _BUFFER[1]

def _write_u8(self, register, val):
# Write an 8 bit value to the specified 8-bit register.
Expand Down

0 comments on commit ecb4b4f

Please sign in to comment.