set_slave_addr function

The set_slave_addr function specifies the target slave address. The prototype for this function is:

int set_slave_addr(
      void *hdl,
      unsigned int addr,
      i2c_addrfmt_t fmt );

The arguments are:

hdl
The handle returned by the init function.
addr
The target slave address.
fmt
The format of the address; one of:
  • I2C_ADDRFMT_7BIT
  • I2C_ADDRFMT_10BIT

The function must return:

0
Success.
-1
Failure.