Function esp_idf_sys::i2c_slave_transmit
source · pub unsafe extern "C" fn i2c_slave_transmit(
i2c_slave: i2c_slave_dev_handle_t,
data: *const u8,
size: c_int,
xfer_timeout_ms: c_int,
) -> esp_err_t
Expand description
@brief Write bytes to internal ringbuffer of the I2C slave data. When the TX fifo empty, the ISR will fill the hardware FIFO with the internal ringbuffer’s data.
@note If you connect this slave device to some master device, the data transaction direction is from slave device to master device.
@param[in] i2c_slave I2C slave device handle that created by i2c_new_slave_device
.
@param[in] data Buffer to write to slave fifo, can pickup by master. Can be freed after this function returns. Equal or larger than size
.
@param[in] size In bytes, of data
buffer.
@param[in] xfer_timeout_ms Wait timeout, in ms. Note: -1 means wait forever.
@return
- ESP_OK: I2C slave transmit success.
- ESP_ERR_INVALID_ARG: I2C slave transmit parameter invalid.
- ESP_ERR_TIMEOUT: Operation timeout(larger than xfer_timeout_ms) because the device is busy or hardware crash.
- ESP_ERR_NOT_SUPPORTED: This function should be work in fifo mode, but I2C_SLAVE_NONFIFO mode is configured