]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_uart.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F0 / stm32f0xx_hal_uart.h
1 /**
2   ******************************************************************************
3   * @file    stm32f0xx_hal_uart.h
4   * @author  MCD Application Team
5   * @version V1.2.0
6   * @date    11-December-2014
7   * @brief   Header file of UART HAL module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12   *
13   * Redistribution and use in source and binary forms, with or without modification,
14   * are permitted provided that the following conditions are met:
15   *   1. Redistributions of source code must retain the above copyright notice,
16   *      this list of conditions and the following disclaimer.
17   *   2. Redistributions in binary form must reproduce the above copyright notice,
18   *      this list of conditions and the following disclaimer in the documentation
19   *      and/or other materials provided with the distribution.
20   *   3. Neither the name of STMicroelectronics nor the names of its contributors
21   *      may be used to endorse or promote products derived from this software
22   *      without specific prior written permission.
23   *
24   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34   *
35   ******************************************************************************  
36   */
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F0xx_HAL_UART_H
40 #define __STM32F0xx_HAL_UART_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f0xx_hal_def.h"
48
49 /** @addtogroup STM32F0xx_HAL_Driver
50   * @{
51   */
52
53 /** @addtogroup UART
54   * @{
55   */ 
56
57 /* Exported types ------------------------------------------------------------*/ 
58 /** @defgroup UART_Exported_Types UART Exported Types
59   * @{
60   */ 
61
62
63 /** 
64   * @brief UART Init Structure definition  
65   */ 
66 typedef struct
67 {
68   uint32_t BaudRate;                  /*!< This member configures the UART communication baud rate.
69                                            The baud rate register is computed using the following formula:
70                                            - If oversampling is 16 or in LIN mode (LIN mode not available on F030xx devices),
71                                               Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate)))
72                                            - If oversampling is 8,
73                                               Baud Rate Register[15:4] = ((2 * PCLKx) / ((huart->Init.BaudRate)))[15:4]  
74                                               Baud Rate Register[3] =  0
75                                               Baud Rate Register[2:0] =  (((2 * PCLKx) / ((huart->Init.BaudRate)))[3:0]) >> 1      */
76
77   uint32_t WordLength;                /*!< Specifies the number of data bits transmitted or received in a frame.
78                                            This parameter can be a value of @ref UARTEx_Word_Length */
79
80   uint32_t StopBits;                  /*!< Specifies the number of stop bits transmitted.
81                                            This parameter can be a value of @ref UART_Stop_Bits */
82
83   uint32_t Parity;                    /*!< Specifies the parity mode.
84                                            This parameter can be a value of @ref UART_Parity
85                                            @note When parity is enabled, the computed parity is inserted
86                                                  at the MSB position of the transmitted data (9th bit when
87                                                  the word length is set to 9 data bits; 8th bit when the
88                                                  word length is set to 8 data bits). */
89  
90   uint32_t Mode;                      /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
91                                            This parameter can be a value of @ref UART_Mode */
92
93   uint32_t HwFlowCtl;                 /*!< Specifies whether the hardware flow control mode is enabled
94                                            or disabled.
95                                            This parameter can be a value of @ref UART_Hardware_Flow_Control */
96   
97   uint32_t OverSampling;              /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to fPCLK/8).
98                                            This parameter can be a value of @ref UART_Over_Sampling */  
99                                            
100   uint32_t OneBitSampling;            /*!< Specifies whether a single sample or three samples' majority vote is selected.
101                                            Selecting the single sample method increases the receiver tolerance to clock
102                                            deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */                                                 
103 }UART_InitTypeDef;
104
105 /** 
106   * @brief  UART Advanced Features initalization structure definition  
107   */
108 typedef struct                                      
109 {
110   uint32_t AdvFeatureInit;        /*!< Specifies which advanced UART features is initialized. Several
111                                        Advanced Features may be initialized at the same time .
112                                        This parameter can be a value of @ref UART_Advanced_Features_Initialization_Type */
113   
114   uint32_t TxPinLevelInvert;      /*!< Specifies whether the TX pin active level is inverted.
115                                        This parameter can be a value of @ref UART_Tx_Inv  */
116                                            
117   uint32_t RxPinLevelInvert;      /*!< Specifies whether the RX pin active level is inverted.
118                                        This parameter can be a value of @ref UART_Rx_Inv  */
119
120   uint32_t DataInvert;            /*!< Specifies whether data are inverted (positive/direct logic
121                                        vs negative/inverted logic).
122                                        This parameter can be a value of @ref UART_Data_Inv */
123                                        
124   uint32_t Swap;                  /*!< Specifies whether TX and RX pins are swapped.   
125                                        This parameter can be a value of @ref UART_Rx_Tx_Swap */
126                                        
127   uint32_t OverrunDisable;        /*!< Specifies whether the reception overrun detection is disabled.   
128                                        This parameter can be a value of @ref UART_Overrun_Disable */
129                                        
130   uint32_t DMADisableonRxError;   /*!< Specifies whether the DMA is disabled in case of reception error.     
131                                        This parameter can be a value of @ref UART_DMA_Disable_on_Rx_Error */
132                                        
133   uint32_t AutoBaudRateEnable;    /*!< Specifies whether auto Baud rate detection is enabled.     
134                                        This parameter can be a value of @ref UART_AutoBaudRate_Enable */  
135                                        
136   uint32_t AutoBaudRateMode;      /*!< If auto Baud rate detection is enabled, specifies how the rate 
137                                        detection is carried out.     
138                                        This parameter can be a value of @ref UARTEx_AutoBaud_Rate_Mode */
139                                     
140   uint32_t MSBFirst;              /*!< Specifies whether MSB is sent first on UART line.      
141                                        This parameter can be a value of @ref UART_MSB_First */
142 } UART_AdvFeatureInitTypeDef;
143
144 /** 
145   * @brief HAL UART State structures definition  
146   */ 
147 typedef enum
148 {
149   HAL_UART_STATE_RESET             = 0x00,    /*!< Peripheral is not initialized                      */
150   HAL_UART_STATE_READY             = 0x01,    /*!< Peripheral Initialized and ready for use           */
151   HAL_UART_STATE_BUSY              = 0x02,    /*!< an internal process is ongoing                     */
152   HAL_UART_STATE_BUSY_TX           = 0x12,    /*!< Data Transmission process is ongoing               */
153   HAL_UART_STATE_BUSY_RX           = 0x22,    /*!< Data Reception process is ongoing                  */
154   HAL_UART_STATE_BUSY_TX_RX        = 0x32,    /*!< Data Transmission and Reception process is ongoing */
155   HAL_UART_STATE_TIMEOUT           = 0x03,    /*!< Timeout state                                      */
156   HAL_UART_STATE_ERROR             = 0x04     /*!< Error                                              */
157 }HAL_UART_StateTypeDef;
158
159 /**
160   * @brief UART clock sources definition
161   */
162 typedef enum
163 {
164   UART_CLOCKSOURCE_PCLK1     = 0x00, /*!< PCLK1 clock source     */
165   UART_CLOCKSOURCE_HSI       = 0x02, /*!< HSI clock source       */
166   UART_CLOCKSOURCE_SYSCLK    = 0x04, /*!< SYSCLK clock source    */
167   UART_CLOCKSOURCE_LSE       = 0x08, /*!< LSE clock source       */
168   UART_CLOCKSOURCE_UNDEFINED = 0x10  /*!< undefined clock source */  
169 }UART_ClockSourceTypeDef;
170
171 /** 
172   * @brief  UART handle Structure definition  
173   */  
174 typedef struct
175 {
176   USART_TypeDef            *Instance;        /*!< UART registers base address        */
177
178   UART_InitTypeDef         Init;             /*!< UART communication parameters      */
179
180   UART_AdvFeatureInitTypeDef AdvancedInit;   /*!< UART Advanced Features initialization parameters */
181
182   uint8_t                  *pTxBuffPtr;      /*!< Pointer to UART Tx transfer Buffer */
183
184   uint16_t                 TxXferSize;       /*!< UART Tx Transfer size              */
185
186   uint16_t                 TxXferCount;      /*!< UART Tx Transfer Counter           */
187
188   uint8_t                  *pRxBuffPtr;      /*!< Pointer to UART Rx transfer Buffer */
189
190   uint16_t                 RxXferSize;       /*!< UART Rx Transfer size              */
191
192   uint16_t                 RxXferCount;      /*!< UART Rx Transfer Counter           */
193
194   uint16_t                 Mask;             /*!< UART Rx RDR register mask          */
195
196   DMA_HandleTypeDef        *hdmatx;          /*!< UART Tx DMA Handle parameters      */
197
198   DMA_HandleTypeDef        *hdmarx;          /*!< UART Rx DMA Handle parameters      */
199
200   HAL_LockTypeDef          Lock;             /*!< Locking object                     */
201
202   HAL_UART_StateTypeDef    State;            /*!< UART communication state           */
203   
204   __IO uint32_t            ErrorCode;        /*!< UART Error code
205                                                   This parameter can be a value of @ref UART_Error */
206   
207 }UART_HandleTypeDef;
208
209 /**
210   * @}
211   */
212   
213 /* Exported constants --------------------------------------------------------*/
214 /** @defgroup UART_Exported_Constants UART Exported constants
215   * @{
216   */
217
218 /** @defgroup UART_Error UART Error
219   * @{
220   */
221 #define HAL_UART_ERROR_NONE      ((uint32_t)0x00000000)    /*!< No error            */
222 #define HAL_UART_ERROR_PE        ((uint32_t)0x00000001)    /*!< Parity error        */
223 #define HAL_UART_ERROR_NE        ((uint32_t)0x00000002)    /*!< Noise error         */
224 #define HAL_UART_ERROR_FE        ((uint32_t)0x00000004)    /*!< frame error         */
225 #define HAL_UART_ERROR_ORE       ((uint32_t)0x00000008)    /*!< Overrun error       */
226 #define HAL_UART_ERROR_DMA       ((uint32_t)0x00000010)    /*!< DMA transfer error  */
227 /**
228   * @}
229   */ 
230
231 /** @defgroup UART_Stop_Bits   UART Number of Stop Bits
232   * @{
233   */
234 #define UART_STOPBITS_1                     ((uint32_t)0x0000)
235 #define UART_STOPBITS_2                     ((uint32_t)USART_CR2_STOP_1)
236 #define UART_STOPBITS_1_5                   ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1))
237 #define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_1) || \
238                                     ((STOPBITS) == UART_STOPBITS_2) || \
239                                     ((STOPBITS) == UART_STOPBITS_1_5))
240 /**
241   * @}
242   */ 
243
244 /** @defgroup UART_Parity  UART Parity
245   * @{
246   */ 
247 #define UART_PARITY_NONE                    ((uint32_t)0x0000)
248 #define UART_PARITY_EVEN                    ((uint32_t)USART_CR1_PCE)
249 #define UART_PARITY_ODD                     ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) 
250 #define IS_UART_PARITY(PARITY) (((PARITY) == UART_PARITY_NONE) || \
251                                 ((PARITY) == UART_PARITY_EVEN) || \
252                                 ((PARITY) == UART_PARITY_ODD))
253 /**
254   * @}
255   */ 
256
257 /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
258   * @{
259   */ 
260 #define UART_HWCONTROL_NONE                  ((uint32_t)0x0000)
261 #define UART_HWCONTROL_RTS                   ((uint32_t)USART_CR3_RTSE)
262 #define UART_HWCONTROL_CTS                   ((uint32_t)USART_CR3_CTSE)
263 #define UART_HWCONTROL_RTS_CTS               ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE))
264 #define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL)\
265                               (((CONTROL) == UART_HWCONTROL_NONE) || \
266                                ((CONTROL) == UART_HWCONTROL_RTS) || \
267                                ((CONTROL) == UART_HWCONTROL_CTS) || \
268                                ((CONTROL) == UART_HWCONTROL_RTS_CTS))
269 /**
270   * @}
271   */
272
273 /** @defgroup UART_Mode UART Transfer Mode
274   * @{
275   */ 
276 #define UART_MODE_RX                        ((uint32_t)USART_CR1_RE)
277 #define UART_MODE_TX                        ((uint32_t)USART_CR1_TE)
278 #define UART_MODE_TX_RX                     ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
279 #define IS_UART_MODE(MODE) ((((MODE) & (~((uint32_t)(UART_MODE_TX_RX)))) == (uint32_t)0x00) && ((MODE) != (uint32_t)0x00))
280 /**
281   * @}
282   */
283     
284  /** @defgroup UART_State  UART State
285   * @{
286   */ 
287 #define UART_STATE_DISABLE                  ((uint32_t)0x0000)
288 #define UART_STATE_ENABLE                   ((uint32_t)USART_CR1_UE)
289 #define IS_UART_STATE(STATE) (((STATE) == UART_STATE_DISABLE) || \
290                               ((STATE) == UART_STATE_ENABLE))
291 /**
292   * @}
293   */
294
295 /** @defgroup UART_Over_Sampling UART Over Sampling
296   * @{
297   */
298 #define UART_OVERSAMPLING_16                    ((uint32_t)0x0000)
299 #define UART_OVERSAMPLING_8                     ((uint32_t)USART_CR1_OVER8)
300 #define IS_UART_OVERSAMPLING(SAMPLING) (((SAMPLING) == UART_OVERSAMPLING_16) || \
301                                         ((SAMPLING) == UART_OVERSAMPLING_8))
302 /**
303   * @}
304   */ 
305
306 /** @defgroup UART_OneBit_Sampling UART One Bit Sampling Method
307   * @{
308   */
309 #define UART_ONEBIT_SAMPLING_DISABLED   ((uint32_t)0x0000)
310 #define UART_ONEBIT_SAMPLING_ENABLED    ((uint32_t)USART_CR3_ONEBIT)
311 #define IS_UART_ONEBIT_SAMPLING(ONEBIT) (((ONEBIT) == UART_ONEBIT_SAMPLING_DISABLED) || \
312                                          ((ONEBIT) == UART_ONEBIT_SAMPLING_ENABLED))
313 /**
314   * @}
315   */  
316   
317
318 /** @defgroup UART_Receiver_TimeOut UART Receiver TimeOut 
319   * @{
320   */
321 #define UART_RECEIVER_TIMEOUT_DISABLE   ((uint32_t)0x00000000)
322 #define UART_RECEIVER_TIMEOUT_ENABLE    ((uint32_t)USART_CR2_RTOEN)
323 #define IS_UART_RECEIVER_TIMEOUT(TIMEOUT) (((TIMEOUT) == UART_RECEIVER_TIMEOUT_DISABLE) || \
324                                            ((TIMEOUT) == UART_RECEIVER_TIMEOUT_ENABLE))
325 /**
326   * @}
327   */ 
328
329 /** @defgroup UART_One_Bit     UART One Bit sampling
330   * @{
331   */
332 #define UART_ONE_BIT_SAMPLE_DISABLED          ((uint32_t)0x00000000)
333 #define UART_ONE_BIT_SAMPLE_ENABLED           ((uint32_t)USART_CR3_ONEBIT)
334 #define IS_UART_ONEBIT_SAMPLE(ONEBIT)         (((ONEBIT) == UART_ONE_BIT_SAMPLE_DISABLED) || \
335                                                   ((ONEBIT) == UART_ONE_BIT_SAMPLE_ENABLED))
336 /**
337   * @}
338   */  
339   
340 /** @defgroup UART_DMA_Tx    UART DMA Tx
341   * @{
342   */
343 #define UART_DMA_TX_DISABLE          ((uint32_t)0x00000000)
344 #define UART_DMA_TX_ENABLE           ((uint32_t)USART_CR3_DMAT)
345 #define IS_UART_DMA_TX(DMATX)         (((DMATX) == UART_DMA_TX_DISABLE) || \
346                                        ((DMATX) == UART_DMA_TX_ENABLE))
347 /**
348   * @}
349   */
350
351 /** @defgroup UART_DMA_Rx   UART DMA Rx
352   * @{
353   */
354 #define UART_DMA_RX_DISABLE           ((uint32_t)0x0000)
355 #define UART_DMA_RX_ENABLE            ((uint32_t)USART_CR3_DMAR)
356 #define IS_UART_DMA_RX(DMARX)         (((DMARX) == UART_DMA_RX_DISABLE) || \
357                                        ((DMARX) == UART_DMA_RX_ENABLE))
358 /**
359   * @}
360   */
361
362 /** @defgroup UART_Half_Duplex_Selection  UART Half Duplex Selection
363   * @{
364   */
365 #define UART_HALF_DUPLEX_DISABLE          ((uint32_t)0x0000)
366 #define UART_HALF_DUPLEX_ENABLE           ((uint32_t)USART_CR3_HDSEL)
367 #define IS_UART_HALF_DUPLEX(HDSEL)         (((HDSEL) == UART_HALF_DUPLEX_DISABLE) || \
368                                             ((HDSEL) == UART_HALF_DUPLEX_ENABLE))
369 /**
370   * @}
371   */    
372
373 /** @defgroup UART_WakeUp_Address_Length    UART WakeUp Address Length
374   * @{
375   */
376 #define UART_ADDRESS_DETECT_4B                ((uint32_t)0x00000000)
377 #define UART_ADDRESS_DETECT_7B                ((uint32_t)USART_CR2_ADDM7)
378 #define IS_UART_ADDRESSLENGTH_DETECT(ADDRESS) (((ADDRESS) == UART_ADDRESS_DETECT_4B) || \
379                                                ((ADDRESS) == UART_ADDRESS_DETECT_7B))
380 /**
381   * @}
382   */
383
384 /** @defgroup UART_WakeUp_Methods   UART WakeUp Methods
385   * @{
386   */
387 #define UART_WAKEUPMETHOD_IDLELINE                ((uint32_t)0x00000000)
388 #define UART_WAKEUPMETHOD_ADDRESSMARK             ((uint32_t)USART_CR1_WAKE)
389 #define IS_UART_WAKEUPMETHOD(WAKEUP) (((WAKEUP) == UART_WAKEUPMETHOD_IDLELINE) || \
390                                        ((WAKEUP) == UART_WAKEUPMETHOD_ADDRESSMARK))
391 /**
392   * @}
393   */
394
395 /** @defgroup UART_IT   UART IT 
396   *       Elements values convention: 000000000XXYYYYYb
397   *           - YYYYY  : Interrupt source position in the XX register (5bits)
398   *           - XX  : Interrupt source register (2bits)
399   *                 - 01: CR1 register
400   *                 - 10: CR2 register
401   *                 - 11: CR3 register
402   * @{
403   */
404 #define UART_IT_ERR                         ((uint16_t)0x0060)
405
406 /**       Elements values convention: 0000ZZZZ00000000b
407   *           - ZZZZ  : Flag position in the ISR register(4bits)
408   */
409 #define UART_IT_ORE                         ((uint16_t)0x0300)
410 #define UART_IT_NE                          ((uint16_t)0x0200)
411 #define UART_IT_FE                          ((uint16_t)0x0100)
412 /**
413   * @}
414   */
415
416 /** @defgroup UART_Advanced_Features_Initialization_Type  UART Advanced Feature Initialization Type
417   * @{
418   */
419 #define UART_ADVFEATURE_NO_INIT                 ((uint32_t)0x00000000)
420 #define UART_ADVFEATURE_TXINVERT_INIT           ((uint32_t)0x00000001)
421 #define UART_ADVFEATURE_RXINVERT_INIT           ((uint32_t)0x00000002)
422 #define UART_ADVFEATURE_DATAINVERT_INIT         ((uint32_t)0x00000004)
423 #define UART_ADVFEATURE_SWAP_INIT               ((uint32_t)0x00000008)
424 #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT   ((uint32_t)0x00000010)
425 #define UART_ADVFEATURE_DMADISABLEONERROR_INIT  ((uint32_t)0x00000020)
426 #define UART_ADVFEATURE_AUTOBAUDRATE_INIT       ((uint32_t)0x00000040)
427 #define UART_ADVFEATURE_MSBFIRST_INIT           ((uint32_t)0x00000080)
428 #define IS_UART_ADVFEATURE_INIT(INIT)           ((INIT) <= (UART_ADVFEATURE_NO_INIT | \
429                                                             UART_ADVFEATURE_TXINVERT_INIT | \
430                                                             UART_ADVFEATURE_RXINVERT_INIT | \
431                                                             UART_ADVFEATURE_DATAINVERT_INIT | \
432                                                             UART_ADVFEATURE_SWAP_INIT | \
433                                                             UART_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
434                                                             UART_ADVFEATURE_DMADISABLEONERROR_INIT   | \
435                                                             UART_ADVFEATURE_AUTOBAUDRATE_INIT | \
436                                                             UART_ADVFEATURE_MSBFIRST_INIT))
437 /**
438   * @}
439   */
440
441 /** @defgroup UART_Tx_Inv UART Advanced Feature TX Pin Active Level Inversion
442   * @{
443   */
444 #define UART_ADVFEATURE_TXINV_DISABLE   ((uint32_t)0x00000000)
445 #define UART_ADVFEATURE_TXINV_ENABLE    ((uint32_t)USART_CR2_TXINV)
446 #define IS_UART_ADVFEATURE_TXINV(TXINV) (((TXINV) == UART_ADVFEATURE_TXINV_DISABLE) || \
447                                          ((TXINV) == UART_ADVFEATURE_TXINV_ENABLE))
448 /**
449   * @}
450   */
451
452 /** @defgroup UART_Rx_Inv UART Advanced Feature RX Pin Active Level Inversion
453   * @{
454   */
455 #define UART_ADVFEATURE_RXINV_DISABLE   ((uint32_t)0x00000000)
456 #define UART_ADVFEATURE_RXINV_ENABLE    ((uint32_t)USART_CR2_RXINV)
457 #define IS_UART_ADVFEATURE_RXINV(RXINV) (((RXINV) == UART_ADVFEATURE_RXINV_DISABLE) || \
458                                          ((RXINV) == UART_ADVFEATURE_RXINV_ENABLE))
459 /**
460   * @}
461   */
462
463 /** @defgroup UART_Data_Inv  UART Advanced Feature Binary Data Inversion
464   * @{
465   */
466 #define UART_ADVFEATURE_DATAINV_DISABLE     ((uint32_t)0x00000000)
467 #define UART_ADVFEATURE_DATAINV_ENABLE      ((uint32_t)USART_CR2_DATAINV)
468 #define IS_UART_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == UART_ADVFEATURE_DATAINV_DISABLE) || \
469                                              ((DATAINV) == UART_ADVFEATURE_DATAINV_ENABLE))
470 /**
471   * @}
472   */
473
474 /** @defgroup UART_Rx_Tx_Swap UART Advanced Feature RX TX Pins Swap
475   * @{
476   */
477 #define UART_ADVFEATURE_SWAP_DISABLE   ((uint32_t)0x00000000)
478 #define UART_ADVFEATURE_SWAP_ENABLE    ((uint32_t)USART_CR2_SWAP)
479 #define IS_UART_ADVFEATURE_SWAP(SWAP) (((SWAP) == UART_ADVFEATURE_SWAP_DISABLE) || \
480                                        ((SWAP) == UART_ADVFEATURE_SWAP_ENABLE))
481 /**
482   * @}
483   */
484
485 /** @defgroup UART_Overrun_Disable  UART Advanced Feature Overrun Disable
486   * @{
487   */
488 #define UART_ADVFEATURE_OVERRUN_ENABLE   ((uint32_t)0x00000000)
489 #define UART_ADVFEATURE_OVERRUN_DISABLE  ((uint32_t)USART_CR3_OVRDIS)
490 #define IS_UART_OVERRUN(OVERRUN)         (((OVERRUN) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
491                                           ((OVERRUN) == UART_ADVFEATURE_OVERRUN_DISABLE))
492 /**
493   * @}
494   */
495
496 /** @defgroup UART_AutoBaudRate_Enable  UART Advanced Feature Auto BaudRate Enable
497   * @{
498   */
499 #define UART_ADVFEATURE_AUTOBAUDRATE_DISABLE           ((uint32_t)0x00000000)
500 #define UART_ADVFEATURE_AUTOBAUDRATE_ENABLE            ((uint32_t)USART_CR2_ABREN)
501 #define IS_UART_ADVFEATURE_AUTOBAUDRATE(AUTOBAUDRATE)  (((AUTOBAUDRATE) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
502                                                         ((AUTOBAUDRATE) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))
503 /**
504   * @}
505   */
506
507 /** @defgroup UART_DMA_Disable_on_Rx_Error   UART Advanced Feature DMA Disable On Rx Error
508   * @{
509   */
510 #define UART_ADVFEATURE_DMA_ENABLEONRXERROR       ((uint32_t)0x00000000)
511 #define UART_ADVFEATURE_DMA_DISABLEONRXERROR      ((uint32_t)USART_CR3_DDRE)
512 #define IS_UART_ADVFEATURE_DMAONRXERROR(DMA)      (((DMA) == UART_ADVFEATURE_DMA_ENABLEONRXERROR) || \
513                                                    ((DMA) == UART_ADVFEATURE_DMA_DISABLEONRXERROR))
514 /**
515   * @}
516   */
517
518 /** @defgroup UART_MSB_First   UART Advanced Feature MSB First
519   * @{
520   */
521 #define UART_ADVFEATURE_MSBFIRST_DISABLE      ((uint32_t)0x00000000)
522 #define UART_ADVFEATURE_MSBFIRST_ENABLE       ((uint32_t)USART_CR2_MSBFIRST)
523 #define IS_UART_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
524                                                ((MSBFIRST) == UART_ADVFEATURE_MSBFIRST_ENABLE))
525 /**
526   * @}
527   */
528
529 /** @defgroup UART_Mute_Mode   UART Advanced Feature Mute Mode Enable
530   * @{
531   */
532 #define UART_ADVFEATURE_MUTEMODE_DISABLE    ((uint32_t)0x00000000)
533 #define UART_ADVFEATURE_MUTEMODE_ENABLE    ((uint32_t)USART_CR1_MME)
534 #define IS_UART_MUTE_MODE(MUTE)           (((MUTE) == UART_ADVFEATURE_MUTEMODE_DISABLE) || \
535                                            ((MUTE) == UART_ADVFEATURE_MUTEMODE_ENABLE))
536 /**
537   * @}
538   */
539
540 /** @defgroup UART_CR2_ADDRESS_LSB_POS    UART Address-matching LSB Position In CR2 Register
541   * @{
542   */
543 #define UART_CR2_ADDRESS_LSB_POS            ((uint32_t) 24)
544 /**
545   * @}
546   */
547
548 /** @defgroup UART_DriverEnable_Polarity      UART DriverEnable Polarity
549   * @{
550   */
551 #define UART_DE_POLARITY_HIGH            ((uint32_t)0x00000000)
552 #define UART_DE_POLARITY_LOW             ((uint32_t)USART_CR3_DEP)
553 #define IS_UART_DE_POLARITY(POLARITY)    (((POLARITY) == UART_DE_POLARITY_HIGH) || \
554                                           ((POLARITY) == UART_DE_POLARITY_LOW))
555 /**
556   * @}
557   */
558
559 /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS    UART Driver Enable Assertion Time LSB Position In CR1 Register
560   * @{
561   */
562 #define UART_CR1_DEAT_ADDRESS_LSB_POS            ((uint32_t) 21)
563 /**
564   * @}
565   */
566
567 /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS    UART Driver Enable DeAssertion Time LSB Position In CR1 Register
568   * @{
569   */
570 #define UART_CR1_DEDT_ADDRESS_LSB_POS            ((uint32_t) 16)
571 /**
572   * @}
573   */
574
575 /** @defgroup UART_Interruption_Mask    UART Interruptions Flag Mask
576   * @{
577   */  
578 #define UART_IT_MASK                             ((uint32_t)0x001F)  
579 /**
580   * @}
581   */
582   
583 /** @defgroup UART_TimeOut_Value    UART polling-based communications time-out value
584   * @{
585   */   
586 #define HAL_UART_TIMEOUT_VALUE                           0x1FFFFFF  
587 /**
588   * @}
589   */
590
591 /**
592   * @}
593   */
594
595 /* Exported macro ------------------------------------------------------------*/
596 /** @defgroup UART_Exported_Macros UART Exported Macros
597   * @{
598   */
599   
600 /** @brief  Reset UART handle state
601   * @param  __HANDLE__: UART handle.
602   * @retval None
603   */
604 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_UART_STATE_RESET)
605
606 /** @brief  Checks whether the specified UART flag is set or not.
607   * @param  __HANDLE__: specifies the UART Handle.
608   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
609   *         UART peripheral (datasheet: up to four USART/UARTs)
610   * @param  __FLAG__: specifies the flag to check.
611   *        This parameter can be one of the following values:
612   *            @arg UART_FLAG_REACK: Receive enable ackowledge flag
613   *            @arg UART_FLAG_TEACK: Transmit enable ackowledge flag
614   *            @arg UART_FLAG_WUF:   Wake up from stop mode flag (not available on F030xx devices)
615   *            @arg UART_FLAG_RWU:   Receiver wake up flag (not available on F030xx devices)
616   *            @arg UART_FLAG_SBKF:  Send Break flag
617   *            @arg UART_FLAG_CMF:   Character match flag
618   *            @arg UART_FLAG_BUSY:  Busy flag
619   *            @arg UART_FLAG_ABRF:  Auto Baud rate detection flag
620   *            @arg UART_FLAG_ABRE:  Auto Baud rate detection error flag
621   *            @arg UART_FLAG_EOBF:  End of block flag (not available on F030xx devices) 
622   *            @arg UART_FLAG_RTOF:  Receiver timeout flag                     
623   *            @arg UART_FLAG_CTS:   CTS Change flag
624   *            @arg UART_FLAG_LBD:   LIN Break detection flag (not available on F030xx devices)
625   *            @arg UART_FLAG_TXE:   Transmit data register empty flag
626   *            @arg UART_FLAG_TC:    Transmission Complete flag
627   *            @arg UART_FLAG_RXNE:  Receive data register not empty flag
628   *            @arg UART_FLAG_IDLE:  Idle Line detection flag
629   *            @arg UART_FLAG_ORE:   OverRun Error flag
630   *            @arg UART_FLAG_NE:    Noise Error flag
631   *            @arg UART_FLAG_FE:    Framing Error flag
632   *            @arg UART_FLAG_PE:    Parity Error flag
633   * @retval The new state of __FLAG__ (TRUE or FALSE).
634   */
635 #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))   
636
637 /** @brief  Enables the specified UART interrupt.
638   * @param  __HANDLE__: specifies the UART Handle.
639   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
640   *         UART peripheral. (datasheet: up to four USART/UARTs)
641   * @param  __INTERRUPT__: specifies the UART interrupt source to enable.
642   *          This parameter can be one of the following values:
643   *            @arg UART_IT_WUF:  Wakeup from stop mode interrupt (not available on F030xx devices)
644   *            @arg UART_IT_CM:   Character match interrupt
645   *            @arg UART_IT_CTS:  CTS change interrupt
646   *            @arg UART_IT_LBD:  LIN Break detection interrupt (not available on F030xx devices)
647   *            @arg UART_IT_TXE:  Transmit Data Register empty interrupt
648   *            @arg UART_IT_TC:   Transmission complete interrupt
649   *            @arg UART_IT_RXNE: Receive Data register not empty interrupt
650   *            @arg UART_IT_IDLE: Idle line detection interrupt
651   *            @arg UART_IT_PE:   Parity Error interrupt
652   *            @arg UART_IT_ERR:  Error interrupt(Frame error, noise error, overrun error)
653   * @retval None
654   */
655 #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__)   (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
656                                                            ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
657                                                            ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))))
658
659
660 /** @brief  Disables the specified UART interrupt.
661   * @param  __HANDLE__: specifies the UART Handle.
662   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
663   *         UART peripheral. (datasheet: up to four USART/UARTs)
664   * @param  __INTERRUPT__: specifies the UART interrupt source to disable.
665   *          This parameter can be one of the following values:
666   *            @arg UART_IT_WUF:  Wakeup from stop mode interrupt (not available on F030xx devices)
667   *            @arg UART_IT_CM:   Character match interrupt            
668   *            @arg UART_IT_CTS:  CTS change interrupt
669   *            @arg UART_IT_LBD:  LIN Break detection interrupt (not available on F030xx devices)
670   *            @arg UART_IT_TXE:  Transmit Data Register empty interrupt
671   *            @arg UART_IT_TC:   Transmission complete interrupt
672   *            @arg UART_IT_RXNE: Receive Data register not empty interrupt
673   *            @arg UART_IT_IDLE: Idle line detection interrupt
674   *            @arg UART_IT_PE:   Parity Error interrupt
675   *            @arg UART_IT_ERR:  Error interrupt(Frame error, noise error, overrun error)
676   * @retval None
677   */
678 #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__)  (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
679                                                            ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
680                                                            ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))))
681
682 /** @brief  Checks whether the specified UART interrupt has occurred or not.
683   * @param  __HANDLE__: specifies the UART Handle.
684   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
685   *         UART peripheral. (datasheet: up to four USART/UARTs)
686   * @param  __IT__: specifies the UART interrupt to check.
687   *          This parameter can be one of the following values:
688   *            @arg UART_IT_WUF:  Wakeup from stop mode interrupt (not available on F030xx devices)
689   *            @arg UART_IT_CM:   Character match interrupt              
690   *            @arg UART_IT_CTS:  CTS change interrupt
691   *            @arg UART_IT_LBD:  LIN Break detection interrupt (not available on F030xx devices)
692   *            @arg UART_IT_TXE:  Transmit Data Register empty interrupt
693   *            @arg UART_IT_TC:   Transmission complete interrupt
694   *            @arg UART_IT_RXNE: Receive Data register not empty interrupt
695   *            @arg UART_IT_IDLE: Idle line detection interrupt
696   *            @arg UART_IT_ORE:  OverRun Error interrupt
697   *            @arg UART_IT_NE:   Noise Error interrupt
698   *            @arg UART_IT_FE:   Framing Error interrupt
699   *            @arg UART_IT_PE:   Parity Error interrupt  
700   * @retval The new state of __IT__ (TRUE or FALSE).
701   */
702 #define __HAL_UART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08))) 
703
704 /** @brief  Checks whether the specified UART interrupt source is enabled.
705   * @param  __HANDLE__: specifies the UART Handle.
706   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
707   *         UART peripheral. (datasheet: up to four USART/UARTs)
708   * @param  __IT__: specifies the UART interrupt source to check.
709   *          This parameter can be one of the following values:
710   *            @arg UART_IT_WUF:  Wakeup from stop mode interrupt (not available on F030xx devices)
711   *            @arg UART_IT_CM:   Character match interrupt              
712   *            @arg UART_IT_CTS: CTS change interrupt
713   *            @arg UART_IT_LBD: LIN Break detection interrupt (not available on F030xx devices)
714   *            @arg UART_IT_TXE: Transmit Data Register empty interrupt
715   *            @arg UART_IT_TC:  Transmission complete interrupt
716   *            @arg UART_IT_RXNE: Receive Data register not empty interrupt
717   *            @arg UART_IT_IDLE: Idle line detection interrupt
718   *            @arg UART_IT_ORE: OverRun Error interrupt
719   *            @arg UART_IT_NE: Noise Error interrupt
720   *            @arg UART_IT_FE: Framing Error interrupt
721   *            @arg UART_IT_PE: Parity Error interrupt  
722   * @retval The new state of __IT__ (TRUE or FALSE).
723   */
724 #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2)? \
725                                                        (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & UART_IT_MASK)))
726
727 /** @brief  Clears the specified UART ISR flag, in setting the proper ICR register flag.
728   * @param  __HANDLE__: specifies the UART Handle.
729   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
730   *         UART peripheral. (datasheet: up to four USART/UARTs)
731   * @param  __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
732   *                       to clear the corresponding interrupt
733   *          This parameter can be one of the following values:
734   *            @arg UART_CLEAR_PEF: Parity Error Clear Flag          
735   *            @arg UART_CLEAR_FEF: Framing Error Clear Flag         
736   *            @arg UART_CLEAR_NEF: Noise detected Clear Flag        
737   *            @arg UART_CLEAR_OREF: OverRun Error Clear Flag         
738   *            @arg UART_CLEAR_IDLEF: IDLE line detected Clear Flag    
739   *            @arg UART_CLEAR_TCF: Transmission Complete Clear Flag 
740   *            @arg UART_CLEAR_LBDF: LIN Break Detection Clear Flag (not available on F030xx devices)   
741   *            @arg UART_CLEAR_CTSF: CTS Interrupt Clear Flag      
742   *            @arg UART_CLEAR_RTOF: Receiver Time Out Clear Flag     
743   *            @arg UART_CLEAR_EOBF: End Of Block Clear Flag  (not available on F030xx devices)      
744   *            @arg UART_CLEAR_CMF: Character Match Clear Flag       
745   *            @arg UART_CLEAR_WUF:  Wake Up from stop mode Clear Flag (not available on F030xx devices) 
746   * @retval None
747   */
748 #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) 
749
750 /** @brief  Set a specific UART request flag.
751   * @param  __HANDLE__: specifies the UART Handle.
752   *         This parameter can be UARTx where x: 1, 2, 3 or 4 to select the USART or 
753   *         UART peripheral. (datasheet: up to four USART/UARTs)
754   * @param  __REQ__: specifies the request flag to set
755   *          This parameter can be one of the following values:
756   *            @arg UART_AUTOBAUD_REQUEST: Auto-Baud Rate Request     
757   *            @arg UART_SENDBREAK_REQUEST: Send Break Request         
758   *            @arg UART_MUTE_MODE_REQUEST: Mute Mode Request 
759   *            @arg UART_RXDATA_FLUSH_REQUEST: Receive Data flush Request 
760   *            @arg UART_TXDATA_FLUSH_REQUEST: Transmit data flush Request (not available on F030xx devices) 
761   * @retval None
762   */
763 #define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) 
764
765 /** @brief  Enable UART
766   * @param  __HANDLE__: specifies the UART Handle.
767   *         The Handle Instance can be UARTx where x: 1, 2, 3, 4 or 5 to select the UART peripheral
768   * @retval None
769   */ 
770 #define __HAL_UART_ENABLE(__HANDLE__)                   ((__HANDLE__)->Instance->CR1 |=  USART_CR1_UE)
771
772 /** @brief  Disable UART
773   * @param  __HANDLE__: specifies the UART Handle.
774   *         The Handle Instance can be UARTx where x: 1, 2, 3, 4 or 5 to select the UART peripheral
775   * @retval None
776   */
777 #define __HAL_UART_DISABLE(__HANDLE__)                  ((__HANDLE__)->Instance->CR1 &=  ~USART_CR1_UE)
778
779 /**
780   * @}
781   */
782
783 /* Private macros --------------------------------------------------------*/
784 /** @defgroup UART_Private_Macros   UART Private Macros
785   * @{
786   */
787
788 /** @brief  BRR division operation to set BRR register in 8-bit oversampling mode
789   * @param  _PCLK_: UART clock
790   * @param  _BAUD_: Baud rate set by the user
791   * @retval Division result
792   */
793 #define __DIV_SAMPLING8(_PCLK_, _BAUD_)             (((_PCLK_)*2)/((_BAUD_)))
794
795 /** @brief  BRR division operation to set BRR register in 16-bit oversampling mode
796   * @param  _PCLK_: UART clock
797   * @param  _BAUD_: Baud rate set by the user
798   * @retval Division result
799   */
800 #define __DIV_SAMPLING16(_PCLK_, _BAUD_)             (((_PCLK_))/((_BAUD_)))
801
802 /** @brief  Check UART Baud rate
803   * @param  BAUDRATE: Baudrate specified by the user
804   *         The maximum Baud Rate is derived from the maximum clock on F0 (i.e. 48 MHz) 
805   *         divided by the smallest oversampling used on the USART (i.e. 8) 
806   * @retval Test result (TRUE or FALSE).
807   */
808 #define IS_UART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 9000001)
809
810 /** @brief  Check UART assertion time
811   * @param  TIME: 5-bit value assertion time
812   * @retval Test result (TRUE or FALSE). 
813   */ 
814 #define IS_UART_ASSERTIONTIME(TIME)    ((TIME) <= 0x1F)
815
816 /** @brief  Check UART deassertion time
817   * @param  TIME: 5-bit value deassertion time
818   * @retval Test result (TRUE or FALSE). 
819   */
820 #define IS_UART_DEASSERTIONTIME(TIME) ((TIME) <= 0x1F)
821
822 /**
823   * @}
824   */
825
826 /* Include UART HAL Extension module */
827 #include "stm32f0xx_hal_uart_ex.h"  
828
829 /* Exported functions --------------------------------------------------------*/
830
831 /** @addtogroup UART_Exported_Functions UART Exported Functions
832   * @{
833   */
834   
835 /** @addtogroup UART_Exported_Functions_Group1 Initialization and de-initialization functions 
836   * @{
837   */
838
839 /* Initialization and de-initialization functions  ****************************/
840 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
841 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
842 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
843 HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart);
844 void HAL_UART_MspInit(UART_HandleTypeDef *huart);
845 void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
846
847 /**
848   * @}
849   */
850
851 /** @addtogroup UART_Exported_Functions_Group2 IO operation functions 
852   * @{
853   */
854
855 /* IO operation functions *****************************************************/
856 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
857 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
858 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
859 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
860 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
861 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
862 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
863 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
864 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
865 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
866 void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
867 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
868 void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
869 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
870
871 /**
872   * @}
873   */
874
875 /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions
876   * @{
877   */
878
879 /* Peripheral Control functions ***********************************************/
880 void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
881 HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart);
882 HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart);
883 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
884 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
885
886 /**
887   * @}
888   */
889
890 /** @addtogroup UART_Exported_Functions_Group4 Peripheral State and Errors functions 
891   * @{
892   */
893
894 /* Peripheral State and Errors functions  **************************************************/
895 HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
896 uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
897
898 /**
899   * @}
900   */ 
901
902 /**
903   * @}
904   */ 
905
906 /** @addtogroup UART_Private_Functions
907   * @{
908   */
909 void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
910 HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart);
911 HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart);
912 HAL_StatusTypeDef UART_Transmit_IT(UART_HandleTypeDef *huart);
913 HAL_StatusTypeDef UART_Receive_IT(UART_HandleTypeDef *huart);
914 HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Timeout);
915 /**
916   * @}
917   */ 
918   
919 /**
920   * @}
921   */ 
922
923 /**
924   * @}
925   */
926
927 #ifdef __cplusplus
928 }
929 #endif
930
931 #endif /* __STM32F0xx_HAL_UART_H */
932
933 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
934