Functions
Initialization and de-initialization functions
Peripheral Driver » HAL Driver » SPI » Functions

Initialization and de-initialization functions. More...

## Functions
hal_status_t | hal_spi_init (spi_handle_t *p_spi)
| Initialize the SPI according to the specified parameters in the spi_init_t and initialize the associated handle. More...
hal_status_t | hal_spi_deinit (spi_handle_t *p_spi)
| De-initialize the SPI peripheral. More...
void | hal_spi_msp_init (spi_handle_t *p_spi)
| Initialize the SPI MSP. More...
void | hal_spi_msp_deinit (spi_handle_t *p_spi)
| De-initialize the SPI MSP. More...
hal_status_t | hal_spi_v2_init (spi_handle_t *p_spi, uint32_t rx_sample_delay)
| Initialize the SPI according to the specified parameters in the spi_init_t and initialize the associated handle. More...
hal_status_t | hal_spi_v2_deinit (spi_handle_t *p_spi)
| De-initialize the SPI peripheral. More...
void | hal_spi_v2_msp_init (spi_handle_t *p_spi)
| Initialize the SPI MSP. More...
void | hal_spi_v2_msp_deinit (spi_handle_t *p_spi)
| De-initialize the SPI MSP. More...

## Detailed Description

Initialization and de-initialization functions.

     ===============================================================================
                  ##### Initialization and de-initialization functions #####
     ===============================================================================
        [..]  This subsection provides a set of functions allowing to initialize and
              de-initialize the SPIx peripheral:

          (+) User must implement hal_spi_msp_init() function in which he configures
              all related peripherals resources (GPIO, DMA, IT and NVIC ).

          (+) Call the function hal_spi_init() to configure the selected device with
              the selected configuration:
            (++) Direction
            (++) Data Size
            (++) Clock Polarity and Phase
            (++) BaudRate Prescaler
            (++) TIMode
            (++) Slave Select

          (+) Call the function hal_spi_deinit() to restore the default configuration
              of the selected SPIx peripheral.

## Function Documentation

## ◆ hal_spi_deinit()

hal_status_t hal_spi_deinit | ( | spi_handle_t * | p_spi | ) |

De-initialize the SPI peripheral.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_spi_init()

hal_status_t hal_spi_init | ( | spi_handle_t * | p_spi | ) |

Initialize the SPI according to the specified parameters in the spi_init_t and initialize the associated handle.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_spi_msp_deinit()

void hal_spi_msp_deinit | ( | spi_handle_t * | p_spi | ) |

De-initialize the SPI MSP.

Note
  This function should not be modified. When the callback is needed, the hal_spi_msp_deinit can be implemented in the user file.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.

## ◆ hal_spi_msp_init()

void hal_spi_msp_init | ( | spi_handle_t * | p_spi | ) |

Initialize the SPI MSP.

Note
  This function should not be modified. When the callback is needed, the hal_spi_msp_deinit can be implemented in the user file.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.

## ◆ hal_spi_v2_deinit()

hal_status_t hal_spi_v2_deinit | ( | spi_handle_t * | p_spi | ) |

De-initialize the SPI peripheral.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_spi_v2_init()

hal_status_t hal_spi_v2_init | ( | spi_handle_t * | p_spi,
|  | uint32_t | rx_sample_delay
| ) |  |

Initialize the SPI according to the specified parameters in the spi_init_t and initialize the associated handle.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.
  [in] | rx_sample_delay | Receive sample delay [0, 7]

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_spi_v2_msp_deinit()

void hal_spi_v2_msp_deinit | ( | spi_handle_t * | p_spi | ) |

De-initialize the SPI MSP.

Note
  This function should not be modified. When the callback is needed, the hal_spi_msp_deinit can be implemented in the user file.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.

## ◆ hal_spi_v2_msp_init()

void hal_spi_v2_msp_init | ( | spi_handle_t * | p_spi | ) |

Initialize the SPI MSP.

Note
  This function should not be modified. When the callback is needed, the hal_spi_msp_deinit can be implemented in the user file.

Parameters

  [in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module.