Function esp_idf_svc::sys::i2c_master_register_event_callbacks
source ยท pub unsafe extern "C" fn i2c_master_register_event_callbacks(
i2c_dev: *mut i2c_master_dev_t,
cbs: *const i2c_master_event_callbacks_t,
user_data: *mut c_void,
) -> i32
Expand description
@brief Register I2C transaction callbacks for a master device
@note User can deregister a previously registered callback by calling this function and setting the callback member in the cbs
structure to NULL.
@note 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.
@note If the callback is used for helping asynchronous transaction. On the same bus, only one device can be used for performing asynchronous operation.
@param[in] i2c_dev I2C master device handle that created by i2c_master_bus_add_device
.
@param[in] cbs Group of callback functions
@param[in] user_data User data, which will be passed to callback functions directly
@return
- 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