📄 stm8s_uart2.h
字号:
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the WordLengths
*/
#define IS_UART2_WORDLENGTH_OK(WordLength) \
(((WordLength) == UART2_WORDLENGTH_8D) || \
((WordLength) == UART2_WORDLENGTH_9D))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the SyncModes; it should exclude values such as UART2_CLOCK_ENABLE|UART2_CLOCK_DISABLE
* UART2_SyncMode value should exclude values such as UART2_CLOCK_ENABLE|UART2_CLOCK_DISABLE
*/
#define IS_UART2_SYNCMODE_OK(SyncMode) \
(!((((SyncMode)&(((u8)UART2_SYNCMODE_CLOCK_ENABLE)|((u8)UART2_SYNCMODE_CLOCK_DISABLE))) == (((u8)UART2_SYNCMODE_CLOCK_ENABLE)|((u8)UART2_SYNCMODE_CLOCK_DISABLE))) || \
(((SyncMode)&(((u8)UART2_SYNCMODE_CPOL_LOW )|((u8)UART2_SYNCMODE_CPOL_HIGH))) == (((u8)UART2_SYNCMODE_CPOL_LOW )|((u8)UART2_SYNCMODE_CPOL_HIGH))) || \
(((SyncMode)&(((u8)UART2_SYNCMODE_CPHA_MIDDLE)|((u8)UART2_SYNCMODE_CPHA_BEGINING))) == (((u8)UART2_SYNCMODE_CPHA_MIDDLE)|((u8)UART2_SYNCMODE_CPHA_BEGINING))) || \
(((SyncMode)&(((u8)UART2_SYNCMODE_LASTBIT_DISABLE)|((u8)UART2_SYNCMODE_LASTBIT_ENABLE))) == (((u8)UART2_SYNCMODE_LASTBIT_DISABLE)|((u8)UART2_SYNCMODE_LASTBIT_ENABLE)))))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the FLAGs
*/
#define IS_UART2_FLAG_OK(Flag) \
(((Flag) == UART2_FLAG_TXE) || \
((Flag) == UART2_FLAG_TC) || \
((Flag) == UART2_FLAG_RXNE) || \
((Flag) == UART2_FLAG_IDLE) || \
((Flag) == UART2_FLAG_OR_LHE) || \
((Flag) == UART2_FLAG_NF) || \
((Flag) == UART2_FLAG_FE) || \
((Flag) == UART2_FLAG_PE) || \
((Flag) == UART2_FLAG_SBK) || \
((Flag) == UART2_FLAG_LSF) || \
((Flag) == UART2_FLAG_LHDF) || \
((Flag) == UART2_FLAG_LBDF))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the FLAGs that can be cleared by writing 0
*/
#define IS_UART2_CLEAR_FLAG_OK(Flag) \
(((Flag) == UART2_FLAG_RXNE) || \
((Flag) == UART2_FLAG_LHDF) || \
((Flag) == UART2_FLAG_LSF) || \
((Flag) == UART2_FLAG_LBDF))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the Interrupts
*/
#define IS_UART2_CONFIG_IT_OK(Interrupt) \
(((Interrupt) == UART2_IT_PE) || \
((Interrupt) == UART2_IT_TXE) || \
((Interrupt) == UART2_IT_TC) || \
((Interrupt) == UART2_IT_RXNE_OR ) || \
((Interrupt) == UART2_IT_IDLE) || \
((Interrupt) == UART2_IT_LHDF) || \
((Interrupt) == UART2_IT_LBDF))
/**
* @brief Macro used by the assert function in order to check the different sensitivity values for the pending bit
*/
#define IS_UART2_GET_IT_OK(ITPendingBit) \
(((ITPendingBit) == UART2_IT_TXE) || \
((ITPendingBit) == UART2_IT_TC) || \
((ITPendingBit) == UART2_IT_RXNE) || \
((ITPendingBit) == UART2_IT_IDLE) || \
((ITPendingBit) == UART2_IT_OR) || \
((ITPendingBit) == UART2_IT_LBDF) || \
((ITPendingBit) == UART2_IT_LHDF) || \
((ITPendingBit) == UART2_IT_PE))
/**
* @brief Macro used by the assert function in order to check the different sensitivity values for the pending bit that can be cleared by writing 0
*/
#define IS_UART2_CLEAR_IT_OK(ITPendingBit) \
(((ITPendingBit) == UART2_IT_RXNE) || \
((ITPendingBit) == UART2_IT_LHDF) || \
((ITPendingBit) == UART2_IT_LBDF))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the IrDAModes
*/
#define IS_UART2_IRDAMODE_OK(IrDAMode) \
(((IrDAMode) == UART2_IRDAMODE_LOWPOWER) || \
((IrDAMode) == UART2_IRDAMODE_NORMAL))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the WakeUps
*/
#define IS_UART2_WAKEUP_OK(WakeUp) \
(((WakeUp) == UART2_WAKEUP_IDLELINE) || \
((WakeUp) == UART2_WAKEUP_ADDRESSMARK))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the LINBreakDetectionLengths
*/
#define IS_UART2_LINBREAKDETECTIONLENGTH_OK(LINBreakDetectionLength) \
(((LINBreakDetectionLength) == UART2_LINBREAKDETECTIONLENGTH_10BITS) || \
((LINBreakDetectionLength) == UART2_LINBREAKDETECTIONLENGTH_11BITS))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the UART2_StopBits
*/
#define IS_UART2_STOPBITS_OK(StopBit) (((StopBit) == UART2_STOPBITS_1) || \
((StopBit) == UART2_STOPBITS_0_5) || \
((StopBit) == UART2_STOPBITS_2) || \
((StopBit) == UART2_STOPBITS_1_5 ))
/**
* @brief Macro used by the assert_param function in order to check the different sensitivity values for the Paritys
*/
#define IS_UART2_PARITY_OK(Parity) (((Parity) == UART2_PARITY_NO) || \
((Parity) == UART2_PARITY_EVEN) || \
((Parity) == UART2_PARITY_ODD ))
/**
* @brief Macro used by the assert_param function in order to check the maximum baudrate value
*/
#define IS_UART2_BAUDRATE_OK(NUM) ((NUM) <= (u32)625000)
/**
* @brief Macro used by the assert_param function in order to check the address of the UART2 or UART node
*/
#define UART2_ADDRESS_MAX ((u8)16)
#define IS_UART2_ADDRESS_OK(node) ((node) < UART2_ADDRESS_MAX )
/**
* @brief Macro used by the assert_param function in order to check the LIN mode
*/
#define IS_UART2_SLAVE_OK(Mode) \
(((Mode) == UART2_LIN_MODE_MASTER) || \
((Mode) == UART2_LIN_MODE_SLAVE))
/**
* @brief Macro used by the assert_param function in order to check the LIN automatic resynchronization mode
*/
#define IS_UART2_AUTOSYNC_OK(AutosyncMode) \
(((AutosyncMode) == UART2_LIN_AUTOSYNC_ENABLE) || \
((AutosyncMode) == UART2_LIN_AUTOSYNC_DISABLE))
/**
* @brief Macro used by the assert_param function in order to check the LIN divider update method
*/
#define IS_UART2_DIVUP_OK(DivupMethode) \
(((DivupMethode) == UART2_LIN_DIVUP_LBRR1) || \
((DivupMethode) == UART2_LIN_DIVUP_NEXTRXNE))
/**
* @}
*/
/* Exported functions ------------------------------------------------------- */
/** @addtogroup UART2_Exported_Functions
* @{
*/
void UART2_DeInit(void);
void UART2_Init(u32 BaudRate, UART2_WordLength_TypeDef WordLength, UART2_StopBits_TypeDef StopBits, UART2_Parity_TypeDef Parity, UART2_SyncMode_TypeDef SyncMode, UART2_Mode_TypeDef Mode);
void UART2_Cmd(FunctionalState NewState);
void UART2_ITConfig(UART2_IT_TypeDef UART2_IT, FunctionalState NewState);
void UART2_HalfDuplexCmd(FunctionalState NewState);
void UART2_IrDAConfig(UART2_IrDAMode_TypeDef UART2_IrDAMode);
void UART2_IrDACmd(FunctionalState NewState);
void UART2_LINBreakDetectionConfig(UART2_LINBreakDetectionLength_TypeDef UART2_LINBreakDetectionLength);
void UART2_LINConfig(UART2_LinMode_TypeDef UART2_Mode, UART2_LinAutosync_TypeDef UART2_Autosync, UART2_LinDivUp_TypeDef UART2_DivUp);
void UART2_LINCmd(FunctionalState NewState);
void UART2_SmartCardCmd(FunctionalState NewState);
void UART2_SmartCardNACKCmd(FunctionalState NewState);
void UART2_WakeUpConfig(UART2_WakeUp_TypeDef UART2_WakeUp);
void UART2_ReceiverWakeUpCmd(FunctionalState NewState);
u8 UART2_ReceiveData8(void);
u16 UART2_ReceiveData9(void);
void UART2_SendData8(u8 Data);
void UART2_SendData9(u16 Data);
void UART2_SendBreak(void);
void UART2_SetAddress(u8 UART2_Address);
void UART2_SetGuardTime(u8 UART2_GuardTime);
void UART2_SetPrescaler(u8 UART2_Prescaler);
FlagStatus UART2_GetFlagStatus(UART2_Flag_TypeDef UART2_FLAG);
void UART2_ClearFlag(UART2_Flag_TypeDef UART2_FLAG);
ITStatus UART2_GetITStatus(UART2_IT_TypeDef UART2_IT);
void UART2_ClearITPendingBit(UART2_IT_TypeDef UART2_IT);
/**
* @}
*/
#endif /* __STM8S_UART2_H */
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -