riot_sys

Function i2c_read_byte

Source
pub unsafe extern "C" fn i2c_read_byte(
    dev: i2c_t,
    addr: u16,
    data: *mut c_void,
    flags: u8,
) -> c_int
Expand description

@brief Convenience function for reading one byte from a device

@note This function is using a repeated start sequence for reading from the specified register address.

@pre i2c_acquire must be called before accessing the bus

@param[in] dev I2C peripheral device @param[in] addr 7-bit or 10-bit device address (right-aligned) @param[out] data memory location to store received data @param[in] flags optional flags (see @ref i2c_flags_t)

@return 0 When success @return -EIO When slave device doesn’t ACK the byte @return -ENXIO When no devices respond on the address sent on the bus @return -ETIMEDOUT When timeout occurs before device’s response @return -EINVAL When an invalid argument is given @return -EOPNOTSUPP When MCU driver doesn’t support the flag operation @return -EAGAIN When a lost bus arbitration occurs