Function esp_idf_svc::sys::i2c_slave_transmit

source ·
pub unsafe extern "C" fn i2c_slave_transmit(
    i2c_slave: *mut i2c_slave_dev_t,
    data: *const u8,
    size: i32,
    xfer_timeout_ms: i32,
) -> i32
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