The default configuration for the SPI slave port is as 8-bit SPI slave with CPOL=0 and CPHA=0 transmission parameters. By default, no events are generated.
Using the SPI slave functions allows you to change and check the current SPI slave configuration, to control data transmission.
The SPI slave functions include the following:
General port information:
Retrieves the number of SPI slave ports available in the DLN adapter.
Assigns the selected port to the SPI slave module.
Releases the selected SPI slave port.
Retrieves whether the selected port is assigned to the SPI slave module.
Configuration functions:
Specifies idle timeout for releasing the SS line.
Retrieves the idle timeout setting.
Specifies the data frame size for the selected SPI slave port.
Retrieves the current frame size for the selected SPI slave port.
Retrieves the supported frame sizes.
Specifies transmission parameters (CPOL and CPHA) for the selected SPI slave port.
Retrieves the current transmission parameters (CPOL and CPHA) for the selected SPI slave port.
Retrieves the supported transmission parameters (CPOL and CPHA).
Specifies CPHA value for the selected SPI slave port.
Retrieves the current CPHA value for the selected SPI slave port.
Retrieves the supported CPHA values.
Specifies CPOL value for the selected SPI slave port.
Retrieves the current CPOL value for the selected SPI slave port.
Retrieves the supported CPOL values.
Reply functions:
Clears the buffer and makes the current reply the first in the queue.
Puts the current reply to the end of the queue.
Specifies actions if the reply buffer size exceeds the size of the buffer received by the master.
Retrieves the current reply configuration.
Retrieves the supported reply modes.
Specifies actions if the reply buffer size is less than the size of the buffer received by the master.
Retrieves the current for reply shortage action settings.
Retrieves the supported reply shortage actions.
Event configuration:
Enables generating events when the level on the SS line rises.
Disables generating events when the level on the SS line rises.
Retrieves the current configuration for generating events when the level on the SS line rises.
Enables generating events when the buffer is full.
Disables generating events when the buffer is full.
Retrieves the current configuration for generating events when the buffer is full.
Specifies the buffer size.
Retrieves the current buffer size.
Enables generating events when the slave idles for the configured time.
Disables generating events when the slave idles for the configured time.
Retrieves the current configuration for generating events when the slave idles for the configured time.
Specifies the timeout value.
Retrieves the current timeout value.
Retrieves the minimum timeout value.
Retrieves the maximum timeout value.
The dln_spi_slave.h
file declares the SPI Salve Interface functions.
The DlnSpiSlaveGetPortCount()
function retrieves the total number of SPI slave ports available at your DLN-series adapter.
The DlnSpiSlaveEnable()
function activates the specified SPI slave port at your DLN-series adapter.
The DlnSpiSlaveDisable()
function deactivates the specified SPI slave port on your DLN adapter.
The DlnSpiSlaveIsEnabled()
function retrieves information whether the specified SPI slave port is active or not.
The DlnSpiSlaveSetSSIdleTimeout()
function sets SS idle timeout. For details, read SS Idle Timeout.
The DlnSpiSlaveGetSSIdleTimeout()
function retrieves the current value of SS idle timeout.
The DlnSpiSlaveSetFrameSize()
function sets the size of a single SPI data frame.
The DlnSpiSlaveGetFrameSize()
function retrieves the current size setting for SPI data frames.
The DlnSpiSlaveGetSupportedFrameSizes()
function returns all supported frame size values.
The DlnSpiSlaveSetMode()
function sets SPI transmission parameters (CPOL and CPHA). For more information, read Clock Phase and Polarity.
The DlnSpiSlaveGetMode()
function retrieves the current transmission parameters (CPOL and CPHA) for the specified SPI slave port. For details, read Clock Phase and Polarity.
The DlnSpiSlaveGetSupportedModes()
function retrieves all supported SPI slave modes.
The DlnSpiSlaveSetCpha()
function allows to set the clock phase (CPHA) value.
The DlnSpiSlaveGetCpha()
function retrieves the current value of clock phase (CPHA).
The DlnSpiSlaveGetSupportedCphaValues()
function retrieves all supported CPHA (clock phase) values.
The DlnSpiSlaveSetCpol()
function allows to set the clock polarity (CPOL) value.
The DlnSpiSlaveGetCpol()
function retrieves the current value of clock polarity (CPOL).
The DlnSpiSlaveGetSupportedCpolValues()
function retrieves all supported CPOL (clock polarity) values.
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.
The DlnSpiSlaveEnqueueReply()
function adds a buffer to queue.
The DlnSpiSlaveSetReplyMode()
function sets SPI slave reply mode.
The DlnSpiSlaveGetReplyMode()
function retrieves the current SPI slave reply mode.
The DlnSpiSlaveGetSupportedReplyModes()
function retrieves the supported SPI slave reply modes.
The DlnSpiSlaveSetReplyShortageAction()
function sets the reply shortage action value. When the master sends a data block that is larger than the loaded reply, this function specifies how to fill empty bytes (repeat the reply bytes or send zeroes).
The DlnSpiSlaveGetReplyShortageAction()
functions retrieves the current value of reply shortage action.
The DlnSpiSlaveGetSupportedShortageActions()
function retrieves supported shortage action values.
The DlnSpiSlaveEnableSSRiseEvent()
function activates event on SS rising edge.
The DlnSpiSlaveDisableSSRiseEvent()
function deactivates SS rise events.
The DlnSpiSlaveIsSSRiseEventEnabled()
function retrieves information whether the SS rise events are active or not.
The DlnSpiSlaveEnableEvent()
function activates SPI slave buffer full event.
The DlnSpiSlaveDisableEvent()
function deactivates SPI slave buffer full event.
The DlnSpiSlaveIsEventEnabled()
function retrieves information whether the SPI slave events are active or not.
The DlnSpiSlaveSetEventSize()
function sets the event buffer size.
The DlnSpiSlaveGetEventSize()
function retrieves value of current event buffer size.
The DlnSpiSlaveEnableIdleEvent()
function activates the SPI slave idle event.
The DlnSpiSlaveDisableIdleEvent()
function deactivates the SPI slave idle event.
The DlnSpiSlaveIsIdleEventEnabled()
function activates the SPI slave idle event.
The DlnSpiSlaveSetIdleEventTimeout()
function sets idle event timeout.
The DlnSpiSlaveGetIdleEventTimeout()
function retrieves the current value of idle event timeout.
The DlnSpiSlaveGetMinIdleEventTimeout()
function retrieves the minimum value of idle event timeout.
The DlnSpiSlaveGetMaxIdleEventTimeout()
function retrieves the maximum value of idle event timeout.