i2c

Availability:

device

Description

The I2C class represents an I²C two-wire serial port, of which the imp provides two.

The imp’s i2c objects are instantiated at start-up, and are accessed on the imp001 and imp002 through hardware.i2c12 and hardware.i2c89. On the imp003 (Murata part number LBWA1ZV1CD), in keeping with this module’s unique pin designations, the i2c objects are accessed as hardware.i2cAB and hardware.i2cFG.

For the imp001 and imp002, pins 1 and 8 are assigned to each bus’ clock line (SCL); pins 2 and 9 are assigned to data (SDA). For the imp003, pins A and F are assigned to SCL; pins B and G to SDA.

For more information on every imp module’s pin-outs, see the imp Pin Mux.

When implementing I²C using an imp, please note that external pull-ups are required. It is not possible to enable the internal pull-ups when pins are used for I²C.

See I²C Explained for more background information regarding the I²C bus.

The i2c object has the following member methods: