⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm8s_uart1.h

📁 STM8s
💻 H
📖 第 1 页 / 共 2 页
字号:
 * possible combination should be one of the following
 */
#define IS_UART1_MODE_OK(Mode) \
  (((Mode) == (u8)UART1_MODE_RX_ENABLE) || \
   ((Mode) == (u8)UART1_MODE_RX_DISABLE) || \
   ((Mode) == (u8)UART1_MODE_TX_ENABLE) || \
   ((Mode) == (u8)UART1_MODE_TX_DISABLE) || \
   ((Mode) == (u8)UART1_MODE_TXRX_ENABLE) || \
   ((Mode) == (u8)((u8)UART1_MODE_TX_ENABLE|(u8)UART1_MODE_RX_ENABLE)) || \
   ((Mode) == (u8)((u8)UART1_MODE_TX_ENABLE|(u8)UART1_MODE_RX_DISABLE)) || \
   ((Mode) == (u8)((u8)UART1_MODE_TX_DISABLE|(u8)UART1_MODE_RX_DISABLE)) || \
   ((Mode) == (u8)((u8)UART1_MODE_TX_DISABLE|(u8)UART1_MODE_RX_ENABLE)))

/**
 * @brief Macro used by the assert_param function in order to check the different sensitivity values for the WordLengths
 */
#define IS_UART1_WORDLENGTH_OK(WordLength) \
  (((WordLength) == UART1_WORDLENGTH_8D) || \
   ((WordLength) == UART1_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  UART1_CLOCK_ENABLE|UART1_CLOCK_DISABLE
  * UART1_SyncMode value should exclude values such as  UART1_CLOCK_ENABLE|UART1_CLOCK_DISABLE
  */
#define IS_UART1_SYNCMODE_OK(SyncMode) \
  (!((((SyncMode)&(((u8)UART1_SYNCMODE_CLOCK_ENABLE)|((u8)UART1_SYNCMODE_CLOCK_DISABLE))) == (((u8)UART1_SYNCMODE_CLOCK_ENABLE)|((u8)UART1_SYNCMODE_CLOCK_DISABLE))) || \
     (((SyncMode)&(((u8)UART1_SYNCMODE_CPOL_LOW )|((u8)UART1_SYNCMODE_CPOL_HIGH))) == (((u8)UART1_SYNCMODE_CPOL_LOW )|((u8)UART1_SYNCMODE_CPOL_HIGH))) || \
     (((SyncMode)&(((u8)UART1_SYNCMODE_CPHA_MIDDLE)|((u8)UART1_SYNCMODE_CPHA_BEGINING))) == (((u8)UART1_SYNCMODE_CPHA_MIDDLE)|((u8)UART1_SYNCMODE_CPHA_BEGINING))) || \
     (((SyncMode)&(((u8)UART1_SYNCMODE_LASTBIT_DISABLE)|((u8)UART1_SYNCMODE_LASTBIT_ENABLE))) == (((u8)UART1_SYNCMODE_LASTBIT_DISABLE)|((u8)UART1_SYNCMODE_LASTBIT_ENABLE)))))

/**
  * @brief Macro used by the assert_param function in order to check the different sensitivity values for the FLAGs
  */
#define IS_UART1_FLAG_OK(Flag) \
  (((Flag) == UART1_FLAG_TXE) || \
   ((Flag) == UART1_FLAG_TC)  || \
   ((Flag) == UART1_FLAG_RXNE) || \
   ((Flag) == UART1_FLAG_IDLE) || \
   ((Flag) == UART1_FLAG_OR) || \
   ((Flag) == UART1_FLAG_NF) || \
   ((Flag) == UART1_FLAG_FE) || \
   ((Flag) == UART1_FLAG_PE) || \
   ((Flag) == UART1_FLAG_SBK) || \
   ((Flag) == UART1_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_UART1_CLEAR_FLAG_OK(Flag) \
  (((Flag) == UART1_FLAG_RXNE) || \
   ((Flag) == UART1_FLAG_LBDF))



/**
  * @brief Macro used by the assert_param function in order to check the different sensitivity values for the Interrupts
  */

#define IS_UART1_CONFIG_IT_OK(Interrupt) \
  (((Interrupt) == UART1_IT_PE) || \
   ((Interrupt) == UART1_IT_TXE) || \
   ((Interrupt) == UART1_IT_TC) || \
   ((Interrupt) == UART1_IT_RXNE_OR ) || \
   ((Interrupt) == UART1_IT_IDLE) || \
   ((Interrupt) == UART1_IT_LBDF))

/**
  * @brief Macro used by the assert function in order to check the different sensitivity values for the pending bit
  */
#define IS_UART1_GET_IT_OK(ITPendingBit) \
  (((ITPendingBit) == UART1_IT_TXE)  || \
   ((ITPendingBit) == UART1_IT_TC)   || \
   ((ITPendingBit) == UART1_IT_RXNE) || \
   ((ITPendingBit) == UART1_IT_IDLE) || \
   ((ITPendingBit) == UART1_IT_OR)  || \
   ((ITPendingBit) == UART1_IT_LBDF)  || \
   ((ITPendingBit) == UART1_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_UART1_CLEAR_IT_OK(ITPendingBit) \
  (((ITPendingBit) == UART1_IT_RXNE) || \
   ((ITPendingBit) == UART1_IT_LBDF))


/**
 * @brief Macro used by the assert_param function in order to check the different sensitivity values for the IrDAModes
 */
#define IS_UART1_IRDAMODE_OK(IrDAMode) \
  (((IrDAMode) == UART1_IRDAMODE_LOWPOWER) || \
   ((IrDAMode) == UART1_IRDAMODE_NORMAL))

/**
  * @brief Macro used by the assert_param function in order to check the different sensitivity values for the WakeUps
  */
#define IS_UART1_WAKEUP_OK(WakeUp) \
  (((WakeUp) == UART1_WAKEUP_IDLELINE) || \
   ((WakeUp) == UART1_WAKEUP_ADDRESSMARK))

/**
  * @brief Macro used by the assert_param function in order to check the different sensitivity values for the LINBreakDetectionLengths
  */
#define IS_UART1_LINBREAKDETECTIONLENGTH_OK(LINBreakDetectionLength) \
  (((LINBreakDetectionLength) == UART1_LINBREAKDETECTIONLENGTH_10BITS) || \
   ((LINBreakDetectionLength) == UART1_LINBREAKDETECTIONLENGTH_11BITS))

/**
  * @brief Macro used by the assert_param function in order to check the different sensitivity values for the UART1_StopBits
  */
#define IS_UART1_STOPBITS_OK(StopBit) (((StopBit) == UART1_STOPBITS_1) || \
                                       ((StopBit) == UART1_STOPBITS_0_5) || \
                                       ((StopBit) == UART1_STOPBITS_2) || \
                                       ((StopBit) == UART1_STOPBITS_1_5 ))

/**
 * @brief Macro used by the assert_param function in order to check the different sensitivity values for the Paritys
 */
#define IS_UART1_PARITY_OK(Parity) (((Parity) == UART1_PARITY_NO) || \
                                    ((Parity) == UART1_PARITY_EVEN) || \
                                    ((Parity) == UART1_PARITY_ODD ))

/**
 * @brief Macro used by the assert_param function in order to check the maximum baudrate value
 */
#define IS_UART1_BAUDRATE_OK(NUM) ((NUM) <= (u32)625000)


/**
 * @brief Macro used by the assert_param function in order to check the address of the UART1 or UART node
 */
#define UART1_ADDRESS_MAX ((u8)16)
#define IS_UART1_ADDRESS_OK(node) ((node) < UART1_ADDRESS_MAX )

/**
  * @}
  */

/* Exported functions ------------------------------------------------------- */

/** @addtogroup UART1_Exported_Functions
  * @{
  */

void UART1_DeInit(void);
void UART1_Init(u32 BaudRate, UART1_WordLength_TypeDef WordLength, UART1_StopBits_TypeDef StopBits, UART1_Parity_TypeDef Parity, UART1_SyncMode_TypeDef SyncMode, UART1_Mode_TypeDef Mode);
void UART1_Cmd(FunctionalState NewState);
void UART1_ITConfig(UART1_IT_TypeDef UART1_IT, FunctionalState NewState);
void UART1_HalfDuplexCmd(FunctionalState NewState);
void UART1_IrDAConfig(UART1_IrDAMode_TypeDef UART1_IrDAMode);
void UART1_IrDACmd(FunctionalState NewState);
void UART1_LINBreakDetectionConfig(UART1_LINBreakDetectionLength_TypeDef UART1_LINBreakDetectionLength);
void UART1_LINCmd(FunctionalState NewState);
void UART1_SmartCardCmd(FunctionalState NewState);
void UART1_SmartCardNACKCmd(FunctionalState NewState);
void UART1_WakeUpConfig(UART1_WakeUp_TypeDef UART1_WakeUp);
void UART1_ReceiverWakeUpCmd(FunctionalState NewState);
u8 UART1_ReceiveData8(void);
u16 UART1_ReceiveData9(void);
void UART1_SendData8(u8 Data);
void UART1_SendData9(u16 Data);
void UART1_SendBreak(void);
void UART1_SetAddress(u8 UART1_Address);
void UART1_SetGuardTime(u8 UART1_GuardTime);
void UART1_SetPrescaler(u8 UART1_Prescaler);

FlagStatus UART1_GetFlagStatus(UART1_Flag_TypeDef UART1_FLAG);
void UART1_ClearFlag(UART1_Flag_TypeDef UART1_FLAG);
ITStatus UART1_GetITStatus(UART1_IT_TypeDef UART1_IT);
void UART1_ClearITPendingBit(UART1_IT_TypeDef UART1_IT);

/**
  * @}
  */

#endif /* __STM8S_UART1_H */

/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -