Function esp_idf_sys::i2c_master_write_read_device
source · pub unsafe extern "C" fn i2c_master_write_read_device(
i2c_num: i2c_port_t,
device_address: u8,
write_buffer: *const u8,
write_size: usize,
read_buffer: *mut u8,
read_size: usize,
ticks_to_wait: TickType_t,
) -> esp_err_t
Expand description
@brief Perform a write followed by a read to a device on the I2C bus.
A repeated start signal is used between the write
and read
, thus, the bus is
not released until the two transactions are finished.
This function is a wrapper to i2c_master_start()
, i2c_master_write()
, i2c_master_read()
, etc…
It shall only be called in I2C master mode.
@param i2c_num I2C port number to perform the transfer on @param device_address I2C device’s 7-bit address @param write_buffer Bytes to send on the bus @param write_size Size, in bytes, of the write buffer @param read_buffer Buffer to store the bytes received on the bus @param read_size Size, in bytes, of the read buffer @param ticks_to_wait Maximum ticks to wait before issuing a timeout.
@return - ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error - ESP_FAIL Sending command error, slave hasn’t ACK the transfer. - ESP_ERR_INVALID_STATE I2C driver not installed or not in master mode. - ESP_ERR_TIMEOUT Operation timeout because the bus is busy.