I2C.init

Name
I2C.init - Initialise the hardware i2c port

Description

 * I2C.init ( u8 mode, u16 config) - (P8)
 * I2C.init ( u8 module, u8 mode, u8 config) - (P32)


 * Configures the hardware i2c peripheral for operations.


 * Supported modes are:


 * I2C_MASTER_MODE (P8 / P32)


 * Initialise as i2c master. Provide required bus speed in config.  Supported bus speed constants  are:
 * I2C_100KHZ - 100Khz
 * I2C_400KHZ - 400Khz
 * I2C_1MHZ - 1 Mhz


 * I2C_MULTI_MASTER_MODE (P32 Only)


 * Initialise as i2c multi-master. Provide required bus speed in config.  Supported bus speed constants  are the same as master mode.


 * I2C_SLAVE_MODE (P8 / P32)


 * Initialises as i2c slave. Provide either 7 or 10 bit slave address in config

Syntax
to use Pinguino as i2c master (P8): I2C.init(I2C_MASTER_MODE, bus_speed);

to use Pinguino as i2c slave (P8): I2C.init(I2C_SLAVE_MODE, device_address);

to use Pinguino as i2c master (P32): I2C.init(module, I2C_MASTER_MODE, bus_speed);

to use Pinguino as i2c slave (P32): I2C.init(module, I2C_SLAVE_MODE, device_address);

Comments
Since Beta X