i2c_slave_register_event_callbacks() function
Set I2C slave event callbacks for I2C slave channel.
Arguments
i2c_slave
I2C slave device handle that created by `i2c_new_slave_device`.
cbs
Group of callback functions
user_data
User data, which will be passed to callback functions directly
Return value
- ESP_OK: Set I2C transaction callbacks successfully - ESP_ERR_INVALID_ARG: Set I2C transaction callbacks failed because of invalid argument - ESP_FAIL: Set I2C transaction callbacks failed because of other error
Notes
User can deregister a previously registered callback by calling this function and setting the callback member in the `cbs` structure to NULL. When CONFIG_I2C_ISR_IRAM_SAFE is enabled, the callback itself and functions called by it should be placed in IRAM. The variables used in the function should be in the SRAM as well. The `user_data` should also reside in SRAM.
i2c_slave_register_event_callbacks() calls 2 functions:
![]()
i2c_slave_register_event_callbacks()
i2c_slave_register_event_callbacks() reads 9 variables and writes 3 variables:
![]()
i2c_slave_register_event_callbacks()