Compare commits
2 commits
master
...
remove-sto
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e7f5649f9 | |||
| 4ba38a58ea |
1 changed files with 7 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ class I2CDevice:
|
||||||
end = len(buf)
|
end = len(buf)
|
||||||
self.i2c.readfrom_into(self.device_address, buf, start=start, end=end)
|
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
|
Write the bytes from ``buffer`` to the device. Transmits a stop bit if
|
||||||
``stop`` is set.
|
``stop`` is set.
|
||||||
|
|
@ -97,11 +97,15 @@ class I2CDevice:
|
||||||
:param bytearray buffer: buffer containing the bytes to write
|
:param bytearray buffer: buffer containing the bytes to write
|
||||||
:param int start: Index to start writing from
|
: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 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:
|
if end is None:
|
||||||
end = len(buf)
|
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
|
# pylint: disable-msg=too-many-arguments
|
||||||
def write_then_readinto(
|
def write_then_readinto(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue