i2c_init, passing in an i2c_config_t struct. This struct defines the SCL/SDA pins, the I2C device address, and the connect/read/write/disconnect callbacks.
i2c_init
config argument defines the pins, address, and callbacks for the I2C device. It contains the following fields:
uint32_t
Listen for requests matching the given I2C address (7-bit). To listen for all requests, set to
0pin_t
The SDA pin
pin_t
The SCL pin
callback
Called when the chip is addressed on the I2C bus
callback
Called when the microcontroller wants to read a byte of data from your chip
callback
Called when the microcontroller writes a byte to your chip
callback
Called when the microcontroller disconnects from your chip
void *
Data that will be passed in the first argument of the callbacks
connect, read, write, disconnect) are optional. They all use the user_data pointer as their first argument.