Function esp_idf_svc::sys::i2c_driver_install
source ยท pub unsafe extern "C" fn i2c_driver_install(
i2c_num: u32,
mode: u32,
slv_rx_buf_len: usize,
slv_tx_buf_len: usize,
intr_alloc_flags: i32,
) -> i32
Expand description
@brief Install an I2C driver @note Not all Espressif chips can support slave mode (e.g. ESP32C2)
@param i2c_num I2C port number
@param mode I2C mode (either master or slave).
@param slv_rx_buf_len Receiving buffer size. Only slave mode will use this value, it is ignored in master mode.
@param slv_tx_buf_len Sending buffer size. Only slave mode will use this value, it is ignored in master mode.
@param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred) ESP_INTR_FLAG_* values.
See esp_intr_alloc.h for more info.
@note
In master mode, if the cache is likely to be disabled(such as write flash) and the slave is time-sensitive,
ESP_INTR_FLAG_IRAM
is suggested to be used. In this case, please use the memory allocated from internal RAM in i2c read and write function,
because we can not access the psram(if psram is enabled) in interrupt handle function when cache is disabled.
@return - ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error - ESP_FAIL Driver installation error