This command creates a new IIC bus Python object linked to given GPIO pins and with specified address.
The first two input parameters SDA_pin and SCL_pin are Python bytes, which are the GPIO pin numbers the SDA (Serial DAta) and SCL (Serial CLock) lines are mapped to.
The third input parameter ADDR is a Python integer and represents the address of IIC bus device. It is the address value of the IIC bus device without the less significant bit required by IIC bus protocol for R/W (read/write) command. It can be a 7 bit address or a 10 bit address. It can be zero.
The return value is the IIC bus Python object which shall then be used to interface to the IIC bus device.
|
|
Note: All GPIO pins are available pins for the IIC bus. |
It is Python script developer responsibility to avoid conflicts between GPIO pins, no automatic check of GPIO pins already used for other purposes (GPIO module, IIC module, SPI module) is available.
|
|
Note: Python core implementation takes the third input parameter ADDR, shifts it left by one bit and sets R/W (read/write) bit on the less significant bit of the less significant byte. |
Example:
IICbus = IIC.new(3, 4, 0x50)
creates a new IIC bus object using GPIO 3 for SDA, GPIO 4 for SCL and with address 0x50.