STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
Initialization and de-initialization functions

Initialization and Configuration functions. More...

Collaboration diagram for Initialization and de-initialization functions:

Functions

HAL_StatusTypeDef HAL_SPI_Init (SPI_HandleTypeDef *hspi)
 Initialize the SPI according to the specified parameters in the SPI_InitTypeDef and initialize the associated handle.
 
HAL_StatusTypeDef HAL_SPI_DeInit (SPI_HandleTypeDef *hspi)
 De-Initialize the SPI peripheral.
 
void HAL_SPI_MspInit (SPI_HandleTypeDef *hspi)
 Initialize the SPI MSP.
 
void HAL_SPI_MspDeInit (SPI_HandleTypeDef *hspi)
 De-Initialize the SPI MSP.
 

Detailed Description

Initialization and Configuration 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_MspInit() function in which he configures
          all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ).

      (+) Call the function HAL_SPI_Init() to configure the selected device with
          the selected configuration:
        (++) Mode
        (++) Direction
        (++) Data Size
        (++) Clock Polarity and Phase
        (++) NSS Management
        (++) BaudRate Prescaler
        (++) FirstBit
        (++) TIMode
        (++) CRC Calculation
        (++) CRC Polynomial if CRC enabled

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

Function Documentation

◆ HAL_SPI_Init()

HAL_StatusTypeDef HAL_SPI_Init ( SPI_HandleTypeDef * hspi)

#include <stm32f4xx_hal_spi.h>

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

Parameters
hspipointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module.
Return values
HALstatus

Definition at line 311 of file stm32f4xx_hal_spi.c.

References __HAL_SPI_DISABLE, assert_param, SPI_InitTypeDef::BaudRatePrescaler, SPI_InitTypeDef::CLKPhase, SPI_InitTypeDef::CLKPolarity, SPI_InitTypeDef::CRCCalculation, SPI_InitTypeDef::CRCPolynomial, SPI_InitTypeDef::DataSize, SPI_InitTypeDef::Direction, __SPI_HandleTypeDef::ErrorCode, SPI_InitTypeDef::FirstBit, HAL_ERROR, HAL_OK, HAL_SPI_AbortCpltCallback(), HAL_SPI_ERROR_NONE, HAL_SPI_ErrorCallback(), HAL_SPI_MspInit(), HAL_SPI_RxCpltCallback(), HAL_SPI_RxHalfCpltCallback(), HAL_SPI_STATE_BUSY, HAL_SPI_STATE_READY, HAL_SPI_STATE_RESET, HAL_SPI_TxCpltCallback(), HAL_SPI_TxHalfCpltCallback(), HAL_SPI_TxRxCpltCallback(), HAL_SPI_TxRxHalfCpltCallback(), HAL_UNLOCKED, __SPI_HandleTypeDef::Init, __SPI_HandleTypeDef::Instance, IS_SPI_BAUDRATE_PRESCALER, IS_SPI_CPHA, IS_SPI_CPOL, IS_SPI_CRC_CALCULATION, IS_SPI_CRC_POLYNOMIAL, IS_SPI_DATASIZE, IS_SPI_DIRECTION, IS_SPI_FIRST_BIT, IS_SPI_MODE, IS_SPI_NSS, IS_SPI_TIMODE, __SPI_HandleTypeDef::Lock, SPI_InitTypeDef::Mode, SPI_InitTypeDef::NSS, SPI_BAUDRATEPRESCALER_2, SPI_CRCCALCULATION_DISABLE, SPI_CRCCALCULATION_ENABLE, SPI_MODE_MASTER, SPI_PHASE_1EDGE, SPI_POLARITY_LOW, SPI_TIMODE_DISABLE, __SPI_HandleTypeDef::State, and SPI_InitTypeDef::TIMode.

◆ HAL_SPI_DeInit()

HAL_StatusTypeDef HAL_SPI_DeInit ( SPI_HandleTypeDef * hspi)

#include <stm32f4xx_hal_spi.h>

De-Initialize the SPI peripheral.

Parameters
hspipointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module.
Return values
HALstatus

Definition at line 437 of file stm32f4xx_hal_spi.c.

References __HAL_SPI_DISABLE, __HAL_UNLOCK, assert_param, __SPI_HandleTypeDef::ErrorCode, HAL_ERROR, HAL_OK, HAL_SPI_ERROR_NONE, HAL_SPI_MspDeInit(), HAL_SPI_STATE_BUSY, HAL_SPI_STATE_RESET, __SPI_HandleTypeDef::Instance, and __SPI_HandleTypeDef::State.

◆ HAL_SPI_MspInit()

__weak void HAL_SPI_MspInit ( SPI_HandleTypeDef * hspi)

#include <stm32f4xx_hal_spi.h>

Initialize the SPI MSP.

Parameters
hspipointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module.
Return values
None

Definition at line 481 of file stm32f4xx_hal_spi.c.

References UNUSED.

Referenced by HAL_SPI_Init().

◆ HAL_SPI_MspDeInit()

__weak void HAL_SPI_MspDeInit ( SPI_HandleTypeDef * hspi)

#include <stm32f4xx_hal_spi.h>

De-Initialize the SPI MSP.

Parameters
hspipointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module.
Return values
None

Definition at line 497 of file stm32f4xx_hal_spi.c.

References UNUSED.

Referenced by HAL_SPI_DeInit().