STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
SPI Private Macros
Collaboration diagram for SPI Private Macros:

Macros

#define SPI_1LINE_TX(__HANDLE__)
 Set the SPI transmit-only mode.
 
#define SPI_1LINE_RX(__HANDLE__)
 Set the SPI receive-only mode.
 
#define SPI_RESET_CRC(__HANDLE__)
 Reset the CRC calculation of the SPI.
 
#define SPI_CHECK_FLAG(__SR__, __FLAG__)
 Check whether the specified SPI flag is set or not.
 
#define SPI_CHECK_IT_SOURCE(__CR2__, __INTERRUPT__)
 Check whether the specified SPI Interrupt is set or not.
 
#define IS_SPI_MODE(__MODE__)
 Checks if SPI Mode parameter is in allowed range.
 
#define IS_SPI_DIRECTION(__MODE__)
 Checks if SPI Direction Mode parameter is in allowed range.
 
#define IS_SPI_DIRECTION_2LINES(__MODE__)
 Checks if SPI Direction Mode parameter is 2 lines.
 
#define IS_SPI_DIRECTION_2LINES_OR_1LINE(__MODE__)
 Checks if SPI Direction Mode parameter is 1 or 2 lines.
 
#define IS_SPI_DATASIZE(__DATASIZE__)
 Checks if SPI Data Size parameter is in allowed range.
 
#define IS_SPI_CPOL(__CPOL__)
 Checks if SPI Serial clock steady state parameter is in allowed range.
 
#define IS_SPI_CPHA(__CPHA__)
 Checks if SPI Clock Phase parameter is in allowed range.
 
#define IS_SPI_NSS(__NSS__)
 Checks if SPI Slave Select parameter is in allowed range.
 
#define IS_SPI_BAUDRATE_PRESCALER(__PRESCALER__)
 Checks if SPI Baudrate prescaler parameter is in allowed range.
 
#define IS_SPI_FIRST_BIT(__BIT__)
 Checks if SPI MSB LSB transmission parameter is in allowed range.
 
#define IS_SPI_TIMODE(__MODE__)
 Checks if SPI TI mode parameter is in allowed range.
 
#define IS_SPI_CRC_CALCULATION(__CALCULATION__)
 Checks if SPI CRC calculation enabled state is in allowed range.
 
#define IS_SPI_CRC_POLYNOMIAL(__POLYNOMIAL__)
 Checks if SPI polynomial value to be used for the CRC calculation, is in allowed range.
 
#define IS_SPI_DMA_HANDLE(__HANDLE__)
 Checks if DMA handle is valid.
 

Detailed Description

Macro Definition Documentation

◆ SPI_1LINE_TX

#define SPI_1LINE_TX ( __HANDLE__)

#include <stm32f4xx_hal_spi.h>

Value:
SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)

Set the SPI transmit-only mode.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
Return values
None

Definition at line 477 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Transmit(), HAL_SPI_Transmit_DMA(), and HAL_SPI_Transmit_IT().

◆ SPI_1LINE_RX

#define SPI_1LINE_RX ( __HANDLE__)

#include <stm32f4xx_hal_spi.h>

Value:
CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)

Set the SPI receive-only mode.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
Return values
None

Definition at line 484 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Receive(), HAL_SPI_Receive_DMA(), and HAL_SPI_Receive_IT().

◆ SPI_RESET_CRC

#define SPI_RESET_CRC ( __HANDLE__)

#include <stm32f4xx_hal_spi.h>

Value:
do{CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);\
SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);}while(0U)

Reset the CRC calculation of the SPI.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
Return values
None

Definition at line 491 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Receive(), HAL_SPI_Receive_DMA(), HAL_SPI_Receive_IT(), HAL_SPI_Transmit(), HAL_SPI_Transmit_DMA(), HAL_SPI_Transmit_IT(), HAL_SPI_TransmitReceive(), HAL_SPI_TransmitReceive_DMA(), HAL_SPI_TransmitReceive_IT(), and SPI_WaitFlagStateUntilTimeout().

◆ SPI_CHECK_FLAG

#define SPI_CHECK_FLAG ( __SR__,
__FLAG__ )

#include <stm32f4xx_hal_spi.h>

Value:
((((__SR__) & ((__FLAG__) & SPI_FLAG_MASK)) == \
((__FLAG__) & SPI_FLAG_MASK)) ? SET : RESET)
#define SPI_FLAG_MASK

Check whether the specified SPI flag is set or not.

Parameters
__SR__copy of SPI SR register.
__FLAG__specifies the flag to check. This parameter can be one of the following values:
  • SPI_FLAG_RXNE: Receive buffer not empty flag
  • SPI_FLAG_TXE: Transmit buffer empty flag
  • SPI_FLAG_CRCERR: CRC error flag
  • SPI_FLAG_MODF: Mode fault flag
  • SPI_FLAG_OVR: Overrun flag
  • SPI_FLAG_BSY: Busy flag
  • SPI_FLAG_FRE: Frame format error flag
Return values
SETor RESET.

Definition at line 507 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_IRQHandler().

◆ SPI_CHECK_IT_SOURCE

#define SPI_CHECK_IT_SOURCE ( __CR2__,
__INTERRUPT__ )

#include <stm32f4xx_hal_spi.h>

Value:
((((__CR2__) & (__INTERRUPT__)) == \
(__INTERRUPT__)) ? SET : RESET)

Check whether the specified SPI Interrupt is set or not.

Parameters
__CR2__copy of SPI CR2 register.
__INTERRUPT__specifies the SPI interrupt source to check. This parameter can be one of the following values:
  • SPI_IT_TXE: Tx buffer empty interrupt enable
  • SPI_IT_RXNE: RX buffer not empty interrupt enable
  • SPI_IT_ERR: Error interrupt enable
Return values
SETor RESET.

Definition at line 519 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_IRQHandler().

◆ IS_SPI_MODE

#define IS_SPI_MODE ( __MODE__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__MODE__) == SPI_MODE_SLAVE) || \
((__MODE__) == SPI_MODE_MASTER))
#define SPI_MODE_SLAVE
#define SPI_MODE_MASTER

Checks if SPI Mode parameter is in allowed range.

Parameters
__MODE__specifies the SPI Mode. This parameter can be a value of SPI Mode
Return values
None

Definition at line 527 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_DIRECTION

#define IS_SPI_DIRECTION ( __MODE__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__MODE__) == SPI_DIRECTION_2LINES) || \
((__MODE__) == SPI_DIRECTION_2LINES_RXONLY) || \
((__MODE__) == SPI_DIRECTION_1LINE))
#define SPI_DIRECTION_2LINES_RXONLY
#define SPI_DIRECTION_2LINES
#define SPI_DIRECTION_1LINE

Checks if SPI Direction Mode parameter is in allowed range.

Parameters
__MODE__specifies the SPI Direction Mode. This parameter can be a value of SPI Direction Mode
Return values
None

Definition at line 535 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_DIRECTION_2LINES

#define IS_SPI_DIRECTION_2LINES ( __MODE__)

#include <stm32f4xx_hal_spi.h>

Value:
((__MODE__) == SPI_DIRECTION_2LINES)

Checks if SPI Direction Mode parameter is 2 lines.

Parameters
__MODE__specifies the SPI Direction Mode.
Return values
None

Definition at line 543 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_TransmitReceive(), HAL_SPI_TransmitReceive_DMA(), and HAL_SPI_TransmitReceive_IT().

◆ IS_SPI_DIRECTION_2LINES_OR_1LINE

#define IS_SPI_DIRECTION_2LINES_OR_1LINE ( __MODE__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__MODE__) == SPI_DIRECTION_2LINES) || \
((__MODE__) == SPI_DIRECTION_1LINE))

Checks if SPI Direction Mode parameter is 1 or 2 lines.

Parameters
__MODE__specifies the SPI Direction Mode.
Return values
None

Definition at line 549 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Transmit(), HAL_SPI_Transmit_DMA(), and HAL_SPI_Transmit_IT().

◆ IS_SPI_DATASIZE

#define IS_SPI_DATASIZE ( __DATASIZE__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__DATASIZE__) == SPI_DATASIZE_16BIT) || \
((__DATASIZE__) == SPI_DATASIZE_8BIT))
#define SPI_DATASIZE_8BIT
#define SPI_DATASIZE_16BIT

Checks if SPI Data Size parameter is in allowed range.

Parameters
__DATASIZE__specifies the SPI Data Size. This parameter can be a value of SPI Data Size
Return values
None

Definition at line 557 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_CPOL

#define IS_SPI_CPOL ( __CPOL__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__CPOL__) == SPI_POLARITY_LOW) || \
((__CPOL__) == SPI_POLARITY_HIGH))
#define SPI_POLARITY_HIGH
#define SPI_POLARITY_LOW

Checks if SPI Serial clock steady state parameter is in allowed range.

Parameters
__CPOL__specifies the SPI serial clock steady state. This parameter can be a value of SPI Clock Polarity
Return values
None

Definition at line 565 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_CPHA

#define IS_SPI_CPHA ( __CPHA__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__CPHA__) == SPI_PHASE_1EDGE) || \
((__CPHA__) == SPI_PHASE_2EDGE))
#define SPI_PHASE_1EDGE
#define SPI_PHASE_2EDGE

Checks if SPI Clock Phase parameter is in allowed range.

Parameters
__CPHA__specifies the SPI Clock Phase. This parameter can be a value of SPI Clock Phase
Return values
None

Definition at line 573 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_NSS

#define IS_SPI_NSS ( __NSS__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__NSS__) == SPI_NSS_SOFT) || \
((__NSS__) == SPI_NSS_HARD_INPUT) || \
((__NSS__) == SPI_NSS_HARD_OUTPUT))
#define SPI_NSS_SOFT
#define SPI_NSS_HARD_INPUT
#define SPI_NSS_HARD_OUTPUT

Checks if SPI Slave Select parameter is in allowed range.

Parameters
__NSS__specifies the SPI Slave Select management parameter. This parameter can be a value of SPI Slave Select Management
Return values
None

Definition at line 581 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_BAUDRATE_PRESCALER

#define IS_SPI_BAUDRATE_PRESCALER ( __PRESCALER__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__PRESCALER__) == SPI_BAUDRATEPRESCALER_2) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_4) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_8) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_16) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_32) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_64) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_128) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_256))
#define SPI_BAUDRATEPRESCALER_8
#define SPI_BAUDRATEPRESCALER_2
#define SPI_BAUDRATEPRESCALER_256
#define SPI_BAUDRATEPRESCALER_32
#define SPI_BAUDRATEPRESCALER_64
#define SPI_BAUDRATEPRESCALER_4
#define SPI_BAUDRATEPRESCALER_128
#define SPI_BAUDRATEPRESCALER_16

Checks if SPI Baudrate prescaler parameter is in allowed range.

Parameters
__PRESCALER__specifies the SPI Baudrate prescaler. This parameter can be a value of SPI BaudRate Prescaler
Return values
None

Definition at line 590 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_FIRST_BIT

#define IS_SPI_FIRST_BIT ( __BIT__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__BIT__) == SPI_FIRSTBIT_MSB) || \
((__BIT__) == SPI_FIRSTBIT_LSB))
#define SPI_FIRSTBIT_MSB
#define SPI_FIRSTBIT_LSB

Checks if SPI MSB LSB transmission parameter is in allowed range.

Parameters
__BIT__specifies the SPI MSB LSB transmission (whether data transfer starts from MSB or LSB bit). This parameter can be a value of SPI MSB LSB Transmission
Return values
None

Definition at line 604 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_TIMODE

#define IS_SPI_TIMODE ( __MODE__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__MODE__) == SPI_TIMODE_DISABLE) || \
((__MODE__) == SPI_TIMODE_ENABLE))
#define SPI_TIMODE_ENABLE
#define SPI_TIMODE_DISABLE

Checks if SPI TI mode parameter is in allowed range.

Parameters
__MODE__specifies the SPI TI mode. This parameter can be a value of SPI TI Mode
Return values
None

Definition at line 612 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_CRC_CALCULATION

#define IS_SPI_CRC_CALCULATION ( __CALCULATION__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__CALCULATION__) == SPI_CRCCALCULATION_DISABLE) || \
((__CALCULATION__) == SPI_CRCCALCULATION_ENABLE))
#define SPI_CRCCALCULATION_ENABLE
#define SPI_CRCCALCULATION_DISABLE

Checks if SPI CRC calculation enabled state is in allowed range.

Parameters
__CALCULATION__specifies the SPI CRC calculation enable state. This parameter can be a value of SPI CRC Calculation
Return values
None

Definition at line 620 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_CRC_POLYNOMIAL

#define IS_SPI_CRC_POLYNOMIAL ( __POLYNOMIAL__)

#include <stm32f4xx_hal_spi.h>

Value:
(((__POLYNOMIAL__) >= 0x1U) && \
((__POLYNOMIAL__) <= 0xFFFFU) && \
(((__POLYNOMIAL__)&0x1U) != 0U))

Checks if SPI polynomial value to be used for the CRC calculation, is in allowed range.

Parameters
__POLYNOMIAL__specifies the SPI polynomial value to be used for the CRC calculation. This parameter must be a number between Min_Data = 0 and Max_Data = 65535
Return values
None

Definition at line 628 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Init().

◆ IS_SPI_DMA_HANDLE

#define IS_SPI_DMA_HANDLE ( __HANDLE__)

#include <stm32f4xx_hal_spi.h>

Value:
((__HANDLE__) != NULL)

Checks if DMA handle is valid.

Parameters
__HANDLE__specifies a DMA Handle.
Return values
None

Definition at line 636 of file stm32f4xx_hal_spi.h.

Referenced by HAL_SPI_Receive_DMA(), HAL_SPI_Transmit_DMA(), and HAL_SPI_TransmitReceive_DMA().