i2cReset()
i2cRead(addr, num_bytes)
i2cWrite(addr, [data])
i2cWriteRead(addr, [data], num_bytes)
These helper functions implement th high-level interface to the external I2C bus available through the SDA
(GPIO27)
) and SCL
(GPIO32)
).
The i2cReset
resets the I2C bus by sending a STOP signal.
The i2cRead
reads up to num_bytes
bytes from the device with the given address. Returns an array with the read bytes.
The i2cWrite
writes the given byte array to the device with the given address.
The i2cWriteRead
first writes the given byte array to the device, then re-starts the communication in read mode and reads up to num_bytes
from the device. Returns an array with the read bytes.