思澈科技软件开发工具包  2.20
SPI Exported Macros

Macros

#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
 Reset SPI handle state. More...
 
#define __HAL_SPI_IS_ENABLE_IT(__HANDLE__, __INTERRUPT__)   HAL_IS_BIT_SET((__HANDLE__)->Instance->INTE, (__INTERRUPT__))
 Return true if the specified SPI interrupts is enabled. More...
 
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__)
 Enable the specified SPI interrupts. More...
 
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__)
 Disable the specified SPI interrupts. More...
 
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   ((((__HANDLE__)->Instance->CR1 & (__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->STATUS) & (__FLAG__)) == (__FLAG__))
 Check whether the specified SPI flag is set or not. 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_CLEAR_UDRFLAG(__HANDLE__)
 Clear the SPI UDR pending flag. More...
 
#define __HAL_SPI_CLEAR_EXT_ERR_FLAG(__HANDLE__)
 Clear the SPI extend error flag. More...
 
#define __HAL_SPI_ENABLE(__HANDLE__)   SET_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_SSE)
 Enable the SPI peripheral. More...
 
#define __HAL_SPI_DISABLE(__HANDLE__)   CLEAR_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_SSE)
 Disable the SPI peripheral. More...
 
#define __HAL_SPI_TAKE_CS(__HANDLE__)   SET_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_HOLD_FRAME_LOW)
 Take SPI CS (to low). More...
 
#define __HAL_SPI_RELEASE_CS(__HANDLE__)   CLEAR_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_HOLD_FRAME_LOW)
 Release SPI CS (to high). More...
 
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__)
 Clear the SPI MODF pending flag. More...
 

Detailed Description

SPI_Exported_Constants

Macro Definition Documentation

◆ __HAL_SPI_CLEAR_EXT_ERR_FLAG

#define __HAL_SPI_CLEAR_EXT_ERR_FLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg_ovr = 0x00U; \
(__HANDLE__)->Instance->STATUS = SPI_FLAG_EXT; \
UNUSED(tmpreg_ovr); \
} while(0U)

Clear the SPI extend error flag.

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

◆ __HAL_SPI_CLEAR_FREFLAG

#define __HAL_SPI_CLEAR_FREFLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg_fre = 0x00U; \
UNUSED(tmpreg_fre); \
}while(0U)

Clear the SPI FRE pending flag.

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

◆ __HAL_SPI_CLEAR_MODFFLAG

#define __HAL_SPI_CLEAR_MODFFLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg_modf = 0x00U; \
tmpreg_modf = (__HANDLE__)->Instance->SR; \
CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE); \
UNUSED(tmpreg_modf); \
} while(0U)

Clear the SPI MODF pending flag.

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

◆ __HAL_SPI_CLEAR_OVRFLAG

#define __HAL_SPI_CLEAR_OVRFLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg_ovr = 0x00U; \
tmpreg_ovr = (__HANDLE__)->Instance->DATA; \
(__HANDLE__)->Instance->STATUS = SPI_FLAG_OVR; \
UNUSED(tmpreg_ovr); \
} while(0U)

Clear the SPI OVR pending flag.

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

◆ __HAL_SPI_CLEAR_UDRFLAG

#define __HAL_SPI_CLEAR_UDRFLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg_ovr = 0x00U; \
(__HANDLE__)->Instance->STATUS = SPI_FLAG_UDR; \
UNUSED(tmpreg_ovr); \
} while(0U)

Clear the SPI UDR pending flag.

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

◆ __HAL_SPI_DISABLE

#define __HAL_SPI_DISABLE (   __HANDLE__)    CLEAR_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_SSE)

Disable the SPI peripheral.

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

◆ __HAL_SPI_DISABLE_IT

#define __HAL_SPI_DISABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)
Value:
do{__IO uint32_t tmpreg_ite = (__HANDLE__)->Instance->INTE;\
CLEAR_BIT(tmpreg_ite, (__INTERRUPT__));\
if(HAL_IS_BIT_SET((__INTERRUPT__),SPI_IT_ERR)){\
SET_BIT(tmpreg_ite, SPI_MSK_IT_ERR);}\
(__HANDLE__)->Instance->INTE = tmpreg_ite;\
}while(0)

Disable the specified SPI interrupts.

Parameters
__HANDLE__specifies the SPI handle. This parameter can be SPIx where x: 1, 2, or 3 to select the SPI peripheral.
__INTERRUPT__specifies the interrupt source to disable. 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
None

◆ __HAL_SPI_ENABLE

#define __HAL_SPI_ENABLE (   __HANDLE__)    SET_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_SSE)

Enable the SPI peripheral.

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

◆ __HAL_SPI_ENABLE_IT

#define __HAL_SPI_ENABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)
Value:
do{__IO uint32_t tmpreg_ite = (__HANDLE__)->Instance->INTE;\
SET_BIT(tmpreg_ite, (__INTERRUPT__));\
if(HAL_IS_BIT_SET((__INTERRUPT__),SPI_IT_ERR)){\
CLEAR_BIT(tmpreg_ite, SPI_MSK_IT_ERR);}\
(__HANDLE__)->Instance->INTE = tmpreg_ite;\
}while(0)

Enable the specified SPI interrupts.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
__INTERRUPT__specifies the interrupt source to enable. 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
None

◆ __HAL_SPI_GET_FLAG

#define __HAL_SPI_GET_FLAG (   __HANDLE__,
  __FLAG__ 
)    ((((__HANDLE__)->Instance->STATUS) & (__FLAG__)) == (__FLAG__))

Check whether the specified SPI flag is set or not.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
__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
  • SPI_FLAG_FTLVL: SPI fifo transmission level
  • SPI_FLAG_FRLVL: SPI fifo reception level
Return values
Thenew state of FLAG (TRUE or FALSE).

◆ __HAL_SPI_GET_IT_SOURCE

#define __HAL_SPI_GET_IT_SOURCE (   __HANDLE__,
  __INTERRUPT__ 
)    ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)

Check whether the specified SPI interrupt source is enabled or not.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
__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
Thenew state of IT (TRUE or FALSE).

◆ __HAL_SPI_IS_ENABLE_IT

#define __HAL_SPI_IS_ENABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)    HAL_IS_BIT_SET((__HANDLE__)->Instance->INTE, (__INTERRUPT__))

Return true if the specified SPI interrupts is enabled.

Parameters
__HANDLE__specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
__INTERRUPT__specifies the interrupt source to enable. 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
None

◆ __HAL_SPI_RELEASE_CS

#define __HAL_SPI_RELEASE_CS (   __HANDLE__)    CLEAR_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_HOLD_FRAME_LOW)

Release SPI CS (to high).

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

◆ __HAL_SPI_RESET_HANDLE_STATE

#define __HAL_SPI_RESET_HANDLE_STATE (   __HANDLE__)    ((__HANDLE__)->State = HAL_SPI_STATE_RESET)

Reset SPI handle state.

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

◆ __HAL_SPI_TAKE_CS

#define __HAL_SPI_TAKE_CS (   __HANDLE__)    SET_BIT((__HANDLE__)->Instance->TOP_CTRL, SPI_TOP_CTRL_HOLD_FRAME_LOW)

Take SPI CS (to low).

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