Skip to content

Commit 0021da2

Browse files
committed
Remove to and from from read and write methods because address isn't an argument.
Fixes #4.
1 parent 1a4cc71 commit 0021da2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

adafruit_bus_device/i2c_device.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class I2CDevice:
4343
device = I2CDevice(i2c, 0x70)
4444
bytes_read = bytearray(4)
4545
with device:
46-
device.readfrom_into(bytes_read)
46+
device.read_into(bytes_read)
4747
# A second transaction
4848
with device:
49-
device.writeto(bytes_read)
49+
device.write(bytes_read)
5050
"""
5151
def __init__(self, i2c, device_address):
5252
# Verify that a deivce with that address exists.
@@ -62,7 +62,7 @@ def __init__(self, i2c, device_address):
6262
self.i2c = i2c
6363
self.device_address = device_address
6464

65-
def readfrom_into(self, buf, **kwargs):
65+
def read_into(self, buf, **kwargs):
6666
"""
6767
Read into ``buf`` from the device. The number of bytes read will be the
6868
length of ``buf``.
@@ -71,14 +71,13 @@ def readfrom_into(self, buf, **kwargs):
7171
as if ``buf[start:end]``. This will not cause an allocation like
7272
``buf[start:end]`` will so it saves memory.
7373
74-
:param int address: 7-bit device address
7574
:param bytearray buffer: buffer to write into
7675
:param int start: Index to start writing at
7776
:param int end: Index to write up to but not include
7877
"""
7978
self.i2c.readfrom_into(self.device_address, buf, **kwargs)
8079

81-
def writeto(self, buf, **kwargs):
80+
def write(self, buf, **kwargs):
8281
"""
8382
Write the bytes from ``buffer`` to the device. Transmits a stop bit if
8483
``stop`` is set.

0 commit comments

Comments
 (0)