i2c_m_os_set_slaveaddr

Set the slave device address.

int32_t i2c_m_os_set_slaveaddr(
    struct i2c_m_os_desc *const i2c,
    int16_t addr,
    int32_t addr_len
)

This function sets the next transfer target slave I2C device address. It takes no effect to any already started access.

Parameters

i2c

Type: struct i2c_m_os_desc Struct *const

An I2C master descriptor, which is used to communicate through I2C

addr

Type: int16_t

The slave address to access

addr_len

Type: int32_t

The slave address length, can be I2C_M_TEN or I2C_M_SEVEN

Returns

Type: int32_t

Masked slave address, the mask is a maximum 10-bit address, and the 10th bit is set if a 10-bit address is used