Skip to content

i2c_device: adjust for removal of stop=, compatibly #54

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

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 7 additions & 3 deletions adafruit_bus_device/i2c_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def readinto(self, buf, *, start=0, end=None):
end = len(buf)
self.i2c.readfrom_into(self.device_address, buf, start=start, end=end)

def write(self, buf, *, start=0, end=None, stop=True):
def write(self, buf, *, start=0, end=None, stop=None):
"""
Write the bytes from ``buffer`` to the device. Transmits a stop bit if
``stop`` is set.
Expand All @@ -97,11 +97,15 @@ def write(self, buf, *, start=0, end=None, stop=True):
:param bytearray buffer: buffer containing the bytes to write
:param int start: Index to start writing from
:param int end: Index to read up to but not include; if None, use ``len(buf)``
:param bool stop: If true, output an I2C stop condition after the buffer is written
"""
if stop is not None:
print(
"Warning: deprecated stop= argument specified.\n"
"Will be removed in a future release and act as stop=True"
)
if end is None:
end = len(buf)
self.i2c.writeto(self.device_address, buf, start=start, end=end, stop=stop)
self.i2c.writeto(self.device_address, buf, start=start, end=end)

# pylint: disable-msg=too-many-arguments
def write_then_readinto(
Expand Down