i2c_master_read_from_device() function
Perform a read to a device connected to a particular I2C port. 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.
Arguments
i2c_num
I2C port number to perform the transfer on
device_address
I2C device's 7-bit address
read_buffer
Buffer to store the bytes received on the bus
read_size
Size, in bytes, of the read buffer
ticks_to_wait
Maximum ticks to wait before issuing a timeout.
Return value
- 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.
i2c_master_read_from_device() calls 8 functions:
![]()
i2c_master_read_from_device()
i2c_master_read_from_device() reads 2 variables:
![]()
i2c_master_read_from_device()