IIC built-in module is available only for product versions from 12.00.xx4, from 13.00.xx5 and from 18.11.004.
IIC built-in module is an implementation on the Python core of the IIC bus Master (No Multi-Master) based on general purpose input output (GPIO) using the bit-banging technique.
IIC built-in module allows creating one or more IIC bus Python objects on the available GPIO pins. These IIC bus Python objects are each mapped on creation on two GPIO pins that will be dedicated to the Serial Data and Serial Clock pins of each IIC bus.
If you want to use IIC built-in module you need to import it:
import IIC
then you can use its methods like in the following example:
IICbus = IIC.new(3, 4, 0x50)
IICbus.init()
rec = IICbus.readwrite('\x08'+'test', 10)
creates a new IIC bus object using GPIOs 3 and 4, with address 0x50, and then sends 08 hex byte followed by 'test' and receives a string of 10 bytes assigning it to rec.
More details about IIC built-in module methods can be found in the following paragraphs.
|
|
Note: An external pull-up must be provided on SDA line since the line is working as open collector, on the other hand SCLK is driven with a complete push pull. |