Вы здесь

DlnSpiSlaveLoadReply() Function

The DlnSpiSlaveLoadReply() function loads data (loads a number of bytes to reply buffer) to be transmitted to an SPI-master device. This function clears the buffer and makes the current reply the first in the queue.

Syntax
C/C++
DLN_RESULT DlnSpiSlaveLoadReply(
   HDLN handle,
   uint8_t port,
   uint16_t size,
   uint8_t* buffer
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI slave port.

size

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

buffer

A pointer to an array of unsigned 8-bit integers (max 256-elements array). The buffer must contain the data to send to the SPI bus master.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully loaded data to reply buffer.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

DLN_RES_INVALID_BUFFER_SIZE (0xAE)

The buffer size is not valid. The DLN-series adapters support up to 256 bytes of the buffer.

DLN_RES_BUSY (0xB6)

The SPI slave is busy transmitting. Data cannot be loaded to the buffer.

Remarks

The DlnSpiSlaveLoadReply() function removes all replies from the queue and makes the current reply the first in the queue. In contrast, the DlnSpiSlaveEnqueueReply() function adds the reply to the queue.

The type of reply is configurable: it can be based on the SS line or based on the byte count. For details, read Reply Modes. To configure the reply mode, use the DlnSpiSlaveSetReplyMode() function.

The DlnSpiSlaveLoadReply() function is defined in the dln_spi_slave.h file.

Языки

Вход на сайт