Вы здесь

DlnSpiMasterReadWriteEx() Function

The DlnSpiMasterReadWriteEx() function sends and receives data via SPI bus. The data is transmitted as an array of 1-byte elements. In this function you can use additional attributes to configure the SS line state after data transmission.

Syntax
C/C++
DLN_RESULT DlnSpiMasterReadWriteEx(
  HDLN handle, 
  uint8_t port, 
  uint16_t size, 
  uint8_t *writeBuffer, 
  uint8_t *readBuffer, 
  uint8_t attribute
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

size

The size of the message buffer. This parameter is specified in bytes. The maximum value is 256 bytes.

writeBuffer

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

readBuffer

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

attribute

Additional transmission attribute:

  • DLN_SPI_MASTER_ATTR_LEAVE_SS_LOW - Leave SS low after transmission.

  • DLN_SPI_MASTER_ATTR_RELEASE_SS - Release SS after transmission.

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 DlnSpiMasterReadWriteEx() function is defined in the dln_spi_master.h file.

Языки

Вход на сайт