Вы здесь

DlnI2cSlaveSetAddress() Function

The DlnI2cSlaveSetAddress() function assigns I2C addresses to the specified I2C slave module. You can assign any 7-bit address, the limitation is only in quantity of addresses that can be used simultaneously. Use the DlnI2cSlaveGetAddressCount() function to retrieve the number of simultaneously supported I2C slave addresses.

Syntax
C/C++
DLN_RESULT DlnI2cSlaveSetAddress(
   HDLN handle,
   uint8_t port,
   uint8_t slaveAddressNumber,
   uint8_t address
);
Parameters
handle

A handle to the DLN-series adapter.

port

An I2C slave port to be configured.

slaveAddressNumber

A number of the I2C slave address to be assigned. Use the DlnI2cSlaveGetAddressCount()function to retrieve the number of simultaneously supported I2C slave addresses. The slaveAddressNumber is zero based.

address

An I2C slave address to be set to the specified I2C slave port.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully specified I2C slave addresses for your DLN adapter.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

The port number is not valid. Use the DlnI2cSlaveGetPortCount() function to find the maximum possible port number.

DLN_RES_BUSY (0xB6)

The function cannot specify I2C slave addresses for the DLN adapter while the I2C slave port is busy transmitting data.

DLN_RES_INVALID_ADDRESS (0xB4)

The I2C slave address is not valid.

Remarks

The DlnI2cSlaveSetAddress() function is defined in the dln_i2c_slave.h file.

Языки

Вход на сайт