Skip to content

Remove stop kwarg and use write_then_readinto. #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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