diff --git a/adafruit_bus_device/i2c_device.py b/adafruit_bus_device/i2c_device.py index 657c2d7..50ee065 100644 --- a/adafruit_bus_device/i2c_device.py +++ b/adafruit_bus_device/i2c_device.py @@ -43,7 +43,7 @@ class I2CDevice: device = I2CDevice(i2c, 0x70) bytes_read = bytearray(4) with device: - device.read_into(bytes_read) + device.readinto(bytes_read) # A second transaction with device: device.write(bytes_read) @@ -62,7 +62,7 @@ def __init__(self, i2c, device_address): self.i2c = i2c self.device_address = device_address - def read_into(self, buf, **kwargs): + def readinto(self, buf, **kwargs): """ Read into ``buf`` from the device. The number of bytes read will be the length of ``buf``. @@ -77,6 +77,14 @@ def read_into(self, buf, **kwargs): """ self.i2c.readfrom_into(self.device_address, buf, **kwargs) + def read_into(self, buf, **kwargs): + """ + .. warning:: This method will be deprecated at some time in the future. + Please use `readinto`() instead. `readinto`() is functionally + equivalent to read_into(), same parameters and same actions. + """ + self.i2c.readfrom_into(self.device_address, buf, **kwargs) + def write(self, buf, **kwargs): """ Write the bytes from ``buffer`` to the device. Transmits a stop bit if