i2cdriver module API docs

The pumpkin_supmcu.i2cdriver module contains an implementations of the I2CMaster for the following devices:

I2CDriverMaster.

I2CDriverMaster module API docs

class pumpkin_supmcu.i2cdriver.I2CDriverMaster(port)

Class for I2CDriver as I2CMaster

property device_name: str

Returns I2CDriver as the name.

Return type

str

property device_pullups: bool

If the I2C SDA/SCL pullups are ON or OFF.

Return type

bool

property device_speed: I2CBusSpeed

The device speed the I2C Bus is currently at.

Return type

I2CBusSpeed

get_bus_devices()

Gets the available I2C devices from the I2C bus on the I2CDriver and returns a list of device addresses

Return type

List[int]

Returns

A list of device addresses

read(addr, amount)

Starts an I2C transaction for the I2CDriver and reads amount bytes from the device at address addr on the I2C Bus. Stops the I2C Transaction after the read has finished.

Parameters
  • addr (int) – The I2C Address to read from.

  • amount (int) – The amount of bytes to read from the bus.

Return type

bytes

Returns

The bytes read from the bus.

write(addr, b)

Starts an I2C transaction for the I2CDriver and writes out all of the bytes b to the address addr. Stops the I2C Transaction once the write has finished.

Parameters
  • addr (int) – The I2C Address to write to.

  • b (bytes) – The bytes b to write to the I2C Bus.

Return type

bool