SPI Master Functions

The default configuration for the SPI master port is as 8-bit SPI master with CPOL=0 and CPHA=0 transmission parameters. By default, the clock is selected with a frequency of 1Mhz.

Using the SPI master functions allows you to change and check the current SPI master configuration, to control data transmission.

The SPI master functions include the following:

General port information:

DlnSpiMasterGetPortCount()

Retrieves the number of SPI master ports available in the DLN adapter.

DlnSpiMasterEnable()

Assigns the selected port to the SPI master module.

DlnSpiMasterDisable()

Releases the selected SPI master port.

DlnSpiMasterIsEnabled()

Retrieves whether the selected port is assigned to the SPI master module.

Configuration functions:

DlnSpiMasterSetFrequency()

Configures the clock frequency for the selected SPI master port.

DlnSpiMasterGetFrequency()

Retrieves the clock frequency configuration for the SPI master port.

DlnSpiMasterSetFrameSize()

Configures the size of a single data frame for the selected SPI master port.

DlnSpiMasterGetFrameSize()

Retrieves the data frame configuration for the selected SPI master port.

DlnSpiMasterSetMode()

Configures the transmission mode based on CPOL and CPHA values.

DlnSpiMasterGetMode()

Retrieves the transmission mode configuration for the selected SPI master port.

DlnSpiMasterSetCpol()

Configures the CPOL value for the selected SPI master port.

DlnSpiMasterGetCpol()

Retrieves the CPOL value for the selected SPI master port.

DlnSpiMasterSetCpha()

Configures the CPHA value for the selected SPI master port.

DlnSpiMasterGetCpha()

Retrieves the CPHA value for the selected SPI master port.

DlnSpiMasterGetSupportedModes()

Retrieves the supported transmission modes for the selected SPI master port.

DlnSpiMasterGetSupportedCpolValues()

Retrieves the supported CPOL values for the selected SPI master port.

DlnSpiMasterGetSupportedCphaValues()

Retrieves the supported CPHA values for the selected SPI master port.

Slave selection functions:

DlnSpiMasterGetSSCount()

Retrieves the available number of SS lines for the selected SPI master port.

DlnSpiMasterSetSS()

Selects a Slave Select (SS) line.

DlnSpiMasterGetSS()

Retrieves the selected SS line.

DlnSpiMasterSSEnable()

Activates the selected SS line.

DlnSpiMasterSSDisable()

Disables the selected SS line.

DlnSpiMasterSSIsEnabled()

Retrieves whether the selected SS line is activated.

DlnSpiMasterSSMultiEnable()

Activates several selected SS lines.

DlnSpiMasterSSMultiDisable()

Disables several selected SS lines.

DlnSpiMasterSSMultiIsEnabled()

Retrieves whether several selected SS lines are activated.

DlnSpiMasterReleaseSS()

Releases the selected SS line.

DlnSpiMasterSSBetweenFramesEnable()

Activates releasing SS line between data frames exchanged with a single slave device.

DlnSpiMasterSSBetweenFramesDisable()

Disables releasing SS line between data frames exchanged with a single slave device.

DlnSpiMasterSSBetweenFramesIsEnabled()

Retrieves whether releasing SS line between data frames is activated.

Transmission functions:

DlnSpiMasterReadWrite()

Provides SPI communication in a full-duplex mode with arrays of 8-bit frames.

DlnSpiMasterReadWrite16()

Provides SPI communication in a full-duplex mode with arrays of frames up to 16 bits.

DlnSpiMasterReadWriteEx()

Provides SPI communication in a full-duplex mode with arrays of 8-bit frames; can release the SS line after transmission.

DlnSpiMasterReadWriteSS()

Provides SPI communication in a full-duplex mode with arrays of 8-bit frames; releases the SS line after transmission.

DlnSpiMasterRead()

Provides SPI communication in a half-duplex read mode with arrays of 8-bit frames.

DlnSpiMasterReadEx()

Provides SPI communication in a half-duplex read mode with arrays of 8-bit frames; can release the SS line after transmission.

DlnSpiMasterWrite()

Provides SPI communication in a half-duplex write mode with arrays of 8-bit frames.

DlnSpiMasterWriteEx()

Provides SPI communication in a half-duplex write mode with arrays of 8-bit frames; can release the SS line after transmission.

Delay functions:

DlnSpiMasterSetDelayBetweenFrames()

Configures a delay between data frames exchanged with a single slave device.

DlnSpiMasterGetDelayBetweenFrames()

Retrieves current delay between data frames exchanged with a single slave device.

DlnSpiMasterSetDelayAfterSS()

Configures a delay between activating SS line and the first data frame.

DlnSpiMasterGetDelayAfterSS()

Retrieves current delay between activating SS line and the first data frame.

DlnSpiMasterSetDelayBetweenSS()

Configures a minimum delay between releasing one SS line and activating another SS line.

DlnSpiMasterGetDelayBetweenSS()

Retrieves current delay between releasing one SS line and activating another SS line.

The dln_spi_master.h file declares the SPI Master Interface functions.

Rating: 
Голосов пока нет

DlnSpiMasterGetPortCount() Function

The DlnSpiMasterGetPortCount() function retrieves the total number of SPI master ports available in your DLN-series adapter.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetPortCount(
  HDLN handle,
  uint8_t* count
);
Parameters
handle

A handle to the DLN-series adapter.

count

A pointer to an unsigned 8-bit integer that receives the number of available SPI master ports.

Return Value
DLN_RES_SUCCESS (0x00)

The operation completed successfully and total number of SPI master ports were retrieved.

Remarks

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

DlnSpiMasterEnable() Function

The DlnSpiMasterEnable() function activates the selected SPI master port on your DLN-series adapter.

Syntax
C/C++
DLN_RESULT DlnSpiMasterEnable(
   HDLN handle,
   uint8_t port,
   uint16_t* conflict
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

conflict

A pointer to an unsigned 16-bit integer that receives the number of a conflicted pin, if any.

A conflict arises if the pin is already assigned to another module and cannot be used by the SPI module. To fix this, check which module uses the pin (call the DlnGetPinCfg()function), disconnect the pin from that module and call the DlnSpiMasterEnable() function once again. If there is another conflicting pin, its number will be returned.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully activated the SPI master port.

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_PIN_IN_USE (0xA5)

The port cannot be activated as the SPI master port because one or more pins of the port are assigned to another module. The conflict parameter contains the number of a conflicting pin.

DLN_RES_NO_FREE_DMA_CHANNEL (0xAF)

The function cannot be executed because all DMA channels are assigned to another modules of the adapter.

Remarks

DLN-1 and DLN-2 adapters do not allow to change the SPI master configuration after the port is assigned to the SPI master module. Therefore, make sure you have configured the SPI master port before you enable it.

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

DlnSpiMasterDisable() Function

The DlnSpiMasterDisable() function releases the selected SPI master port on your DLN-series adapter.

Syntax
C/C++
DLN_RESULT DlnSpiMasterDisable(
   HDLN handle,
   uint8_t port,
   uint8_t waitForTransferCompletion
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

waitForTransferCompletion

Used to choose whether the device should wait for current data transmissions to complete before disabling the SPI master. The following values are available:

  • 1 or DLN_SPI_MASTER_WAIT_FOR_TRANSFERS - wait until transmissions complete.

  • 0 or DLN_SPI_MASTER_CANCEL_TRANSFERS - cancel all pending data transmissions and release the port.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully deactivated the SPI master port.

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_TRANSFER_CANCELLED (0x20)

The pending transmissions were cancelled.

Remarks

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

DlnSpiMasterIsEnabled() Function

The DlnSpiMasterIsEnabled() function retrieves whether the specified SPI master port is activated.

Syntax
C/C++
DLN_RESULT DlnSpiMasterIsEnabled(
    HDLN handle,
    uint8_t port,
    uint8_t* enabled
 );
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

enabled

A pointer to an unsigned 8-bit integer that receives the information whether the specified SPI master port is activated. There are two possible values:

  • 0 or DLN_SPI_MASTER_DISABLED - the port is not configured as SPI master.

  • 1 or DLN_SPI_MASTER_ENABLED - the port is configured as SPI master.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved information about the SPI master port.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSetFrequency() Function

The DlnSpiMasterSetFrequency() function sets the clock frequency on the SCK line, used to synchronize data transmission between master and slave devices.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetFrequency(
   HDLN handle,
   uint8_t port,
   uint32_t frequency,
   uint32_t* actualFrequency
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

frequency

SCK line frequency value, specified in Hz. You can specify any value within the range, supported by the DLN-series adapter. This range can be retrieved using the respective function. In case you enter an incompatible value, the function approximates it as the closest lower frequency value, supported by the adapter.

actualFrequency

A pointer to an unsigned 32-bit integer that receives the frequency approximated as the closest to user-defined lower value. The value is specified in Hz and can be null.

Frequency for DLN-4S and DLN-4M adapters is determined by 96 Mhz divided into 2.255. So the nearest frequency values will be 96/2 = 48 Mhz, 96/5 = 19,2 Mhz, 96/10 = 9,6 Mhz.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully set the clock frequency of the SCK line.

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_BUSY (0xB6)

The SPI master is busy transmitting.

DLN_RES_VALUE_ROUNDED (0x21)

The frequency value has been approximated as the closest supported value.

Remarks

By default, the clock is selected with a frequency of 1Mhz. You can check the current value by using the DlnSpiMasterGetFrequency() function.

The DlnSpiMasterSetFrequency() function is defined in dln_spi_master.h file.

DlnSpiMasterGetFrequency() Function

The DlnSpiMasterGetFrequency() function retrieves the current setting for SPI clock frequency.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetFrequency(
   HDLN handle,
   uint8_t port,
   uint32_t* frequency
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

frequency

A pointer to an unsigned 32-bit integer that receives the current SPI clock frequency value in Hz.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the clock frequency.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

The DlnSpiMasterGetFrequency() function is defined in dln_spi_master.h file.

DlnSpiMasterSetFrameSize() Function

The DlnSpiMasterSetFrameSize() function sets the size of a single SPI data frame.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetFrameSize(
   HDLN handle,
   uint8_t port,
   uint8_t frameSize
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

frameSize

A number of bits to be transmitted. The DLN-series adapter supports 8 to 16 bits per frame.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully configured the size of a SPI data frame.

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_SPI_INVALID_FRAME_SIZE (0xB8)

The frame size is not valid. The DLN-series adapters support 8 to 16 bits per transmit.

DLN_RES_BUSY (0xB6)

The SPI master is busy transmitting.

Remarks

The default frame size is set to 8 bits. To check the current frame size value, use the DlnSpiMasterGetFrameSize() function.

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

DlnSpiMasterGetFrameSize() Function

The DlnSpiMasterGetFrameSize() function retrieves the current size setting for SPI data frame.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetFrameSize(
   HDLN handle,
   uint8_t port,
   uint8_t* frameSize
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

frameSize

A number of bits to be transmitted in a single frame. The DLN-series adapters support 8 to 16 bits per transmission.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the SPI data frame size.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSetMode() Function

The DlnSpiMasterSetMode() function sets SPI transmission parameters (CPOL and CPHA).

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetMode(
    HDLN handle,
    uint8_t port,
    uint8_t mode
 );
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

mode

A bit field consisting of 8 bits. The bits 0 and 1 correspond to CPOL and CPHA parameters respectively and define the SPI mode. The rest of the bits are not used. You can also use the special constants, defined in the dln_spi_master.h file for each of the bits. See Clock Phase and Polarity for additional info.

BitValueDescriptionConstant

0

0

CPOL=0

DLN_SPI_MASTER_CPOL_0

0

1

CPOL=1

DLN_SPI_MASTER_CPOL_1

1

0

CPHA=0

DLN_SPI_MASTER_CPHA_0

1

1

CPHA=1

DLN_SPI_MASTER_CPHA_1

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully configured the SPI transmission parameters.

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_BUSY (0xB6)

The SPI master is busy transmitting.

Remarks

By default, the DLN adapter’s SPI master port is configured to CPOL=0 CPHA=0 transmission mode.

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

DlnSpiMasterGetMode() Function

The DlnSpiMasterGetMode() function retrieves current configuration of the selected SPI master port.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetMode(
   HDLN handle,
   uint8_t port,
   uint8_t* mode
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

mode

A pointer to an unsigned 8 bit integer that receives the SPI mode description. See DlnSpiMasterSetMode() for details.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the SPI transmission parameters.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSetCpol() Function

The DlnSpiMasterSetCpol() function sets the clock polarity value.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetCpol(
    HDLN handle, 
    uint8_t port, 
    uint8_t cpol
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

cpol

Clock polarity value. Possible values: 0 or 1.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully configured the SPI master CPOL value.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

By default, SPI master ports of DLN adapters have CPOL=0 configuration.

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

DlnSpiMasterGetCpol() Function

The DlnSpiMasterGetCpol() function retrieves the current value of clock polarity (CPOL).

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetCpol(
    HDLN handle, 
    uint8_t port, 
    uint8_t *cpol
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

cpol

The pointer to uint8_t variable which will be filled with current CPOL value.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the SPI master CPOL value.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSetCpha() Function

The DlnSpiMasterSetCpha() function allows to set clock phase (CPHA) value.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetCpha(
    HDLN handle, 
    uint8_t port, 
    uint8_t cpha
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the selected SPI master port.

cpha

The clock phase value. Can be 0 or 1.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully configured the SPI master CPHA value.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

By default, SPI master ports of DLN adapters have CPHA=0 configuration.

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

DlnSpiMasterGetCpha() Function

The DlnSpiMasterGetCpha() function retrieves the current value of clock phase (CPHA).

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetCpha(
    HDLN handle, 
    uint8_t port, 
    uint8_t *cpha
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

cpha

The pointer to uint8_t variable which will be filled with current CPHA value.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the SPI master CPHA value.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterGetSupportedModes() Function

The DlnSpiMasterGetSupportedModes() function retrieves all supported SPI master modes (CPOL and CPHA values). For more information, read Clock Phase and Polarity.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetSupportedModes(
  HDLN handle, 
  uint8_t port, 
  DLN_SPI_MASTER_MODE_VALUES *values
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

values

Pointer to DLN_SPI_MASTER_MODE_VALUES type variable that receives available mode values.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved supported transmission modes.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterGetSupportedCpolValues() Function

The DlnSpiMasterGetSupportedCpolValues() function retrieves supported CPOL values.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetSupportedCpolValues(
  HDLN handle, 
  uint8_t port, 
  DLN_SPI_MASTER_CPOL_VALUES *values
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

values

Pointer to DLN_SPI_MASTER_CPOL_VALUES type variable that receives available CPOL values.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved supported CPOL values.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterGetSupportedCphaValues() Function

The DlnSpiMasterGetSupportedCphaValues() function retrieves the available CPHA values.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetSupportedCphaValues(
  HDLN handle, 
  uint8_t port, 
  DLN_SPI_MASTER_CPHA_VALUES *values
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

values

Pointer to DLN_SPI_MASTER_CPHA_VALUES type variable that receives the supported CPHA values.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved supported CPHA values.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterGetSSCount() Function

The DlnSpiMasterGetSSCount() function returns the available number of SS lines.

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

A handle to the DLN-series adapter.

port

A number of the SPI master port.

count

The pointer to uint16_t type variable that receives the number of available SS lines.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the number of SS lines.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSetSS() Function

The DlnSpiMasterSetSS() function selects a Slave Select (SS) line.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetSS(
   HDLN handle,
   uint8_t port,
   uint8_t ss
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port to be configured.

ss

The value on the SS lines. The bits 4-7 are reserved and must be set to 1.

If you expect slaves to output data, you must ensure that only one slave is activated. If several slaves start outputting data simultaneously, the equipment can be damaged.
Return Value
DLN_RES_SUCCESS (0x00)

The function successfully selected the SS line.

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_BUSY (0xB6)

The SPI master is busy transmitting.

DLN_RES_SPI_MASTER_INVALID_SS_NUMBER (0xB9)

The SS value is not valid.

Remarks

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

DlnSpiMasterGetSS() Function

The DlnSpiMasterGetSS() function retrieves current Slave Select (SS) line.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetSS(
   HDLN handle,
   uint8_t port,
   uint8_t* ss
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

ss

A pointer to an unsigned 8-bit integer that receives the value on the SS lines.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the current value on the SS lines.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSSEnable() Function

The DlnSpiMasterSSEnable() function enables the specified SS line.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSEnable(
    HDLN handle, 
    uint8_t port, 
    uint8_t ss
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

ss

The number of the SS line.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully enabled the SS line.

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_SPI_MASTER_INVALID_SS_VALUE (0xB9)

The number of the SS line is invalid. Use the DlnSpiMasterGetSSCount() function to check the available number of SS lines.

Remarks

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

DlnSpiMasterSSDisable() Function

The DlnSpiMasterSSDisable() function disables the specified SS line.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSDisable(
    HDLN handle, 
    uint8_t port, 
    uint8_t ss
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

ss

The number of the SS line.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully disabled the SS line.

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_SPI_MASTER_INVALID_SS_VALUE (0xB9)

The number of the SS line is invalid. Use the DlnSpiMasterGetSSCount() function to check the available number of SS lines.

Remarks

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

DlnSpiMasterSSIsEnabled() Function

The DlnSpiMasterSSIsEnabled() function enables the specified SS line.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSEnable(
    HDLN handle, 
    uint8_t port,
    uint8_t ss, 
    uint8_t *enabled
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

ss

The number of the SS line.

enabled

A pointer to an unsigned 8-bit integer that receives the information whether the specified SS line is enabled.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully disabled the SS line.

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_SPI_MASTER_INVALID_SS_VALUE (0xB9)

The number of the SS line is invalid. Use the DlnSpiMasterGetSSCount() function to check the available number of SS lines.

Remarks

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

DlnSpiMasterSSMultiEnable() Function

The DlnSpiMasterSSMultiEnable() function enables the specified SS lines.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSMultiEnable(
    HDLN handle, 
    uint8_t port, 
    uint8_t ssMask
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

ssMask

A pointer to an unsigned 8-bit integer that receives status of SS lines.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved status of SS lines.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSSMultiDisable() Function

The DlnSpiMasterSSMultiDisable() function enables the specified SS lines.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSEnable(
    HDLN handle, 
    uint8_t port, 
    uint8_t ssMask
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

ssMask

The field that defines what SS lines of the port should be disabled. To disable the SS line, set 0 to the corresponding bit.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully disabled the SS lines.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSSMultiIsEnabled() Function

The DlnSpiMasterSSMultiIsEnabled() function enables the specified SS lines.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSMultiIsEnabled(
    HDLN handle, 
    uint8_t port, 
    uint8_t *enabled
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

enabled

A pointer to an unsigned 8-bit integer that receives the information about status of SS lines. There are two possible values for every bit:

  • 0 - the SS line is disabled.

  • 1 - the SS line is enabled.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved status of the SS lines.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterReleaseSS() Function

The DlnSpiMasterReleaseSS() function releases SS lines.

Syntax
C/C++
DLN_RESULT DlnSpiMasterReleaseSS(
    HDLN handle, 
    uint8_t port
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully released SS lines.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks

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

DlnSpiMasterSSBetweenFramesEnable() Function

The DlnSpiMasterSSBetweenFramesEnable() function enables release of an SS line between data frames exchanged with a single slave device.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSBetweenFramesEnable(
   HDLN handle,
   uint8_t port
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the selected SPI master port.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully enabled release of the SS line.

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_BUSY (0xB6)

The SPI master is busy transmitting.

Remarks
DLN-1 and DLN-2 adapters do not support releasing the slave select line between frames.

The DlnSpiMasterSSBetweenFramesEnable() function is defined in dln_spi_master.h file.

DlnSpiMasterSSBetweenFramesDisable() Function

The DlnSpiMasterSSBetweenFramesDisable() function disables release of an SS line between data frames exchanged with a single slave device.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSBetweenFramesDisable(
   HDLN handle,
   uint8_t port
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the selected SPI master port.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully disabled release of the SS line.

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_BUSY (0xB6)

The SPI master is busy transmitting.

Remarks
DLN-1 and DLN-2 adapters do not support releasing the slave select line between frames.

The DlnSpiMasterSSBetweenFramesDisable() function is defined in dln_spi_master.h file.

DlnSpiMasterSSBetweenFramesIsEnabled() Function

The DlnSpiMasterSSBetweenFramesIsEnabled() function checks whether the DLN-series adapter releases SS line between successive SPI frames transmission.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSSBetweenFramesIsEnabled(
   HDLN handle,
   uint8_t port,
   uint8_t* enabled
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the selected SPI master port.

enabled

A pointer to an unsigned 8-bit integer that receives information whether release of an SS line is enabled. The following values are available:

  • 1 or DLN_SPI_MASTER_SS_BETWEEN_TRANSFERS_ENABLED - the SS line release is enabled.

  • 0 or DLN_SPI_MASTER_SS_BETWEEN_TRANSFERS_DISABLED - the SS line release is disabled.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieves information about the release of the SS line.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks
DLN-1 and DLN-2 adapters do not support releasing the slave select line between frames.

The DlnSpiMasterSSBetweenFramesIsEnabled() function is defined in dln_spi_master.h file.

DlnSpiMasterReadWrite() Function

The DlnSpiMasterReadWrite() function sends and receives data via SPI bus. The received and sent data are arrays of 1-byte elements. This function is suited to transmit data frames of 8 bits or less. In case you set a frame size more than 8 bits, it is advised to use the DlnSpiMasterReadWrite16() function.

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

A handle to the DLN-series adapter.

port

A number of the selected 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 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 DlnSpiMasterReadWrite() function is defined in dln_spi_master.h file.

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.

DlnSpiMasterReadWriteSS() Function

The DlnSpiMasterReadWriteSS() function selects the specified SS line, transmits data via SPI bus and releases the SS line.

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

A handle to the DLN-series adapter.

port

A number of the selected SPI master port.

ss

The value on the SS lines. This value can include only one zero bit.

size

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

writeBuffer

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

readBuffer

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

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

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.

DlnSpiMasterRead() Function

The DlnSpiMasterRead() function receives data via SPI bus. The received data is an array of 1-byte elements.

Syntax
C/C++
DLN_RESULT DlnSpiMasterRead(
  HDLN handle, 
  uint8_t port, 
  uint16_t size, 
  uint8_t *readBuffer
);
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.

readBuffer

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

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully received 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 DlnSpiMasterRead() function is defined in the dln_spi_master.h file.

DlnSpiMasterReadEx() Function

The DlnSpiMasterReadEx() function receives data via SPI bus. The received data is 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 DlnSpiMasterReadEx(
  HDLN handle, 
  uint8_t port, 
  uint16_t size, 
  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.

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

DlnSpiMasterWrite() Function

The DlnSpiMasterWrite() function sends data via SPI bus. The data is sent as an array of 1-byte elements.

Syntax
C/C++
DLN_RESULT DlnSpiMasterWrite(
  HDLN handle, 
  uint8_t port, 
  uint16_t size, 
  uint8_t *writeBuffer
);
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.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully sent 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 DlnSpiMasterWriteEx() function is defined in the dln_spi_master.h file.

DlnSpiMasterWriteEx() Function

The DlnSpiMasterWriteEx() function sends data via SPI bus. The data is sent as an array of 1-byte elements. By using this function you can use additional attributes.

Syntax
C/C++
DLN_RESULT DlnSpiMasterWriteEx(
  HDLN handle, 
  uint8_t port, 
  uint16_t size, 
  uint8_t *writeBuffer, 
  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.

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

DlnSpiMasterSetDelayBetweenFrames() Function

The DlnSpiMasterSetDelayBetweenFrames() function sets a delay between data frames exchanged with a single slave device. For more information, read SPI Delays.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetDelayBetweenFrames(
   HDLN handle,
   uint8_t port,
   uint32_t delayBetweenFrames,
   uint32_t* actualDelayBetweenFrames
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port to be configured.

delayBetweenFrames

The delay value in nanoseconds. If you specify an unsupported value, it will be approximated as the closest higher supported value.

actualDelayBetweenFrames

Actual set delay value in nanoseconds.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully set the delay between data frames.

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_BUSY (0xB6)

The SPI master is busy transmitting.

DLN_RES_VALUE_ROUNDED (0x21)

The delay value has been approximated as the closest supported value.

Remarks
DLN-1 and DLN-2 adapters do not support delays between frames.

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

DlnSpiMasterGetDelayBetweenFrames() Function

The DlnSpiMasterGetDelayBetweenFrames() function retrieves current setting for delay between data frames exchanged with a single slave device.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetDelayBetweenFrames(
   HDLN handle,
   uint8_t port,
   uint32_t* delayBetweenFrames
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

delayBetweenFrames

A pointer to an unsigned 32-bit integer that receives the current delay value in nanoseconds.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the delay between data frames.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks
DLN-1 and DLN-2 adapters do not support delays between frames.

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

DlnSpiMasterSetDelayAfterSS() Function

The DlnSpiMasterSetDelayAfterSS() function sets a delay duration between assertion of an SS line and first data frame. For more information, read SPI Delays.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetDelayAfterSS(
   HDLN handle,
   uint8_t port,
   uint32_t delayAfterSS,
   uint32_t* actualDelayAfterSS
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

delayAfterSS

The delay value in nanoseconds. If you specify an unsupported value, it will be approximated as the closest higher supported value.

If you set a 0ns delay time, the actual delay will be equal to 1/2 of the SPI clock frequency, specified by the DlnSpiMasterSetFrequency() function.
Return Value
DLN_RES_SUCCESS (0x00)

The function successfully set the delay after slave selection.

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_BUSY (0xB6)

The SPI master is busy transmitting.

DLN_RES_VALUE_ROUNDED (0x21)

The delay value has been approximated as the closest supported value.

Remarks
DLN-1 and DLN-2 adapters do not support delays after slave selection.

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

DlnSpiMasterGetDelayAfterSS() Function

The DlnSpiMasterGetDelayAfterSS() function retrieves the current setting for minimum delay between assertion of an SS line and the first data frame.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetDelayAfterSS(
   HDLN handle,
   uint8_t port,
   uint32_t* delayAfterSS
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

delayAfterSS

A pointer to an unsigned 32-bit integer that receives the current delay value in nanoseconds.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the delay after slave selection.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks
DLN-1 and DLN-2 adapters do not support delays after slave selection.

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

DlnSpiMasterSetDelayBetweenSS() Function

The DlnSpiMasterSetDelayBetweenSS() function sets a minimum delay between release of an SS line and assertion of another SS line. For more information, read SPI Delays.

Syntax
C/C++
DLN_RESULT DlnSpiMasterSetDelayBetweenSS(
   HDLN handle,
   uint8_t port,
   uint32_t delayBetweenSS,
   uint32_t* actualDelayBetweenSS
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

delayBetweenSS

The delay value in nanoseconds. If you specify an unsupported value, it will be approximated as the closest higher supported value.

actualDelayBetweenSS

Actual set delay value in nanoseconds.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully set the delay after one SS line is released and before another SS line is asserted.

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_BUSY (0xB6)

The SPI master is busy transmitting.

DLN_RES_VALUE_ROUNDED (0x21)

The delay value has been approximated as the closest supported value.

Remarks
DLN-1 and DLN-2 adapters do not support delays between slave selections.

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

DlnSpiMasterGetDelayBetweenSS() Function

The DlnSpiMasterGetDelayBetweenSS() function retrieves the current setting for minimum delay after one SS line is released and before another SS line is asserted.

Syntax
C/C++
DLN_RESULT DlnSpiMasterGetDelayBetweenSS(
   HDLN handle,
   uint8_t port,
   uint32_t* delayBetweenSS
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the SPI master port.

delayBetweenSS

A pointer to an unsigned 32-bit integer that receives the current delay value in nanoseconds.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully set the delay after one SS line is released and before another SS line is asserted.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

Remarks
DLN-1 and DLN-2 adapters do not support delays between slave selections.

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