i2c_m_async_set_slaveaddr

Set the slave device address.

int32_t i2c_m_async_set_slaveaddr(
    struct i2c_m_async_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 an already started access.

Parameters

i2c

Type: struct i2c_m_async_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 maximum a 10-bit address, and the 10th bit set if 10-bit address is used