Вы здесь

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.

Языки

Вход на сайт