Вы здесь

DlnI2cMasterTransfer() Function

The DlnI2cMasterTransfer() function sends and receives data via the I2C bus. The data is sent and received as an array of 1-byte elements.

Syntax
C/C++
DLN_RESULT DlnI2cMasterTransfer(
    HDLN handle, 
    uint8_t port, 
    uint8_t slaveDeviceAddress, 
    uint16_t writeLength, 
    uint16_t readLength, 
    uint8_t *writeBuffer, 
    uint8_t *readBuffer
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the I2C master port.

slaveDeviceAddress

The I2C slave device address value.

writeLength

The length of data that should be written to the slave device.

readLength

The length of data that should be read from the slave device.

writeBuffer

A pointer to an array of unsigned 8-bit integers that receives data to be sent to the slave during the function execution.

readBuffer

A pointer to an array of unsigned 8-bit integers that receives data from the slave during the function execution.

Return Value
DLN_RES_SUCCESS (0x00)

The function transmitted data via the I2C bus successfully.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

DLN_RES_DISABLED (0xB7)

The function transmit data via the I2C bus because the specified I2C master port is not active. Use the DlnI2cMasterEnable()function to activate the I2C master port.

DLN_RES_INVALID_BUFFER_SIZE (0xAE)

The specified buffer size is not valid.

Remarks
DLN-4 adapters do not support this function.

The DlnI2cMasterTransfer() function is defined in the dln_i2c_master.h file.

Языки

Вход на сайт