Вы здесь

DlnSpiSlaveSetMode() Function

The DlnSpiSlaveSetMode() function sets SPI transmission parameters (CPOL and CPHA). For more information, read Clock Phase and Polarity.

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

A handle to the DLN-series adapter.

port

A number of the SPI slave 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 special constants, defined in the dln_spi_slave.h file for each of the bits.

BitValueDescriptionConstant

0

0

CPOL=0

DLN_SPI_SLAVE_CPOL_0

0

1

CPOL=1

DLN_SPI_SLAVE_CPOL_1

1

0

CPHA=0

DLN_SPI_SLAVE_CPHA_0

1

1

CPHA=1

DLN_SPI_SLAVE_CPHA_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() function to find the maximum possible port number.

DLN_RES_INVALID_MODE (0xC7)

The mode value is not valid. Use the DlnSpiSlaveGetSupportedModes() function to check the supported modes for the current SPI slave port.

DLN_RES_MUST_BE_DISABLED (0x95)

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

Remarks

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

Языки

Вход на сайт