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.