Вы здесь

DlnSpiMasterReadWrite16() Function

The DlnSpiMasterReadWrite16() function sends and receives 2-byte frames via SPI bus.

Syntax
C/C++
DLN_RESULT DlnSpiMasterReadWrite16(
   HDLN handle,
   uint8_t port,
   uint16_t count,
   uint16_t* writeBuffer,
   uint16_t* readBuffer
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the selected SPI master port.

count

The number of 2-byte array elements.

writeBuffer

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

readBuffer

A pointer to an array unsigned 16-bit integer that receives data from the slave during the function execution.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully transmitted data.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

DLN_RES_DISABLED (0xB7)

The SPI master port is disabled. Use the DlnSpiMasterEnable() function to activate the SPI master port.

Remarks

The DlnSpiMasterReadWrite16() function transmits data frames of 9 to 16 bits. To specify the size of data frames, use the DlnSpiMasterSetFrameSize() function. In DLN adapters, the frame data is transmitted in a Little Endian format. If the frame size is not a multiple of 8, the most-significant bits are discarded. For details, read SPI Data Frames.

The DlnSpiMasterReadWrite16() function is defined in the dln_spi_master.h file.

Языки

Вход на сайт