USB-I2C/SPI/GPIO Interface Adapters
Published on USB-I2C/SPI/GPIO Interface Adapters (https://dlnware.com)

Home > C/C++ API > SPI Bus Interface > SPI Slave Interface > SPI Slave Functions > DlnSpiSlaveSetCpha() Function

DlnSpiSlaveSetCpha() Function

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

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

A handle to the DLN-series adapter.

port

A number of the SPI slave port.

cpha

The clock phase (CPHA) value. Can be 0 or 1.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully configured the slave port mode.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

DLN_RES_MUST_BE_DISABLED (0x95)

These configuration changes are allowed only when the module is disabled. Use the DlnSpiSlaveDisable() [2] function to disable the SPI module before configuring the slave port.

DLN_RES_INVALID_CPHA (0xC9)

The provided CPHA value is not valid. Use the DlnSpiSlaveGetSupportedCphaValues() [3] function to check the supported CPHA values for the current SPI slave port.

Remarks

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


Links
[1] http://dlnware.com/dll/DlnSpiSlaveGetPortCount [2] http://dlnware.com/dll/DlnSpiSlaveDisable [3] http://dlnware.com/dll/DlnSpiSlaveGetSupportedCphaValues