Prusa MINI Firmware overview
stm32f4xx_hal_spi.h File Reference

Header file of SPI HAL module. More...

Go to the source code of this file.

Classes

struct  SPI_InitTypeDef
 SPI Configuration Structure definition. More...
 
struct  __SPI_HandleTypeDef
 SPI handle Structure definition. More...
 

Macros

#define HAL_SPI_ERROR_NONE   0x00000000U
 
#define HAL_SPI_ERROR_MODF   0x00000001U
 
#define HAL_SPI_ERROR_CRC   0x00000002U
 
#define HAL_SPI_ERROR_OVR   0x00000004U
 
#define HAL_SPI_ERROR_FRE   0x00000008U
 
#define HAL_SPI_ERROR_DMA   0x00000010U
 
#define HAL_SPI_ERROR_FLAG   0x00000020U
 
#define SPI_MODE_SLAVE   0x00000000U
 
#define SPI_MODE_MASTER   (SPI_CR1_MSTR | SPI_CR1_SSI)
 
#define SPI_DIRECTION_2LINES   0x00000000U
 
#define SPI_DIRECTION_2LINES_RXONLY   SPI_CR1_RXONLY
 
#define SPI_DIRECTION_1LINE   SPI_CR1_BIDIMODE
 
#define SPI_DATASIZE_8BIT   0x00000000U
 
#define SPI_DATASIZE_16BIT   SPI_CR1_DFF
 
#define SPI_POLARITY_LOW   0x00000000U
 
#define SPI_POLARITY_HIGH   SPI_CR1_CPOL
 
#define SPI_PHASE_1EDGE   0x00000000U
 
#define SPI_PHASE_2EDGE   SPI_CR1_CPHA
 
#define SPI_NSS_SOFT   SPI_CR1_SSM
 
#define SPI_NSS_HARD_INPUT   0x00000000U
 
#define SPI_NSS_HARD_OUTPUT   0x00040000U
 
#define SPI_BAUDRATEPRESCALER_2   0x00000000U
 
#define SPI_BAUDRATEPRESCALER_4   0x00000008U
 
#define SPI_BAUDRATEPRESCALER_8   0x00000010U
 
#define SPI_BAUDRATEPRESCALER_16   0x00000018U
 
#define SPI_BAUDRATEPRESCALER_32   0x00000020U
 
#define SPI_BAUDRATEPRESCALER_64   0x00000028U
 
#define SPI_BAUDRATEPRESCALER_128   0x00000030U
 
#define SPI_BAUDRATEPRESCALER_256   0x00000038U
 
#define SPI_FIRSTBIT_MSB   0x00000000U
 
#define SPI_FIRSTBIT_LSB   SPI_CR1_LSBFIRST
 
#define SPI_TIMODE_DISABLE   0x00000000U
 
#define SPI_TIMODE_ENABLE   SPI_CR2_FRF
 
#define SPI_CRCCALCULATION_DISABLE   0x00000000U
 
#define SPI_CRCCALCULATION_ENABLE   SPI_CR1_CRCEN
 
#define SPI_IT_TXE   SPI_CR2_TXEIE
 
#define SPI_IT_RXNE   SPI_CR2_RXNEIE
 
#define SPI_IT_ERR   SPI_CR2_ERRIE
 
#define SPI_FLAG_RXNE   SPI_SR_RXNE /* SPI status flag: Rx buffer not empty flag */
 
#define SPI_FLAG_TXE   SPI_SR_TXE /* SPI status flag: Tx buffer empty flag */
 
#define SPI_FLAG_BSY   SPI_SR_BSY /* SPI status flag: Busy flag */
 
#define SPI_FLAG_CRCERR   SPI_SR_CRCERR /* SPI Error flag: CRC error flag */
 
#define SPI_FLAG_MODF   SPI_SR_MODF /* SPI Error flag: Mode fault flag */
 
#define SPI_FLAG_OVR   SPI_SR_OVR /* SPI Error flag: Overrun flag */
 
#define SPI_FLAG_FRE   SPI_SR_FRE /* SPI Error flag: TI mode frame format error flag */
 
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
 Reset SPI handle state. More...
 
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
 Enable or disable the specified SPI interrupts. More...
 
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
 
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
 Check whether the specified SPI interrupt source is enabled or not. More...
 
#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__)   ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
 Check whether the specified SPI flag is set or not. More...
 
#define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__)   ((__HANDLE__)->Instance->SR = (uint16_t)(~SPI_FLAG_CRCERR))
 Clear the SPI CRCERR pending flag. More...
 
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__)
 Clear the SPI MODF pending flag. More...
 
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__)
 Clear the SPI OVR pending flag. More...
 
#define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__)
 Clear the SPI FRE pending flag. More...
 
#define __HAL_SPI_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 |= SPI_CR1_SPE)
 Enable the SPI peripheral. More...
 
#define __HAL_SPI_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE))
 Disable the SPI peripheral. More...
 
#define SPI_1LINE_TX(__HANDLE__)   ((__HANDLE__)->Instance->CR1 |= SPI_CR1_BIDIOE)
 Set the SPI transmit-only mode. More...
 
#define SPI_1LINE_RX(__HANDLE__)   ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_BIDIOE))
 Set the SPI receive-only mode. More...
 
#define SPI_RESET_CRC(__HANDLE__)
 Reset the CRC calculation of the SPI. More...
 
#define IS_SPI_MODE(MODE)
 
#define IS_SPI_DIRECTION(MODE)
 
#define IS_SPI_DIRECTION_2LINES(MODE)   ((MODE) == SPI_DIRECTION_2LINES)
 
#define IS_SPI_DIRECTION_2LINES_OR_1LINE(MODE)
 
#define IS_SPI_DATASIZE(DATASIZE)
 
#define IS_SPI_CPOL(CPOL)
 
#define IS_SPI_CPHA(CPHA)
 
#define IS_SPI_NSS(NSS)
 
#define IS_SPI_BAUDRATE_PRESCALER(PRESCALER)
 
#define IS_SPI_FIRST_BIT(BIT)
 
#define IS_SPI_TIMODE(MODE)
 
#define IS_SPI_CRC_CALCULATION(CALCULATION)
 
#define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL)   (((POLYNOMIAL) >= 0x01U) && ((POLYNOMIAL) <= 0xFFFFU))
 

Typedefs

typedef struct __SPI_HandleTypeDef SPI_HandleTypeDef
 SPI handle Structure definition. More...
 

Enumerations

enum  HAL_SPI_StateTypeDef {
  HAL_SPI_STATE_RESET = 0x00U, HAL_SPI_STATE_READY = 0x01U, HAL_SPI_STATE_BUSY = 0x02U, HAL_SPI_STATE_BUSY_TX = 0x03U,
  HAL_SPI_STATE_BUSY_RX = 0x04U, HAL_SPI_STATE_BUSY_TX_RX = 0x05U, HAL_SPI_STATE_ERROR = 0x06U
}
 HAL SPI State structure definition. More...
 

Functions

HAL_StatusTypeDef HAL_SPI_Init (SPI_HandleTypeDef *hspi)
 
HAL_StatusTypeDef HAL_SPI_DeInit (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_MspInit (SPI_HandleTypeDef *hspi)
 SPI MSP Initialization This function configures the hardware resources used in this example. More...
 
void HAL_SPI_MspDeInit (SPI_HandleTypeDef *hspi)
 SPI MSP De-Initialization This function freeze the hardware resources used in this example. More...
 
HAL_StatusTypeDef HAL_SPI_Transmit (SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 
HAL_StatusTypeDef HAL_SPI_Receive (SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 
HAL_StatusTypeDef HAL_SPI_TransmitReceive (SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
 
HAL_StatusTypeDef HAL_SPI_Transmit_IT (SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_SPI_Receive_IT (SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT (SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
 
HAL_StatusTypeDef HAL_SPI_Transmit_DMA (SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_SPI_Receive_DMA (SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA (SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
 
HAL_StatusTypeDef HAL_SPI_DMAPause (SPI_HandleTypeDef *hspi)
 
HAL_StatusTypeDef HAL_SPI_DMAResume (SPI_HandleTypeDef *hspi)
 
HAL_StatusTypeDef HAL_SPI_DMAStop (SPI_HandleTypeDef *hspi)
 
HAL_StatusTypeDef HAL_SPI_Abort (SPI_HandleTypeDef *hspi)
 
HAL_StatusTypeDef HAL_SPI_Abort_IT (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_IRQHandler (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_TxCpltCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_RxCpltCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_TxRxCpltCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_TxHalfCpltCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_RxHalfCpltCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_TxRxHalfCpltCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_ErrorCallback (SPI_HandleTypeDef *hspi)
 
void HAL_SPI_AbortCpltCallback (SPI_HandleTypeDef *hspi)
 
HAL_SPI_StateTypeDef HAL_SPI_GetState (SPI_HandleTypeDef *hspi)
 
uint32_t HAL_SPI_GetError (SPI_HandleTypeDef *hspi)
 

Detailed Description

Header file of SPI HAL module.

Author
MCD Application Team
Attention

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.