@@ -43,10 +43,10 @@ class I2CDevice:
43
43
device = I2CDevice(i2c, 0x70)
44
44
bytes_read = bytearray(4)
45
45
with device:
46
- device.readfrom_into (bytes_read)
46
+ device.read_into (bytes_read)
47
47
# A second transaction
48
48
with device:
49
- device.writeto (bytes_read)
49
+ device.write (bytes_read)
50
50
"""
51
51
def __init__ (self , i2c , device_address ):
52
52
# Verify that a deivce with that address exists.
@@ -62,7 +62,7 @@ def __init__(self, i2c, device_address):
62
62
self .i2c = i2c
63
63
self .device_address = device_address
64
64
65
- def readfrom_into (self , buf , ** kwargs ):
65
+ def read_into (self , buf , ** kwargs ):
66
66
"""
67
67
Read into ``buf`` from the device. The number of bytes read will be the
68
68
length of ``buf``.
@@ -71,14 +71,13 @@ def readfrom_into(self, buf, **kwargs):
71
71
as if ``buf[start:end]``. This will not cause an allocation like
72
72
``buf[start:end]`` will so it saves memory.
73
73
74
- :param int address: 7-bit device address
75
74
:param bytearray buffer: buffer to write into
76
75
:param int start: Index to start writing at
77
76
:param int end: Index to write up to but not include
78
77
"""
79
78
self .i2c .readfrom_into (self .device_address , buf , ** kwargs )
80
79
81
- def writeto (self , buf , ** kwargs ):
80
+ def write (self , buf , ** kwargs ):
82
81
"""
83
82
Write the bytes from ``buffer`` to the device. Transmits a stop bit if
84
83
``stop`` is set.
0 commit comments