You are here

DlnI2cMasterWrite() Function

The DlnI2cMasterWrite() function sends data to the specified I2C slave device.

Syntax
C/C++
DLN_RESULT DlnI2cMasterWrite(
   HDLN handle,
   uint8_t port,
   uint8_t slaveDeviceAddress,
   uint8_t memoryAddressLength,
   uint32_t memoryAddress,
   uint16_t bufferLength,
   uint8_t* buffer
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the I2C master port to be used.

slaveDeviceAddress

A 7-bit number, uniquely assigned to each I2C slave device. See I2C address section for additional information.

memoryAddressLength

An internal address length. If set to zero, no internal address is sent.

memoryAddress

An internal I2C slave device address. For details, read Using Internal Addresses.

bufferLength

The size of the message buffer in bytes. This value must fall within a range from 1 to 256.

buffer

A pointer to an array of unsigned 8-bit integers that receives information to be sent to a slave during the function execution. The buffer size must not exceed 256 bytes.

Return Value
DLN_RES_SUCCESS (0x00)

The function executed the I2C write operation 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 cannot execute the I2C write operation because the specified I2C master port is not active. Use the DlnI2cMasterEnable()function to activate the I2C master port.

Remarks

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

User login