SPI control functions.
More...
|
hal_spi_state_t | hal_spi_get_state (spi_handle_t *p_spi) |
| Return the SPI handle state. More...
|
|
uint32_t | hal_spi_get_error (spi_handle_t *p_spi) |
| Return the SPI error code. More...
|
|
void | hal_spi_set_timeout (spi_handle_t *p_spi, uint32_t timeout) |
| Set the SPI internal process timeout value. More...
|
|
hal_status_t | hal_spi_set_tx_fifo_threshold (spi_handle_t *p_spi, uint32_t threshold) |
| Set the TX FIFO threshold. More...
|
|
hal_status_t | hal_spi_set_rx_fifo_threshold (spi_handle_t *p_spi, uint32_t threshold) |
| Set the RX FIFO threshold. More...
|
|
uint32_t | hal_spi_get_tx_fifo_threshold (spi_handle_t *p_spi) |
| Get the TX FIFO threshold. More...
|
|
uint32_t | hal_spi_get_rx_fifo_threshold (spi_handle_t *p_spi) |
| Get the RX FIFO threshold. More...
|
|
hal_status_t | hal_spi_suspend_reg (spi_handle_t *p_spi) |
| Suspend some registers related to SPI configuration before sleep. More...
|
|
hal_status_t | hal_spi_resume_reg (spi_handle_t *p_spi) |
| Restore some registers related to SPI configuration after sleep. This function must be used in conjunction with the hal_spi_suspend_reg(). More...
|
|
hal_status_t | hal_spi_transmit_with_ia (spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout) |
| Transmit an amount of data in non-blocking mode with polling. Support Setting C&A. More...
|
|
hal_status_t | hal_spi_transmit_dma_with_ia (spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length) |
| Transmit an amount of data in non-blocking mode with DMA. Support Setting C&A. More...
|
|
hal_spi_state_t | hal_spi_v2_get_state (spi_handle_t *p_spi) |
| Return the SPI handle state. More...
|
|
uint32_t | hal_spi_v2_get_error (spi_handle_t *p_spi) |
| Return the SPI error code. More...
|
|
void | hal_spi_v2_set_timeout (spi_handle_t *p_spi, uint32_t timeout) |
| Set the SPI internal process timeout value. More...
|
|
uint32_t | hal_spi_v2_get_tx_fifo_threshold (spi_handle_t *p_spi) |
| Get the TX FIFO threshold. More...
|
|
uint32_t | hal_spi_v2_get_rx_fifo_threshold (spi_handle_t *p_spi) |
| Get the RX FIFO threshold. More...
|
|
hal_status_t | hal_spi_v2_suspend_reg (spi_handle_t *p_spi) |
| Suspend some registers related to SPI configuration before sleep. More...
|
|
hal_status_t | hal_spi_v2_resume_reg (spi_handle_t *p_spi) |
| Restore some registers related to SPI configuration after sleep. This function must be used in conjunction with the hal_spi_suspend_reg(). More...
|
|
hal_status_t | hal_spi_v2_transmit_dma_with_toggle (spi_handle_t *p_spi, uint32_t data_size, uint8_t *p_data, uint32_t length) |
| Using DMA to Transmit data by toggling CS in every data beat. More...
|
|
SPI control functions.
===============================================================================
##### Peripheral State and Errors functions #####
===============================================================================
[..]
This subsection provides a set of functions allowing to control the SPI.
(+) hal_spi_get_state() API can be helpful to check in run-time the state of the SPI peripheral
(+) hal_spi_get_error() check in run-time Errors occurring during communication
(+) hal_spi_set_timeout() set the timeout during internal process
(+) hal_spi_set_tx_fifo_threshold() set the TX FIFO Threshold
(+) hal_spi_set_rx_fifo_threshold() set the RX FIFO Threshold
(+) hal_spi_get_tx_fifo_threshold() get the TX FIFO Threshold
(+) hal_spi_get_rx_fifo_threshold() get the RX FIFO Threshold
===============================================================================
##### Peripheral State and Errors functions #####
===============================================================================
[..]
This subsection provides a set of functions allowing to control the SPI.
(+) hal_spi_get_state() API can be helpful to check in run-time the state of the SPI peripheral
(+) hal_spi_get_error() check in run-time Errors occurring during communication
(+) hal_spi_set_timeout() set the timeout during internal process
(+) hal_spi_get_tx_fifo_threshold() get the TX FIFO Threshold
(+) hal_spi_get_rx_fifo_threshold() get the RX FIFO Threshold
◆ hal_spi_get_error()
Return the SPI error code.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Returns
- SPI error code in bitmap format
◆ hal_spi_get_rx_fifo_threshold()
uint32_t hal_spi_get_rx_fifo_threshold |
( |
spi_handle_t * |
p_spi | ) |
|
Get the RX FIFO threshold.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Returns
- RX FIFO threshold
◆ hal_spi_get_state()
Return the SPI handle state.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Return values
-
◆ hal_spi_get_tx_fifo_threshold()
uint32_t hal_spi_get_tx_fifo_threshold |
( |
spi_handle_t * |
p_spi | ) |
|
Get the TX FIFO threshold.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Returns
- TX FIFO threshold
◆ hal_spi_resume_reg()
Restore some registers related to SPI configuration after sleep. This function must be used in conjunction with the hal_spi_suspend_reg().
- Parameters
-
[in] | p_spi | Pointer to a SPI handle which contains the configuration information for the specified SPI module. |
- Return values
-
◆ hal_spi_set_rx_fifo_threshold()
Set the RX FIFO threshold.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | threshold | RX FIFO threshold value ranging bwtween 0x0U ~ 0x7U. |
- Return values
-
◆ hal_spi_set_timeout()
void hal_spi_set_timeout |
( |
spi_handle_t * |
p_spi, |
|
|
uint32_t |
timeout |
|
) |
| |
Set the SPI internal process timeout value.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | timeout | Internal process timeout value. |
◆ hal_spi_set_tx_fifo_threshold()
Set the TX FIFO threshold.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | threshold | TX FIFO threshold value ranging bwtween 0x0U ~ 0x7U. |
- Return values
-
◆ hal_spi_suspend_reg()
Suspend some registers related to SPI configuration before sleep.
- Parameters
-
[in] | p_spi | Pointer to a SPI handle which contains the configuration information for the specified SPI module. |
- Return values
-
◆ hal_spi_transmit_dma_with_ia()
hal_status_t hal_spi_transmit_dma_with_ia |
( |
spi_handle_t * |
p_spi, |
|
|
uint8_t |
inst, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
p_data, |
|
|
uint32_t |
length |
|
) |
| |
Transmit an amount of data in non-blocking mode with DMA. Support Setting C&A.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | inst | 1 byte instruction |
[in] | addr | 3 bytes address |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
- Return values
-
◆ hal_spi_transmit_with_ia()
hal_status_t hal_spi_transmit_with_ia |
( |
spi_handle_t * |
p_spi, |
|
|
uint8_t |
inst, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
p_data, |
|
|
uint32_t |
length, |
|
|
uint32_t |
timeout |
|
) |
| |
Transmit an amount of data in non-blocking mode with polling. Support Setting C&A.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | inst | 1 byte instruction |
[in] | addr | 3 bytes address |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
[in] | timeout | Timeout duration |
- Return values
-
◆ hal_spi_v2_get_error()
Return the SPI error code.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Returns
- SPI error code in bitmap format
◆ hal_spi_v2_get_rx_fifo_threshold()
uint32_t hal_spi_v2_get_rx_fifo_threshold |
( |
spi_handle_t * |
p_spi | ) |
|
Get the RX FIFO threshold.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Returns
- RX FIFO threshold
◆ hal_spi_v2_get_state()
Return the SPI handle state.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Return values
-
◆ hal_spi_v2_get_tx_fifo_threshold()
uint32_t hal_spi_v2_get_tx_fifo_threshold |
( |
spi_handle_t * |
p_spi | ) |
|
Get the TX FIFO threshold.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
- Returns
- TX FIFO threshold
◆ hal_spi_v2_resume_reg()
Restore some registers related to SPI configuration after sleep. This function must be used in conjunction with the hal_spi_suspend_reg().
- Parameters
-
[in] | p_spi | Pointer to a SPI handle which contains the configuration information for the specified SPI module. |
- Return values
-
◆ hal_spi_v2_set_timeout()
void hal_spi_v2_set_timeout |
( |
spi_handle_t * |
p_spi, |
|
|
uint32_t |
timeout |
|
) |
| |
Set the SPI internal process timeout value.
- Parameters
-
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | timeout | Internal process timeout value. |
◆ hal_spi_v2_suspend_reg()
Suspend some registers related to SPI configuration before sleep.
- Parameters
-
[in] | p_spi | Pointer to a SPI handle which contains the configuration information for the specified SPI module. |
- Return values
-
◆ hal_spi_v2_transmit_dma_with_toggle()
hal_status_t hal_spi_v2_transmit_dma_with_toggle |
( |
spi_handle_t * |
p_spi, |
|
|
uint32_t |
data_size, |
|
|
uint8_t * |
p_data, |
|
|
uint32_t |
length |
|
) |
| |
Using DMA to Transmit data by toggling CS in every data beat.
- Parameters
-
- Returns
- Result of operation.