You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1392 lines
62 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_hal_uart.h
  4. * @author MCD Application Team
  5. * @brief Header file of UART HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F0xx_HAL_UART_H
  37. #define __STM32F0xx_HAL_UART_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f0xx_hal_def.h"
  43. /** @addtogroup STM32F0xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup UART
  47. * @{
  48. */
  49. /* Exported types ------------------------------------------------------------*/
  50. /** @defgroup UART_Exported_Types UART Exported Types
  51. * @{
  52. */
  53. /**
  54. * @brief UART Init Structure definition
  55. */
  56. typedef struct
  57. {
  58. uint32_t BaudRate; /*!< This member configures the UART communication baud rate.
  59. The baud rate register is computed using the following formula:
  60. - If oversampling is 16 or in LIN mode (LIN mode not available on F030xx devices),
  61. Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate)))
  62. - If oversampling is 8,
  63. Baud Rate Register[15:4] = ((2 * PCLKx) / ((huart->Init.BaudRate)))[15:4]
  64. Baud Rate Register[3] = 0
  65. Baud Rate Register[2:0] = (((2 * PCLKx) / ((huart->Init.BaudRate)))[3:0]) >> 1U */
  66. uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
  67. This parameter can be a value of @ref UARTEx_Word_Length. */
  68. uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
  69. This parameter can be a value of @ref UART_Stop_Bits. */
  70. uint32_t Parity; /*!< Specifies the parity mode.
  71. This parameter can be a value of @ref UART_Parity
  72. @note When parity is enabled, the computed parity is inserted
  73. at the MSB position of the transmitted data (9th bit when
  74. the word length is set to 9 data bits; 8th bit when the
  75. word length is set to 8 data bits). */
  76. uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
  77. This parameter can be a value of @ref UART_Mode. */
  78. uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled
  79. or disabled.
  80. This parameter can be a value of @ref UART_Hardware_Flow_Control. */
  81. uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to f_PCLK/8).
  82. This parameter can be a value of @ref UART_Over_Sampling. */
  83. uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected.
  84. Selecting the single sample method increases the receiver tolerance to clock
  85. deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */
  86. }UART_InitTypeDef;
  87. /**
  88. * @brief UART Advanced Features initalization structure definition
  89. */
  90. typedef struct
  91. {
  92. uint32_t AdvFeatureInit; /*!< Specifies which advanced UART features is initialized. Several
  93. Advanced Features may be initialized at the same time .
  94. This parameter can be a value of @ref UART_Advanced_Features_Initialization_Type. */
  95. uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted.
  96. This parameter can be a value of @ref UART_Tx_Inv. */
  97. uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted.
  98. This parameter can be a value of @ref UART_Rx_Inv. */
  99. uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic
  100. vs negative/inverted logic).
  101. This parameter can be a value of @ref UART_Data_Inv. */
  102. uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped.
  103. This parameter can be a value of @ref UART_Rx_Tx_Swap. */
  104. uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled.
  105. This parameter can be a value of @ref UART_Overrun_Disable. */
  106. uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error.
  107. This parameter can be a value of @ref UART_DMA_Disable_on_Rx_Error. */
  108. uint32_t AutoBaudRateEnable; /*!< Specifies whether auto Baud rate detection is enabled.
  109. This parameter can be a value of @ref UART_AutoBaudRate_Enable */
  110. uint32_t AutoBaudRateMode; /*!< If auto Baud rate detection is enabled, specifies how the rate
  111. detection is carried out.
  112. This parameter can be a value of @ref UARTEx_AutoBaud_Rate_Mode. */
  113. uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line.
  114. This parameter can be a value of @ref UART_MSB_First. */
  115. } UART_AdvFeatureInitTypeDef;
  116. /**
  117. * @brief HAL UART State structures definition
  118. * @note HAL UART State value is a combination of 2 different substates: gState and RxState.
  119. * - gState contains UART state information related to global Handle management
  120. * and also information related to Tx operations.
  121. * gState value coding follow below described bitmap :
  122. * b7-b6 Error information
  123. * 00 : No Error
  124. * 01 : (Not Used)
  125. * 10 : Timeout
  126. * 11 : Error
  127. * b5 IP initilisation status
  128. * 0 : Reset (IP not initialized)
  129. * 1 : Init done (IP not initialized. HAL UART Init function already called)
  130. * b4-b3 (not used)
  131. * xx : Should be set to 00
  132. * b2 Intrinsic process state
  133. * 0 : Ready
  134. * 1 : Busy (IP busy with some configuration or internal operations)
  135. * b1 (not used)
  136. * x : Should be set to 0
  137. * b0 Tx state
  138. * 0 : Ready (no Tx operation ongoing)
  139. * 1 : Busy (Tx operation ongoing)
  140. * - RxState contains information related to Rx operations.
  141. * RxState value coding follow below described bitmap :
  142. * b7-b6 (not used)
  143. * xx : Should be set to 00
  144. * b5 IP initilisation status
  145. * 0 : Reset (IP not initialized)
  146. * 1 : Init done (IP not initialized)
  147. * b4-b2 (not used)
  148. * xxx : Should be set to 000
  149. * b1 Rx state
  150. * 0 : Ready (no Rx operation ongoing)
  151. * 1 : Busy (Rx operation ongoing)
  152. * b0 (not used)
  153. * x : Should be set to 0.
  154. */
  155. typedef enum
  156. {
  157. HAL_UART_STATE_RESET = 0x00U, /*!< Peripheral is not initialized
  158. Value is allowed for gState and RxState */
  159. HAL_UART_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use
  160. Value is allowed for gState and RxState */
  161. HAL_UART_STATE_BUSY = 0x24U, /*!< an internal process is ongoing
  162. Value is allowed for gState only */
  163. HAL_UART_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing
  164. Value is allowed for gState only */
  165. HAL_UART_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing
  166. Value is allowed for RxState only */
  167. HAL_UART_STATE_BUSY_TX_RX = 0x23U, /*!< Data Transmission and Reception process is ongoing
  168. Not to be used for neither gState nor RxState.
  169. Value is result of combination (Or) between gState and RxState values */
  170. HAL_UART_STATE_TIMEOUT = 0xA0U, /*!< Timeout state
  171. Value is allowed for gState only */
  172. HAL_UART_STATE_ERROR = 0xE0U /*!< Error
  173. Value is allowed for gState only */
  174. }HAL_UART_StateTypeDef;
  175. /**
  176. * @brief UART clock sources definition
  177. */
  178. typedef enum
  179. {
  180. UART_CLOCKSOURCE_PCLK1 = 0x00U, /*!< PCLK1 clock source */
  181. UART_CLOCKSOURCE_HSI = 0x02U, /*!< HSI clock source */
  182. UART_CLOCKSOURCE_SYSCLK = 0x04U, /*!< SYSCLK clock source */
  183. UART_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */
  184. UART_CLOCKSOURCE_UNDEFINED = 0x10U /*!< Undefined clock source */
  185. }UART_ClockSourceTypeDef;
  186. /**
  187. * @brief UART handle Structure definition
  188. */
  189. typedef struct
  190. {
  191. USART_TypeDef *Instance; /*!< UART registers base address */
  192. UART_InitTypeDef Init; /*!< UART communication parameters */
  193. UART_AdvFeatureInitTypeDef AdvancedInit; /*!< UART Advanced Features initialization parameters */
  194. uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */
  195. uint16_t TxXferSize; /*!< UART Tx Transfer size */
  196. __IO uint16_t TxXferCount; /*!< UART Tx Transfer Counter */
  197. uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */
  198. uint16_t RxXferSize; /*!< UART Rx Transfer size */
  199. __IO uint16_t RxXferCount; /*!< UART Rx Transfer Counter */
  200. uint16_t Mask; /*!< UART Rx RDR register mask */
  201. DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */
  202. DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */
  203. HAL_LockTypeDef Lock; /*!< Locking object */
  204. __IO HAL_UART_StateTypeDef gState; /*!< UART state information related to global Handle management
  205. and also related to Tx operations.
  206. This parameter can be a value of @ref HAL_UART_StateTypeDef */
  207. __IO HAL_UART_StateTypeDef RxState; /*!< UART state information related to Rx operations.
  208. This parameter can be a value of @ref HAL_UART_StateTypeDef */
  209. __IO uint32_t ErrorCode; /*!< UART Error code */
  210. }UART_HandleTypeDef;
  211. /**
  212. * @}
  213. */
  214. /* Exported constants --------------------------------------------------------*/
  215. /** @defgroup UART_Exported_Constants UART Exported Constants
  216. * @{
  217. */
  218. /** @defgroup UART_Error UART Error
  219. * @{
  220. */
  221. #define HAL_UART_ERROR_NONE (0x00000000U) /*!< No error */
  222. #define HAL_UART_ERROR_PE (0x00000001U) /*!< Parity error */
  223. #define HAL_UART_ERROR_NE (0x00000002U) /*!< Noise error */
  224. #define HAL_UART_ERROR_FE (0x00000004U) /*!< frame error */
  225. #define HAL_UART_ERROR_ORE (0x00000008U) /*!< Overrun error */
  226. #define HAL_UART_ERROR_DMA (0x00000010U) /*!< DMA transfer error */
  227. #define HAL_UART_ERROR_BUSY (0x00000020U) /*!< Busy Error */
  228. /**
  229. * @}
  230. */
  231. /** @defgroup UART_Stop_Bits UART Number of Stop Bits
  232. * @{
  233. */
  234. #ifdef USART_SMARTCARD_SUPPORT
  235. #define UART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< UART frame with 0.5 stop bit */
  236. #define UART_STOPBITS_1 (0x00000000U) /*!< UART frame with 1 stop bit */
  237. #define UART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) /*!< UART frame with 1.5 stop bits */
  238. #define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) /*!< UART frame with 2 stop bits */
  239. #else
  240. #define UART_STOPBITS_1 (0x00000000U) /*!< UART frame with 1 stop bit */
  241. #define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) /*!< UART frame with 2 stop bits */
  242. #endif
  243. /**
  244. * @}
  245. */
  246. /** @defgroup UART_Parity UART Parity
  247. * @{
  248. */
  249. #define UART_PARITY_NONE (0x00000000U) /*!< No parity */
  250. #define UART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) /*!< Even parity */
  251. #define UART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) /*!< Odd parity */
  252. /**
  253. * @}
  254. */
  255. /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
  256. * @{
  257. */
  258. #define UART_HWCONTROL_NONE (0x00000000U) /*!< No hardware control */
  259. #define UART_HWCONTROL_RTS ((uint32_t)USART_CR3_RTSE) /*!< Request To Send */
  260. #define UART_HWCONTROL_CTS ((uint32_t)USART_CR3_CTSE) /*!< Clear To Send */
  261. #define UART_HWCONTROL_RTS_CTS ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE)) /*!< Request and Clear To Send */
  262. /**
  263. * @}
  264. */
  265. /** @defgroup UART_Mode UART Transfer Mode
  266. * @{
  267. */
  268. #define UART_MODE_RX ((uint32_t)USART_CR1_RE) /*!< RX mode */
  269. #define UART_MODE_TX ((uint32_t)USART_CR1_TE) /*!< TX mode */
  270. #define UART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) /*!< RX and TX mode */
  271. /**
  272. * @}
  273. */
  274. /** @defgroup UART_State UART State
  275. * @{
  276. */
  277. #define UART_STATE_DISABLE (0x00000000U) /*!< UART disabled */
  278. #define UART_STATE_ENABLE ((uint32_t)USART_CR1_UE) /*!< UART enabled */
  279. /**
  280. * @}
  281. */
  282. /** @defgroup UART_Over_Sampling UART Over Sampling
  283. * @{
  284. */
  285. #define UART_OVERSAMPLING_16 (0x00000000U) /*!< Oversampling by 16 */
  286. #define UART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8) /*!< Oversampling by 8 */
  287. /**
  288. * @}
  289. */
  290. /** @defgroup UART_OneBit_Sampling UART One Bit Sampling Method
  291. * @{
  292. */
  293. #define UART_ONE_BIT_SAMPLE_DISABLE (0x00000000U) /*!< One-bit sampling disable */
  294. #define UART_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT) /*!< One-bit sampling enable */
  295. /**
  296. * @}
  297. */
  298. /** @defgroup UART_Receiver_TimeOut UART Receiver TimeOut
  299. * @{
  300. */
  301. #define UART_RECEIVER_TIMEOUT_DISABLE (0x00000000U) /*!< UART receiver timeout disable */
  302. #define UART_RECEIVER_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN) /*!< UART receiver timeout enable */
  303. /**
  304. * @}
  305. */
  306. /** @defgroup UART_DMA_Tx UART DMA Tx
  307. * @{
  308. */
  309. #define UART_DMA_TX_DISABLE (0x00000000U) /*!< UART DMA TX disabled */
  310. #define UART_DMA_TX_ENABLE ((uint32_t)USART_CR3_DMAT) /*!< UART DMA TX enabled */
  311. /**
  312. * @}
  313. */
  314. /** @defgroup UART_DMA_Rx UART DMA Rx
  315. * @{
  316. */
  317. #define UART_DMA_RX_DISABLE (0x00000000U) /*!< UART DMA RX disabled */
  318. #define UART_DMA_RX_ENABLE ((uint32_t)USART_CR3_DMAR) /*!< UART DMA RX enabled */
  319. /**
  320. * @}
  321. */
  322. /** @defgroup UART_Half_Duplex_Selection UART Half Duplex Selection
  323. * @{
  324. */
  325. #define UART_HALF_DUPLEX_DISABLE (0x00000000U) /*!< UART half-duplex disabled */
  326. #define UART_HALF_DUPLEX_ENABLE ((uint32_t)USART_CR3_HDSEL) /*!< UART half-duplex enabled */
  327. /**
  328. * @}
  329. */
  330. /** @defgroup UART_WakeUp_Address_Length UART WakeUp Address Length
  331. * @{
  332. */
  333. #define UART_ADDRESS_DETECT_4B (0x00000000U) /*!< 4-bit long wake-up address */
  334. #define UART_ADDRESS_DETECT_7B ((uint32_t)USART_CR2_ADDM7) /*!< 7-bit long wake-up address */
  335. /**
  336. * @}
  337. */
  338. /** @defgroup UART_WakeUp_Methods UART WakeUp Methods
  339. * @{
  340. */
  341. #define UART_WAKEUPMETHOD_IDLELINE (0x00000000U) /*!< UART wake-up on idle line */
  342. #define UART_WAKEUPMETHOD_ADDRESSMARK ((uint32_t)USART_CR1_WAKE) /*!< UART wake-up on address mark */
  343. /**
  344. * @}
  345. */
  346. /** @defgroup UART_IT UART IT
  347. * Elements values convention: 0000ZZZZ0XXYYYYYb
  348. * - YYYYY : Interrupt source position in the XX register (5bits)
  349. * - XX : Interrupt source register (2bits)
  350. * - 01: CR1 register
  351. * - 10: CR2 register
  352. * - 11: CR3 register
  353. * - ZZZZ : Flag position in the ISR register(4bits)
  354. * @{
  355. */
  356. #define UART_IT_ERR (0x0060U) /*!< UART error interruption */
  357. #define UART_IT_ORE (0x0300U) /*!< UART overrun error interruption */
  358. #define UART_IT_NE (0x0200U) /*!< UART noise error interruption */
  359. #define UART_IT_FE (0x0100U) /*!< UART frame error interruption */
  360. /**
  361. * @}
  362. */
  363. /** @defgroup UART_Advanced_Features_Initialization_Type UART Advanced Feature Initialization Type
  364. * @{
  365. */
  366. #define UART_ADVFEATURE_NO_INIT (0x00000000U) /*!< No advanced feature initialization */
  367. #define UART_ADVFEATURE_TXINVERT_INIT (0x00000001U) /*!< TX pin active level inversion */
  368. #define UART_ADVFEATURE_RXINVERT_INIT (0x00000002U) /*!< RX pin active level inversion */
  369. #define UART_ADVFEATURE_DATAINVERT_INIT (0x00000004U) /*!< Binary data inversion */
  370. #define UART_ADVFEATURE_SWAP_INIT (0x00000008U) /*!< TX/RX pins swap */
  371. #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT (0x00000010U) /*!< RX overrun disable */
  372. #define UART_ADVFEATURE_DMADISABLEONERROR_INIT (0x00000020U) /*!< DMA disable on Reception Error */
  373. #define UART_ADVFEATURE_AUTOBAUDRATE_INIT (0x00000040U) /*!< Auto Baud rate detection initialization */
  374. #define UART_ADVFEATURE_MSBFIRST_INIT (0x00000080U) /*!< Most significant bit sent/received first */
  375. /**
  376. * @}
  377. */
  378. /** @defgroup UART_Tx_Inv UART Advanced Feature TX Pin Active Level Inversion
  379. * @{
  380. */
  381. #define UART_ADVFEATURE_TXINV_DISABLE (0x00000000U) /*!< TX pin active level inversion disable */
  382. #define UART_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV) /*!< TX pin active level inversion enable */
  383. /**
  384. * @}
  385. */
  386. /** @defgroup UART_Rx_Inv UART Advanced Feature RX Pin Active Level Inversion
  387. * @{
  388. */
  389. #define UART_ADVFEATURE_RXINV_DISABLE (0x00000000U) /*!< RX pin active level inversion disable */
  390. #define UART_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV) /*!< RX pin active level inversion enable */
  391. /**
  392. * @}
  393. */
  394. /** @defgroup UART_Data_Inv UART Advanced Feature Binary Data Inversion
  395. * @{
  396. */
  397. #define UART_ADVFEATURE_DATAINV_DISABLE (0x00000000U) /*!< Binary data inversion disable */
  398. #define UART_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV) /*!< Binary data inversion enable */
  399. /**
  400. * @}
  401. */
  402. /** @defgroup UART_Rx_Tx_Swap UART Advanced Feature RX TX Pins Swap
  403. * @{
  404. */
  405. #define UART_ADVFEATURE_SWAP_DISABLE (0x00000000U) /*!< TX/RX pins swap disable */
  406. #define UART_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP) /*!< TX/RX pins swap enable */
  407. /**
  408. * @}
  409. */
  410. /** @defgroup UART_Overrun_Disable UART Advanced Feature Overrun Disable
  411. * @{
  412. */
  413. #define UART_ADVFEATURE_OVERRUN_ENABLE (0x00000000U) /*!< RX overrun enable */
  414. #define UART_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS) /*!< RX overrun disable */
  415. /**
  416. * @}
  417. */
  418. /** @defgroup UART_AutoBaudRate_Enable UART Advanced Feature Auto BaudRate Enable
  419. * @{
  420. */
  421. #define UART_ADVFEATURE_AUTOBAUDRATE_DISABLE (0x00000000U) /*!< RX Auto Baud rate detection enable */
  422. #define UART_ADVFEATURE_AUTOBAUDRATE_ENABLE ((uint32_t)USART_CR2_ABREN) /*!< RX Auto Baud rate detection disable */
  423. /**
  424. * @}
  425. */
  426. /** @defgroup UART_DMA_Disable_on_Rx_Error UART Advanced Feature DMA Disable On Rx Error
  427. * @{
  428. */
  429. #define UART_ADVFEATURE_DMA_ENABLEONRXERROR (0x00000000U) /*!< DMA enable on Reception Error */
  430. #define UART_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE) /*!< DMA disable on Reception Error */
  431. /**
  432. * @}
  433. */
  434. /** @defgroup UART_MSB_First UART Advanced Feature MSB First
  435. * @{
  436. */
  437. #define UART_ADVFEATURE_MSBFIRST_DISABLE (0x00000000U) /*!< Most significant bit sent/received first disable */
  438. #define UART_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST) /*!< Most significant bit sent/received first enable */
  439. /**
  440. * @}
  441. */
  442. /** @defgroup UART_Mute_Mode UART Advanced Feature Mute Mode Enable
  443. * @{
  444. */
  445. #define UART_ADVFEATURE_MUTEMODE_DISABLE (0x00000000U) /*!< UART mute mode disable */
  446. #define UART_ADVFEATURE_MUTEMODE_ENABLE ((uint32_t)USART_CR1_MME) /*!< UART mute mode enable */
  447. /**
  448. * @}
  449. */
  450. /** @defgroup UART_CR2_ADDRESS_LSB_POS UART Address-matching LSB Position In CR2 Register
  451. * @{
  452. */
  453. #define UART_CR2_ADDRESS_LSB_POS ( 24U) /*!< UART address-matching LSB position in CR2 register */
  454. /**
  455. * @}
  456. */
  457. /** @defgroup UART_DriverEnable_Polarity UART DriverEnable Polarity
  458. * @{
  459. */
  460. #define UART_DE_POLARITY_HIGH (0x00000000U) /*!< Driver enable signal is active high */
  461. #define UART_DE_POLARITY_LOW ((uint32_t)USART_CR3_DEP) /*!< Driver enable signal is active low */
  462. /**
  463. * @}
  464. */
  465. /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS UART Driver Enable Assertion Time LSB Position In CR1 Register
  466. * @{
  467. */
  468. #define UART_CR1_DEAT_ADDRESS_LSB_POS ( 21U) /*!< UART Driver Enable assertion time LSB position in CR1 register */
  469. /**
  470. * @}
  471. */
  472. /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS UART Driver Enable DeAssertion Time LSB Position In CR1 Register
  473. * @{
  474. */
  475. #define UART_CR1_DEDT_ADDRESS_LSB_POS ( 16U) /*!< UART Driver Enable de-assertion time LSB position in CR1 register */
  476. /**
  477. * @}
  478. */
  479. /** @defgroup UART_Interruption_Mask UART Interruptions Flag Mask
  480. * @{
  481. */
  482. #define UART_IT_MASK (0x001FU) /*!< UART interruptions flags mask */
  483. /**
  484. * @}
  485. */
  486. /** @defgroup UART_TimeOut_Value UART polling-based communications time-out value
  487. * @{
  488. */
  489. #define HAL_UART_TIMEOUT_VALUE 0x1FFFFFFU /*!< UART polling-based communications time-out value */
  490. /**
  491. * @}
  492. */
  493. /**
  494. * @}
  495. */
  496. /* Exported macros -----------------------------------------------------------*/
  497. /** @defgroup UART_Exported_Macros UART Exported Macros
  498. * @{
  499. */
  500. /** @brief Reset UART handle states.
  501. * @param __HANDLE__ UART handle.
  502. * @retval None
  503. */
  504. #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) do{ \
  505. (__HANDLE__)->gState = HAL_UART_STATE_RESET; \
  506. (__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
  507. } while(0)
  508. /** @brief Clear the specified UART pending flag.
  509. * @param __HANDLE__ specifies the UART Handle.
  510. * @param __FLAG__ specifies the flag to check.
  511. * This parameter can be any combination of the following values:
  512. * @arg @ref UART_CLEAR_PEF Parity Error Clear Flag
  513. * @arg @ref UART_CLEAR_FEF Framing Error Clear Flag
  514. * @arg @ref UART_CLEAR_NEF Noise detected Clear Flag
  515. * @arg @ref UART_CLEAR_OREF Overrun Error Clear Flag
  516. * @arg @ref UART_CLEAR_IDLEF IDLE line detected Clear Flag
  517. * @arg @ref UART_CLEAR_TCF Transmission Complete Clear Flag
  518. @if STM32F030x6
  519. @elseif STM32F030x8
  520. @elseif STM32F030xC
  521. @elseif STM32F070x6
  522. @elseif STM32F070xB
  523. @else
  524. * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag (not available on all devices)
  525. @endif
  526. * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag
  527. * @arg @ref UART_CLEAR_RTOF Receiver Time Out Clear Flag
  528. @if STM32F030x6
  529. @elseif STM32F030x8
  530. @elseif STM32F030xC
  531. @elseif STM32F070x6
  532. @elseif STM32F070xB
  533. @else
  534. * @arg @ref UART_CLEAR_EOBF End Of Block Clear Flag (not available on all devices)
  535. @endif
  536. * @arg @ref UART_CLEAR_CMF Character Match Clear Flag
  537. @if STM32F030x6
  538. @elseif STM32F030x8
  539. @elseif STM32F030xC
  540. @elseif STM32F070x6
  541. @elseif STM32F070xB
  542. @else
  543. * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag (not available on all devices)
  544. @endif
  545. * @retval None
  546. */
  547. #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
  548. /** @brief Clear the UART PE pending flag.
  549. * @param __HANDLE__ specifies the UART Handle.
  550. * @retval None
  551. */
  552. #define __HAL_UART_CLEAR_PEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_PEF)
  553. /** @brief Clear the UART FE pending flag.
  554. * @param __HANDLE__ specifies the UART Handle.
  555. * @retval None
  556. */
  557. #define __HAL_UART_CLEAR_FEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_FEF)
  558. /** @brief Clear the UART NE pending flag.
  559. * @param __HANDLE__ specifies the UART Handle.
  560. * @retval None
  561. */
  562. #define __HAL_UART_CLEAR_NEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_NEF)
  563. /** @brief Clear the UART ORE pending flag.
  564. * @param __HANDLE__ specifies the UART Handle.
  565. * @retval None
  566. */
  567. #define __HAL_UART_CLEAR_OREFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_OREF)
  568. /** @brief Clear the UART IDLE pending flag.
  569. * @param __HANDLE__ specifies the UART Handle.
  570. * @retval None
  571. */
  572. #define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_IDLEF)
  573. /** @brief Check whether the specified UART flag is set or not.
  574. * @param __HANDLE__ specifies the UART Handle.
  575. * @param __FLAG__ specifies the flag to check.
  576. * This parameter can be one of the following values:
  577. @if STM32F030x6
  578. @elseif STM32F030x8
  579. @elseif STM32F030xC
  580. @elseif STM32F070x6
  581. @elseif STM32F070xB
  582. @else
  583. * @arg @ref UART_FLAG_REACK Receive enable acknowledge flag
  584. @endif
  585. * @arg @ref UART_FLAG_TEACK Transmit enable acknowledge flag
  586. @if STM32F030x6
  587. @elseif STM32F030x8
  588. @elseif STM32F030xC
  589. @elseif STM32F070x6
  590. @elseif STM32F070xB
  591. @else
  592. * @arg @ref UART_FLAG_WUF Wake up from stop mode flag (not available on F030xx devices)
  593. @endif
  594. * @arg @ref UART_FLAG_RWU Receiver wake up flag (not available on F030xx devices)
  595. * @arg @ref UART_FLAG_SBKF Send Break flag
  596. * @arg @ref UART_FLAG_CMF Character match flag
  597. * @arg @ref UART_FLAG_BUSY Busy flag
  598. * @arg @ref UART_FLAG_ABRF Auto Baud rate detection flag
  599. * @arg @ref UART_FLAG_ABRE Auto Baud rate detection error flag
  600. @if STM32F030x6
  601. @elseif STM32F030x8
  602. @elseif STM32F030xC
  603. @elseif STM32F070x6
  604. @elseif STM32F070xB
  605. @else
  606. * @arg @ref UART_FLAG_EOBF End of block flag (not available on F030xx devices)
  607. @endif
  608. * @arg @ref UART_FLAG_RTOF Receiver timeout flag
  609. * @arg @ref UART_FLAG_CTS CTS Change flag
  610. @if STM32F030x6
  611. @elseif STM32F030x8
  612. @elseif STM32F030xC
  613. @elseif STM32F070x6
  614. @elseif STM32F070xB
  615. @else
  616. * @arg @ref UART_FLAG_LBDF LIN Break detection flag (not available on F030xx devices)
  617. @endif
  618. * @arg @ref UART_FLAG_TXE Transmit data register empty flag
  619. * @arg @ref UART_FLAG_TC Transmission Complete flag
  620. * @arg @ref UART_FLAG_RXNE Receive data register not empty flag
  621. * @arg @ref UART_FLAG_IDLE Idle Line detection flag
  622. * @arg @ref UART_FLAG_ORE Overrun Error flag
  623. * @arg @ref UART_FLAG_NE Noise Error flag
  624. * @arg @ref UART_FLAG_FE Framing Error flag
  625. * @arg @ref UART_FLAG_PE Parity Error flag
  626. * @retval The new state of __FLAG__ (TRUE or FALSE).
  627. */
  628. #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
  629. /** @brief Enable the specified UART interrupt.
  630. * @param __HANDLE__ specifies the UART Handle.
  631. * @param __INTERRUPT__ specifies the UART interrupt source to enable.
  632. * This parameter can be one of the following values:
  633. @if STM32F030x6
  634. @elseif STM32F030x8
  635. @elseif STM32F030xC
  636. @elseif STM32F070x6
  637. @elseif STM32F070xB
  638. @else
  639. * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt (not available on F030xx devices)
  640. @endif
  641. * @arg @ref UART_IT_CM Character match interrupt
  642. * @arg @ref UART_IT_CTS CTS change interrupt
  643. @if STM32F030x6
  644. @elseif STM32F030x8
  645. @elseif STM32F030xC
  646. @elseif STM32F070x6
  647. @elseif STM32F070xB
  648. @else
  649. * @arg @ref UART_IT_LBD LIN Break detection interrupt (not available on F030xx devices)
  650. @endif
  651. * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
  652. * @arg @ref UART_IT_TC Transmission complete interrupt
  653. * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
  654. * @arg @ref UART_IT_IDLE Idle line detection interrupt
  655. * @arg @ref UART_IT_PE Parity Error interrupt
  656. * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error)
  657. * @retval None
  658. */
  659. #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
  660. ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
  661. ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))))
  662. /** @brief Disable the specified UART interrupt.
  663. * @param __HANDLE__ specifies the UART Handle.
  664. * @param __INTERRUPT__ specifies the UART interrupt source to disable.
  665. * This parameter can be one of the following values:
  666. @if STM32F030x6
  667. @elseif STM32F030x8
  668. @elseif STM32F030xC
  669. @elseif STM32F070x6
  670. @elseif STM32F070xB
  671. @else
  672. * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt (not available on F030xx devices)
  673. @endif
  674. * @arg @ref UART_IT_CM Character match interrupt
  675. * @arg @ref UART_IT_CTS CTS change interrupt
  676. @if STM32F030x6
  677. @elseif STM32F030x8
  678. @elseif STM32F030xC
  679. @elseif STM32F070x6
  680. @elseif STM32F070xB
  681. @else
  682. * @arg @ref UART_IT_LBD LIN Break detection interrupt (not available on F030xx devices)
  683. @endif
  684. * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
  685. * @arg @ref UART_IT_TC Transmission complete interrupt
  686. * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
  687. * @arg @ref UART_IT_IDLE Idle line detection interrupt
  688. * @arg @ref UART_IT_PE Parity Error interrupt
  689. * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error)
  690. * @retval None
  691. */
  692. #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
  693. ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
  694. ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))))
  695. /** @brief Check whether the specified UART interrupt has occurred or not.
  696. * @param __HANDLE__ specifies the UART Handle.
  697. * @param __IT__ specifies the UART interrupt to check.
  698. * This parameter can be one of the following values:
  699. @if STM32F030x6
  700. @elseif STM32F030x8
  701. @elseif STM32F030xC
  702. @elseif STM32F070x6
  703. @elseif STM32F070xB
  704. @else
  705. * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt (not available on F030xx devices)
  706. @endif
  707. * @arg @ref UART_IT_CM Character match interrupt
  708. * @arg @ref UART_IT_CTS CTS change interrupt
  709. @if STM32F030x6
  710. @elseif STM32F030x8
  711. @elseif STM32F030xC
  712. @elseif STM32F070x6
  713. @elseif STM32F070xB
  714. @else
  715. * @arg @ref UART_IT_LBD LIN Break detection interrupt (not available on F030xx devices)
  716. @endif
  717. * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
  718. * @arg @ref UART_IT_TC Transmission complete interrupt
  719. * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
  720. * @arg @ref UART_IT_IDLE Idle line detection interrupt
  721. * @arg @ref UART_IT_ORE Overrun Error interrupt
  722. * @arg @ref UART_IT_NE Noise Error interrupt
  723. * @arg @ref UART_IT_FE Framing Error interrupt
  724. * @arg @ref UART_IT_PE Parity Error interrupt
  725. * @retval The new state of __IT__ (TRUE or FALSE).
  726. */
  727. #define __HAL_UART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & (1U << ((__IT__)>> 0x08U)))
  728. /** @brief Check whether the specified UART interrupt source is enabled or not.
  729. * @param __HANDLE__ specifies the UART Handle.
  730. * @param __IT__ specifies the UART interrupt source to check.
  731. * This parameter can be one of the following values:
  732. @if STM32F030x6
  733. @elseif STM32F030x8
  734. @elseif STM32F030xC
  735. @elseif STM32F070x6
  736. @elseif STM32F070xB
  737. @else
  738. * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt (not available on F030xx devices)
  739. @endif
  740. * @arg @ref UART_IT_CM Character match interrupt
  741. * @arg @ref UART_IT_CTS CTS change interrupt
  742. @if STM32F030x6
  743. @elseif STM32F030x8
  744. @elseif STM32F030xC
  745. @elseif STM32F070x6
  746. @elseif STM32F070xB
  747. @else
  748. * @arg @ref UART_IT_LBD LIN Break detection interrupt (not available on F030xx devices)
  749. @endif
  750. * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
  751. * @arg @ref UART_IT_TC Transmission complete interrupt
  752. * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
  753. * @arg @ref UART_IT_IDLE Idle line detection interrupt
  754. * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error)
  755. * @arg @ref UART_IT_PE Parity Error interrupt
  756. * @retval The new state of __IT__ (TRUE or FALSE).
  757. */
  758. #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1U)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2U)? \
  759. (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (1U << (((uint16_t)(__IT__)) & UART_IT_MASK)))
  760. /** @brief Clear the specified UART ISR flag, in setting the proper ICR register flag.
  761. * @param __HANDLE__ specifies the UART Handle.
  762. * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
  763. * to clear the corresponding interrupt
  764. * This parameter can be one of the following values:
  765. * @arg @ref UART_CLEAR_PEF Parity Error Clear Flag
  766. * @arg @ref UART_CLEAR_FEF Framing Error Clear Flag
  767. * @arg @ref UART_CLEAR_NEF Noise detected Clear Flag
  768. * @arg @ref UART_CLEAR_OREF Overrun Error Clear Flag
  769. * @arg @ref UART_CLEAR_IDLEF IDLE line detected Clear Flag
  770. * @arg @ref UART_CLEAR_TCF Transmission Complete Clear Flag
  771. @if STM32F030x6
  772. @elseif STM32F030x8
  773. @elseif STM32F030xC
  774. @elseif STM32F070x6
  775. @elseif STM32F070xB
  776. @else
  777. * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag (not available on F030xx devices)
  778. @endif
  779. * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag
  780. * @arg @ref UART_CLEAR_RTOF Receiver Time Out Clear Flag
  781. @if STM32F030x6
  782. @elseif STM32F030x8
  783. @elseif STM32F030xC
  784. @elseif STM32F070x6
  785. @elseif STM32F070xB
  786. @else
  787. * @arg @ref UART_CLEAR_EOBF End Of Block Clear Flag
  788. @endif
  789. * @arg @ref UART_CLEAR_CMF Character Match Clear Flag
  790. @if STM32F030x6
  791. @elseif STM32F030x8
  792. @elseif STM32F030xC
  793. @elseif STM32F070x6
  794. @elseif STM32F070xB
  795. @else
  796. * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag (not available on F030xx devices)
  797. @endif
  798. * @retval None
  799. */
  800. #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
  801. /** @brief Set a specific UART request flag.
  802. * @param __HANDLE__ specifies the UART Handle.
  803. * @param __REQ__ specifies the request flag to set
  804. * This parameter can be one of the following values:
  805. * @arg @ref UART_AUTOBAUD_REQUEST Auto-Baud Rate Request
  806. * @arg @ref UART_SENDBREAK_REQUEST Send Break Request
  807. * @arg @ref UART_MUTE_MODE_REQUEST Mute Mode Request
  808. * @arg @ref UART_RXDATA_FLUSH_REQUEST Receive Data flush Request
  809. @if STM32F030x6
  810. @elseif STM32F030x8
  811. @elseif STM32F030xC
  812. @elseif STM32F070x6
  813. @elseif STM32F070xB
  814. @else
  815. * @arg @ref UART_TXDATA_FLUSH_REQUEST Transmit data flush Request (not available on F030xx devices)
  816. @endif
  817. * @retval None
  818. */
  819. #define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint32_t)(__REQ__))
  820. /** @brief Enable the UART one bit sample method.
  821. * @param __HANDLE__ specifies the UART Handle.
  822. * @retval None
  823. */
  824. #define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
  825. /** @brief Disable the UART one bit sample method.
  826. * @param __HANDLE__ specifies the UART Handle.
  827. * @retval None
  828. */
  829. #define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT))
  830. /** @brief Enable UART.
  831. * @param __HANDLE__ specifies the UART Handle.
  832. * @retval None
  833. */
  834. #define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
  835. /** @brief Disable UART.
  836. * @param __HANDLE__ specifies the UART Handle.
  837. * @retval None
  838. */
  839. #define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
  840. /** @brief Enable CTS flow control.
  841. * @note This macro allows to enable CTS hardware flow control for a given UART instance,
  842. * without need to call HAL_UART_Init() function.
  843. * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
  844. * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
  845. * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  846. * - UART instance should have already been initialised (through call of HAL_UART_Init() )
  847. * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
  848. * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
  849. * @param __HANDLE__ specifies the UART Handle.
  850. * @retval None
  851. */
  852. #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \
  853. do{ \
  854. SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
  855. (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
  856. } while(0)
  857. /** @brief Disable CTS flow control.
  858. * @note This macro allows to disable CTS hardware flow control for a given UART instance,
  859. * without need to call HAL_UART_Init() function.
  860. * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
  861. * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
  862. * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  863. * - UART instance should have already been initialised (through call of HAL_UART_Init() )
  864. * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
  865. * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
  866. * @param __HANDLE__ specifies the UART Handle.
  867. * @retval None
  868. */
  869. #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \
  870. do{ \
  871. CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
  872. (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
  873. } while(0)
  874. /** @brief Enable RTS flow control.
  875. * @note This macro allows to enable RTS hardware flow control for a given UART instance,
  876. * without need to call HAL_UART_Init() function.
  877. * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
  878. * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
  879. * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  880. * - UART instance should have already been initialised (through call of HAL_UART_Init() )
  881. * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
  882. * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
  883. * @param __HANDLE__ specifies the UART Handle.
  884. * @retval None
  885. */
  886. #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \
  887. do{ \
  888. SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
  889. (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
  890. } while(0)
  891. /** @brief Disable RTS flow control.
  892. * @note This macro allows to disable RTS hardware flow control for a given UART instance,
  893. * without need to call HAL_UART_Init() function.
  894. * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
  895. * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
  896. * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  897. * - UART instance should have already been initialised (through call of HAL_UART_Init() )
  898. * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
  899. * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
  900. * @param __HANDLE__ specifies the UART Handle.
  901. * @retval None
  902. */
  903. #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \
  904. do{ \
  905. CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
  906. (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
  907. } while(0)
  908. /**
  909. * @}
  910. */
  911. /* Private macros --------------------------------------------------------*/
  912. /** @defgroup UART_Private_Macros UART Private Macros
  913. * @{
  914. */
  915. /** @brief BRR division operation to set BRR register in 8-bit oversampling mode.
  916. * @param __PCLK__ UART clock.
  917. * @param __BAUD__ Baud rate set by the user.
  918. * @retval Division result
  919. */
  920. #define UART_DIV_SAMPLING8(__PCLK__, __BAUD__) ((((__PCLK__)*2U) + ((__BAUD__)/2U)) / (__BAUD__))
  921. /** @brief BRR division operation to set BRR register in 16-bit oversampling mode.
  922. * @param __PCLK__ UART clock.
  923. * @param __BAUD__ Baud rate set by the user.
  924. * @retval Division result
  925. */
  926. #define UART_DIV_SAMPLING16(__PCLK__, __BAUD__) (((__PCLK__) + ((__BAUD__)/2U)) / (__BAUD__))
  927. /** @brief Check UART Baud rate.
  928. * @param __BAUDRATE__ Baudrate specified by the user.
  929. * The maximum Baud Rate is derived from the maximum clock on F0 (i.e. 48 MHz)
  930. * divided by the smallest oversampling used on the USART (i.e. 8)
  931. * @retval SET (__BAUDRATE__ is valid) or RESET (__BAUDRATE__ is invalid)
  932. */
  933. #define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 6000001U)
  934. /** @brief Check UART assertion time.
  935. * @param __TIME__ 5-bit value assertion time.
  936. * @retval Test result (TRUE or FALSE).
  937. */
  938. #define IS_UART_ASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1F)
  939. /** @brief Check UART deassertion time.
  940. * @param __TIME__ 5-bit value deassertion time.
  941. * @retval Test result (TRUE or FALSE).
  942. */
  943. #define IS_UART_DEASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1F)
  944. /**
  945. * @brief Ensure that UART frame number of stop bits is valid.
  946. * @param __STOPBITS__ UART frame number of stop bits.
  947. * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)
  948. */
  949. #ifdef USART_SMARTCARD_SUPPORT
  950. #define IS_UART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_0_5) || \
  951. ((__STOPBITS__) == UART_STOPBITS_1) || \
  952. ((__STOPBITS__) == UART_STOPBITS_1_5) || \
  953. ((__STOPBITS__) == UART_STOPBITS_2))
  954. #else
  955. #define IS_UART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_1) || \
  956. ((__STOPBITS__) == UART_STOPBITS_2))
  957. #endif
  958. /**
  959. * @brief Ensure that UART frame parity is valid.
  960. * @param __PARITY__ UART frame parity.
  961. * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid)
  962. */
  963. #define IS_UART_PARITY(__PARITY__) (((__PARITY__) == UART_PARITY_NONE) || \
  964. ((__PARITY__) == UART_PARITY_EVEN) || \
  965. ((__PARITY__) == UART_PARITY_ODD))
  966. /**
  967. * @brief Ensure that UART hardware flow control is valid.
  968. * @param __CONTROL__ UART hardware flow control.
  969. * @retval SET (__CONTROL__ is valid) or RESET (__CONTROL__ is invalid)
  970. */
  971. #define IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)\
  972. (((__CONTROL__) == UART_HWCONTROL_NONE) || \
  973. ((__CONTROL__) == UART_HWCONTROL_RTS) || \
  974. ((__CONTROL__) == UART_HWCONTROL_CTS) || \
  975. ((__CONTROL__) == UART_HWCONTROL_RTS_CTS))
  976. /**
  977. * @brief Ensure that UART communication mode is valid.
  978. * @param __MODE__ UART communication mode.
  979. * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
  980. */
  981. #define IS_UART_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(UART_MODE_TX_RX)))) == 0x00U) && ((__MODE__) != 0x00U))
  982. /**
  983. * @brief Ensure that UART state is valid.
  984. * @param __STATE__ UART state.
  985. * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid)
  986. */
  987. #define IS_UART_STATE(__STATE__) (((__STATE__) == UART_STATE_DISABLE) || \
  988. ((__STATE__) == UART_STATE_ENABLE))
  989. /**
  990. * @brief Ensure that UART oversampling is valid.
  991. * @param __SAMPLING__ UART oversampling.
  992. * @retval SET (__SAMPLING__ is valid) or RESET (__SAMPLING__ is invalid)
  993. */
  994. #define IS_UART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == UART_OVERSAMPLING_16) || \
  995. ((__SAMPLING__) == UART_OVERSAMPLING_8))
  996. /**
  997. * @brief Ensure that UART frame sampling is valid.
  998. * @param __ONEBIT__ UART frame sampling.
  999. * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid)
  1000. */
  1001. #define IS_UART_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == UART_ONE_BIT_SAMPLE_DISABLE) || \
  1002. ((__ONEBIT__) == UART_ONE_BIT_SAMPLE_ENABLE))
  1003. /**
  1004. * @brief Ensure that Address Length detection parameter is valid.
  1005. * @param __ADDRESS__ UART Adress length value.
  1006. * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid)
  1007. */
  1008. #define IS_UART_ADDRESSLENGTH_DETECT(__ADDRESS__) (((__ADDRESS__) == UART_ADDRESS_DETECT_4B) || \
  1009. ((__ADDRESS__) == UART_ADDRESS_DETECT_7B))
  1010. /**
  1011. * @brief Ensure that UART receiver timeout setting is valid.
  1012. * @param __TIMEOUT__ UART receiver timeout setting.
  1013. * @retval SET (__TIMEOUT__ is valid) or RESET (__TIMEOUT__ is invalid)
  1014. */
  1015. #define IS_UART_RECEIVER_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_DISABLE) || \
  1016. ((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_ENABLE))
  1017. /**
  1018. * @brief Ensure that UART DMA TX state is valid.
  1019. * @param __DMATX__ UART DMA TX state.
  1020. * @retval SET (__DMATX__ is valid) or RESET (__DMATX__ is invalid)
  1021. */
  1022. #define IS_UART_DMA_TX(__DMATX__) (((__DMATX__) == UART_DMA_TX_DISABLE) || \
  1023. ((__DMATX__) == UART_DMA_TX_ENABLE))
  1024. /**
  1025. * @brief Ensure that UART DMA RX state is valid.
  1026. * @param __DMARX__ UART DMA RX state.
  1027. * @retval SET (__DMARX__ is valid) or RESET (__DMARX__ is invalid)
  1028. */
  1029. #define IS_UART_DMA_RX(__DMARX__) (((__DMARX__) == UART_DMA_RX_DISABLE) || \
  1030. ((__DMARX__) == UART_DMA_RX_ENABLE))
  1031. /**
  1032. * @brief Ensure that UART half-duplex state is valid.
  1033. * @param __HDSEL__ UART half-duplex state.
  1034. * @retval SET (__HDSEL__ is valid) or RESET (__HDSEL__ is invalid)
  1035. */
  1036. #define IS_UART_HALF_DUPLEX(__HDSEL__) (((__HDSEL__) == UART_HALF_DUPLEX_DISABLE) || \
  1037. ((__HDSEL__) == UART_HALF_DUPLEX_ENABLE))
  1038. /**
  1039. * @brief Ensure that UART wake-up method is valid.
  1040. * @param __WAKEUP__ UART wake-up method .
  1041. * @retval SET (__WAKEUP__ is valid) or RESET (__WAKEUP__ is invalid)
  1042. */
  1043. #define IS_UART_WAKEUPMETHOD(__WAKEUP__) (((__WAKEUP__) == UART_WAKEUPMETHOD_IDLELINE) || \
  1044. ((__WAKEUP__) == UART_WAKEUPMETHOD_ADDRESSMARK))
  1045. /**
  1046. * @brief Ensure that UART advanced features initialization is valid.
  1047. * @param __INIT__ UART advanced features initialization.
  1048. * @retval SET (__INIT__ is valid) or RESET (__INIT__ is invalid)
  1049. */
  1050. #define IS_UART_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (UART_ADVFEATURE_NO_INIT | \
  1051. UART_ADVFEATURE_TXINVERT_INIT | \
  1052. UART_ADVFEATURE_RXINVERT_INIT | \
  1053. UART_ADVFEATURE_DATAINVERT_INIT | \
  1054. UART_ADVFEATURE_SWAP_INIT | \
  1055. UART_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
  1056. UART_ADVFEATURE_DMADISABLEONERROR_INIT | \
  1057. UART_ADVFEATURE_AUTOBAUDRATE_INIT | \
  1058. UART_ADVFEATURE_MSBFIRST_INIT))
  1059. /**
  1060. * @brief Ensure that UART frame TX inversion setting is valid.
  1061. * @param __TXINV__ UART frame TX inversion setting.
  1062. * @retval SET (__TXINV__ is valid) or RESET (__TXINV__ is invalid)
  1063. */
  1064. #define IS_UART_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == UART_ADVFEATURE_TXINV_DISABLE) || \
  1065. ((__TXINV__) == UART_ADVFEATURE_TXINV_ENABLE))
  1066. /**
  1067. * @brief Ensure that UART frame RX inversion setting is valid.
  1068. * @param __RXINV__ UART frame RX inversion setting.
  1069. * @retval SET (__RXINV__ is valid) or RESET (__RXINV__ is invalid)
  1070. */
  1071. #define IS_UART_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == UART_ADVFEATURE_RXINV_DISABLE) || \
  1072. ((__RXINV__) == UART_ADVFEATURE_RXINV_ENABLE))
  1073. /**
  1074. * @brief Ensure that UART frame data inversion setting is valid.
  1075. * @param __DATAINV__ UART frame data inversion setting.
  1076. * @retval SET (__DATAINV__ is valid) or RESET (__DATAINV__ is invalid)
  1077. */
  1078. #define IS_UART_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == UART_ADVFEATURE_DATAINV_DISABLE) || \
  1079. ((__DATAINV__) == UART_ADVFEATURE_DATAINV_ENABLE))
  1080. /**
  1081. * @brief Ensure that UART frame RX/TX pins swap setting is valid.
  1082. * @param __SWAP__ UART frame RX/TX pins swap setting.
  1083. * @retval SET (__SWAP__ is valid) or RESET (__SWAP__ is invalid)
  1084. */
  1085. #define IS_UART_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == UART_ADVFEATURE_SWAP_DISABLE) || \
  1086. ((__SWAP__) == UART_ADVFEATURE_SWAP_ENABLE))
  1087. /**
  1088. * @brief Ensure that UART frame overrun setting is valid.
  1089. * @param __OVERRUN__ UART frame overrun setting.
  1090. * @retval SET (__OVERRUN__ is valid) or RESET (__OVERRUN__ is invalid)
  1091. */
  1092. #define IS_UART_OVERRUN(__OVERRUN__) (((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
  1093. ((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_DISABLE))
  1094. /**
  1095. * @brief Ensure that UART auto Baud rate state is valid.
  1096. * @param __AUTOBAUDRATE__ UART auto Baud rate state.
  1097. * @retval SET (__AUTOBAUDRATE__ is valid) or RESET (__AUTOBAUDRATE__ is invalid)
  1098. */
  1099. #define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__) (((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
  1100. ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))
  1101. /**
  1102. * @brief Ensure that UART DMA enabling or disabling on error setting is valid.
  1103. * @param __DMA__ UART DMA enabling or disabling on error setting.
  1104. * @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid)
  1105. */
  1106. #define IS_UART_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == UART_ADVFEATURE_DMA_ENABLEONRXERROR) || \
  1107. ((__DMA__) == UART_ADVFEATURE_DMA_DISABLEONRXERROR))
  1108. /**
  1109. * @brief Ensure that UART frame MSB first setting is valid.
  1110. * @param __MSBFIRST__ UART frame MSB first setting.
  1111. * @retval SET (__MSBFIRST__ is valid) or RESET (__MSBFIRST__ is invalid)
  1112. */
  1113. #define IS_UART_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
  1114. ((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_ENABLE))
  1115. /**
  1116. * @brief Ensure that UART mute mode state is valid.
  1117. * @param __MUTE__ UART mute mode state.
  1118. * @retval SET (__MUTE__ is valid) or RESET (__MUTE__ is invalid)
  1119. */
  1120. #define IS_UART_MUTE_MODE(__MUTE__) (((__MUTE__) == UART_ADVFEATURE_MUTEMODE_DISABLE) || \
  1121. ((__MUTE__) == UART_ADVFEATURE_MUTEMODE_ENABLE))
  1122. /**
  1123. * @brief Ensure that UART driver enable polarity is valid.
  1124. * @param __POLARITY__ UART driver enable polarity.
  1125. * @retval SET (__POLARITY__ is valid) or RESET (__POLARITY__ is invalid)
  1126. */
  1127. #define IS_UART_DE_POLARITY(__POLARITY__) (((__POLARITY__) == UART_DE_POLARITY_HIGH) || \
  1128. ((__POLARITY__) == UART_DE_POLARITY_LOW))
  1129. /**
  1130. * @}
  1131. */
  1132. /* Include UART HAL Extended module */
  1133. #include "stm32f0xx_hal_uart_ex.h"
  1134. /* Exported functions --------------------------------------------------------*/
  1135. /** @addtogroup UART_Exported_Functions UART Exported Functions
  1136. * @{
  1137. */
  1138. /** @addtogroup UART_Exported_Functions_Group1 Initialization and de-initialization functions
  1139. * @{
  1140. */
  1141. /* Initialization and de-initialization functions ****************************/
  1142. HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
  1143. HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
  1144. HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
  1145. HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart);
  1146. void HAL_UART_MspInit(UART_HandleTypeDef *huart);
  1147. void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
  1148. /**
  1149. * @}
  1150. */
  1151. /** @addtogroup UART_Exported_Functions_Group2 IO operation functions
  1152. * @{
  1153. */
  1154. /* IO operation functions *****************************************************/
  1155. HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
  1156. HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
  1157. HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
  1158. HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
  1159. HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
  1160. HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
  1161. HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
  1162. HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
  1163. HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
  1164. /* Transfer Abort functions */
  1165. HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart);
  1166. HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart);
  1167. HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart);
  1168. HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart);
  1169. HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart);
  1170. HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart);
  1171. void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
  1172. void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
  1173. void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
  1174. void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
  1175. void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
  1176. void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
  1177. void HAL_UART_AbortCpltCallback (UART_HandleTypeDef *huart);
  1178. void HAL_UART_AbortTransmitCpltCallback (UART_HandleTypeDef *huart);
  1179. void HAL_UART_AbortReceiveCpltCallback (UART_HandleTypeDef *huart);
  1180. /**
  1181. * @}
  1182. */
  1183. /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions
  1184. * @{
  1185. */
  1186. /* Peripheral Control functions ************************************************/
  1187. HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart);
  1188. HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart);
  1189. void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
  1190. HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
  1191. HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
  1192. /**
  1193. * @}
  1194. */
  1195. /** @addtogroup UART_Exported_Functions_Group4 Peripheral State and Error functions
  1196. * @{
  1197. */
  1198. /* Peripheral State and Errors functions **************************************************/
  1199. HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
  1200. uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
  1201. /**
  1202. * @}
  1203. */
  1204. /**
  1205. * @}
  1206. */
  1207. /* Private functions -----------------------------------------------------------*/
  1208. /** @addtogroup UART_Private_Functions UART Private Functions
  1209. * @{
  1210. */
  1211. void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
  1212. HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart);
  1213. HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart);
  1214. HAL_StatusTypeDef UART_Transmit_IT(UART_HandleTypeDef *huart);
  1215. HAL_StatusTypeDef UART_EndTransmit_IT(UART_HandleTypeDef *huart);
  1216. HAL_StatusTypeDef UART_Receive_IT(UART_HandleTypeDef *huart);
  1217. HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Tickstart, uint32_t Timeout);
  1218. /**
  1219. * @}
  1220. */
  1221. /**
  1222. * @}
  1223. */
  1224. /**
  1225. * @}
  1226. */
  1227. #ifdef __cplusplus
  1228. }
  1229. #endif
  1230. #endif /* __STM32F0xx_HAL_UART_H */
  1231. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/