The DlnSpiMasterSetMode() function sets SPI transmission parameters (CPOL and CPHA).
DlnSpiMasterSetMode()
DLN_RESULT DlnSpiMasterSetMode( HDLN handle, uint8_t port, uint8_t mode );
A handle to the DLN-series adapter.
A number of the SPI master port.
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.
dln_spi_master.h
0
CPOL=0
DLN_SPI_MASTER_CPOL_0
1
CPOL=1
DLN_SPI_MASTER_CPOL_1
CPHA=0
DLN_SPI_MASTER_CPHA_0
CPHA=1
DLN_SPI_MASTER_CPHA_1
The function successfully configured the SPI transmission parameters.
The port number is not valid. Use the DlnSpiMasterGetPortCount() function to find the maximum possible port number.
The SPI master is busy transmitting.
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.