1 """I2C Class for Generic MicroPython"""
2 from machine import I2C as _I2C
6 """I2C Class for Generic MicroPython"""
10 # pylint: disable=unused-argument
11 def __init__(self, portId, *, mode=MASTER, baudrate=100000):
12 self._i2c = _I2C(portId, freq=baudrate)
15 """Perform an I2C Device Scan"""
16 return self._i2c.scan()
18 def writeto(self, address, buffer, *, stop=True):
19 """Write the data from the buffer to the address"""
20 return self._i2c.writeto(address, buffer)
22 def readfrom_into(self, address, buffer, *, stop=True):
23 """Read data from an address and into the buffer"""
24 return self._i2c.readfrom_into(address, buffer)
26 def writeto_then_readfrom(
38 """Write data from buffer_out to an address and then
39 read data from an address and into buffer_in
41 self._i2c.writeto_then_readfrom(
51 # pylint: enable=unused-argument