Skip to content

Commit

Permalink
Merge pull request #21 from ladyada/master
Browse files Browse the repository at this point in the history
specifically name arguments now that we require it
  • Loading branch information
dhalbert authored Aug 19, 2018
2 parents 76bce0d + c6e7954 commit 97d4129
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion adafruit_bus_device/i2c_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,15 @@ def write_then_readinto(self, out_buffer, in_buffer, *,
:param int in_end: Index to write up to but not include
:param bool stop: If true, output an I2C stop condition after the buffer is written
"""
if out_end is None:
out_end = len(out_buffer)
if in_end is None:
in_end = len(in_buffer)
if hasattr(self.i2c, 'writeto_then_readfrom'):
# In linux, at least, this is a special kernel function call
self.i2c.writeto_then_readfrom(self.device_address, out_buffer, in_buffer,
out_start, out_end, in_start, in_end, stop)
out_start=out_start, out_end=out_end,
in_start=in_start, in_end=in_end, stop=stop)
else:
# If we don't have a special implementation, we can fake it with two calls
self.write(out_buffer, start=out_start, end=out_end, stop=stop)
Expand Down

0 comments on commit 97d4129

Please sign in to comment.