Rev 56 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 56 | Rev 77 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32l1xx_hal_usart.h |
3 | * @file stm32l1xx_hal_usart.h |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief Header file of USART HAL module. |
5 | * @brief Header file of USART HAL module. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
9 | * Copyright (c) 2016 STMicroelectronics. |
10 | * All rights reserved.</center></h2> |
10 | * All rights reserved. |
11 | * |
11 | * |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * This software is licensed under terms that can be found in the LICENSE file |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * in the root directory of this software component. |
14 | * License. You may obtain a copy of the License at: |
14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
15 | * opensource.org/licenses/BSD-3-Clause |
15 | * |
16 | * |
16 | ****************************************************************************** |
17 | ****************************************************************************** |
17 | */ |
18 | */ |
18 | |
19 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ |
|
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | #ifndef __STM32L1xx_HAL_USART_H |
21 | #ifndef __STM32L1xx_HAL_USART_H |
21 | #define __STM32L1xx_HAL_USART_H |
22 | #define __STM32L1xx_HAL_USART_H |
22 | |
23 | 23 | #ifdef __cplusplus |
|
24 | #ifdef __cplusplus |
24 | extern "C" { |
25 | extern "C" { |
25 | #endif |
26 | #endif |
26 | |
27 | 27 | /* Includes ------------------------------------------------------------------*/ |
|
28 | /* Includes ------------------------------------------------------------------*/ |
28 | #include "stm32l1xx_hal_def.h" |
29 | #include "stm32l1xx_hal_def.h" |
29 | |
30 | 30 | /** @addtogroup STM32L1xx_HAL_Driver |
|
31 | /** @addtogroup STM32L1xx_HAL_Driver |
31 | * @{ |
32 | * @{ |
32 | */ |
33 | */ |
33 | |
34 | 34 | /** @addtogroup USART |
|
35 | /** @addtogroup USART |
35 | * @{ |
36 | * @{ |
36 | */ |
37 | */ |
37 | |
38 | 38 | /* Exported types ------------------------------------------------------------*/ |
|
39 | /* Exported types ------------------------------------------------------------*/ |
39 | /** @defgroup USART_Exported_Types USART Exported Types |
40 | /** @defgroup USART_Exported_Types USART Exported Types |
40 | * @{ |
41 | * @{ |
41 | */ |
42 | */ |
42 | |
43 | 43 | /** |
|
44 | /** |
44 | * @brief USART Init Structure definition |
45 | * @brief USART Init Structure definition |
45 | */ |
46 | */ |
46 | typedef struct |
47 | typedef struct |
47 | { |
48 | { |
48 | uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. |
49 | uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. |
49 | The baud rate is computed using the following formula: |
50 | The baud rate is computed using the following formula: |
50 | - IntegerDivider = ((PCLKx) / (8 * (husart->Init.BaudRate))) |
51 | - IntegerDivider = ((PCLKx) / (8 * (husart->Init.BaudRate))) |
51 | - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */ |
52 | - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */ |
52 | |
53 | 53 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
|
54 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
54 | This parameter can be a value of @ref USART_Word_Length */ |
55 | This parameter can be a value of @ref USART_Word_Length */ |
55 | |
56 | 56 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
|
57 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
57 | This parameter can be a value of @ref USART_Stop_Bits */ |
58 | This parameter can be a value of @ref USART_Stop_Bits */ |
58 | |
59 | 59 | uint32_t Parity; /*!< Specifies the parity mode. |
|
60 | uint32_t Parity; /*!< Specifies the parity mode. |
60 | This parameter can be a value of @ref USART_Parity |
61 | This parameter can be a value of @ref USART_Parity |
61 | @note When parity is enabled, the computed parity is inserted |
62 | @note When parity is enabled, the computed parity is inserted |
62 | at the MSB position of the transmitted data (9th bit when |
63 | at the MSB position of the transmitted data (9th bit when |
63 | the word length is set to 9 data bits; 8th bit when the |
64 | the word length is set to 9 data bits; 8th bit when the |
64 | word length is set to 8 data bits). */ |
65 | word length is set to 8 data bits). */ |
65 | |
66 | 66 | uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
|
67 | uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
67 | This parameter can be a value of @ref USART_Mode */ |
68 | This parameter can be a value of @ref USART_Mode */ |
68 | |
69 | 69 | uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
|
70 | uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
70 | This parameter can be a value of @ref USART_Clock_Polarity */ |
71 | This parameter can be a value of @ref USART_Clock_Polarity */ |
71 | |
72 | 72 | uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
|
73 | uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
73 | This parameter can be a value of @ref USART_Clock_Phase */ |
74 | This parameter can be a value of @ref USART_Clock_Phase */ |
74 | |
75 | 75 | uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
|
76 | uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
76 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
77 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
77 | This parameter can be a value of @ref USART_Last_Bit */ |
78 | This parameter can be a value of @ref USART_Last_Bit */ |
78 | } USART_InitTypeDef; |
79 | } USART_InitTypeDef; |
79 | |
80 | 80 | /** |
|
81 | /** |
81 | * @brief HAL State structures definition |
82 | * @brief HAL State structures definition |
82 | */ |
83 | */ |
83 | typedef enum |
84 | typedef enum |
84 | { |
85 | { |
85 | HAL_USART_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized */ |
86 | HAL_USART_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized */ |
86 | HAL_USART_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ |
87 | HAL_USART_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ |
87 | HAL_USART_STATE_BUSY = 0x02U, /*!< an internal process is ongoing */ |
88 | HAL_USART_STATE_BUSY = 0x02U, /*!< an internal process is ongoing */ |
88 | HAL_USART_STATE_BUSY_TX = 0x12U, /*!< Data Transmission process is ongoing */ |
89 | HAL_USART_STATE_BUSY_TX = 0x12U, /*!< Data Transmission process is ongoing */ |
89 | HAL_USART_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */ |
90 | HAL_USART_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */ |
90 | HAL_USART_STATE_BUSY_TX_RX = 0x32U, /*!< Data Transmission Reception process is ongoing */ |
91 | HAL_USART_STATE_BUSY_TX_RX = 0x32U, /*!< Data Transmission Reception process is ongoing */ |
91 | HAL_USART_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ |
92 | HAL_USART_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ |
92 | HAL_USART_STATE_ERROR = 0x04U /*!< Error */ |
93 | HAL_USART_STATE_ERROR = 0x04U /*!< Error */ |
93 | } HAL_USART_StateTypeDef; |
94 | } HAL_USART_StateTypeDef; |
94 | |
95 | 95 | /** |
|
96 | /** |
96 | * @brief USART handle Structure definition |
97 | * @brief USART handle Structure definition |
97 | */ |
98 | */ |
98 | typedef struct __USART_HandleTypeDef |
99 | typedef struct __USART_HandleTypeDef |
99 | { |
100 | { |
100 | USART_TypeDef *Instance; /*!< USART registers base address */ |
101 | USART_TypeDef *Instance; /*!< USART registers base address */ |
101 | |
102 | 102 | USART_InitTypeDef Init; /*!< Usart communication parameters */ |
|
103 | USART_InitTypeDef Init; /*!< Usart communication parameters */ |
103 | |
104 | 104 | const uint8_t *pTxBuffPtr; /*!< Pointer to Usart Tx transfer Buffer */ |
|
105 | uint8_t *pTxBuffPtr; /*!< Pointer to Usart Tx transfer Buffer */ |
105 | |
106 | 106 | uint16_t TxXferSize; /*!< Usart Tx Transfer size */ |
|
107 | uint16_t TxXferSize; /*!< Usart Tx Transfer size */ |
107 | |
108 | 108 | __IO uint16_t TxXferCount; /*!< Usart Tx Transfer Counter */ |
|
109 | __IO uint16_t TxXferCount; /*!< Usart Tx Transfer Counter */ |
109 | |
110 | 110 | uint8_t *pRxBuffPtr; /*!< Pointer to Usart Rx transfer Buffer */ |
|
111 | uint8_t *pRxBuffPtr; /*!< Pointer to Usart Rx transfer Buffer */ |
111 | |
112 | 112 | uint16_t RxXferSize; /*!< Usart Rx Transfer size */ |
|
113 | uint16_t RxXferSize; /*!< Usart Rx Transfer size */ |
113 | |
114 | 114 | __IO uint16_t RxXferCount; /*!< Usart Rx Transfer Counter */ |
|
115 | __IO uint16_t RxXferCount; /*!< Usart Rx Transfer Counter */ |
115 | |
116 | 116 | DMA_HandleTypeDef *hdmatx; /*!< Usart Tx DMA Handle parameters */ |
|
117 | DMA_HandleTypeDef *hdmatx; /*!< Usart Tx DMA Handle parameters */ |
117 | |
118 | 118 | DMA_HandleTypeDef *hdmarx; /*!< Usart Rx DMA Handle parameters */ |
|
119 | DMA_HandleTypeDef *hdmarx; /*!< Usart Rx DMA Handle parameters */ |
119 | |
120 | 120 | HAL_LockTypeDef Lock; /*!< Locking object */ |
|
121 | HAL_LockTypeDef Lock; /*!< Locking object */ |
121 | |
122 | 122 | __IO HAL_USART_StateTypeDef State; /*!< Usart communication state */ |
|
123 | __IO HAL_USART_StateTypeDef State; /*!< Usart communication state */ |
123 | |
124 | 124 | __IO uint32_t ErrorCode; /*!< USART Error code */ |
|
125 | __IO uint32_t ErrorCode; /*!< USART Error code */ |
125 | |
126 | 126 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
|
127 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
127 | void (* TxHalfCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Tx Half Complete Callback */ |
128 | void (* TxHalfCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Tx Half Complete Callback */ |
128 | void (* TxCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Tx Complete Callback */ |
129 | void (* TxCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Tx Complete Callback */ |
129 | void (* RxHalfCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Rx Half Complete Callback */ |
130 | void (* RxHalfCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Rx Half Complete Callback */ |
130 | void (* RxCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Rx Complete Callback */ |
131 | void (* RxCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Rx Complete Callback */ |
131 | void (* TxRxCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Tx Rx Complete Callback */ |
132 | void (* TxRxCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Tx Rx Complete Callback */ |
132 | void (* ErrorCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Error Callback */ |
133 | void (* ErrorCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Error Callback */ |
133 | void (* AbortCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Abort Complete Callback */ |
134 | void (* AbortCpltCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Abort Complete Callback */ |
134 | |
135 | 135 | void (* MspInitCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Msp Init callback */ |
|
136 | void (* MspInitCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Msp Init callback */ |
136 | void (* MspDeInitCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Msp DeInit callback */ |
137 | void (* MspDeInitCallback)(struct __USART_HandleTypeDef *husart); /*!< USART Msp DeInit callback */ |
137 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
138 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
138 | |
139 | 139 | } USART_HandleTypeDef; |
|
140 | } USART_HandleTypeDef; |
140 | |
141 | 141 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
|
142 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
142 | /** |
143 | /** |
143 | * @brief HAL USART Callback ID enumeration definition |
144 | * @brief HAL USART Callback ID enumeration definition |
144 | */ |
145 | */ |
145 | typedef enum |
146 | typedef enum |
146 | { |
147 | { |
147 | HAL_USART_TX_HALFCOMPLETE_CB_ID = 0x00U, /*!< USART Tx Half Complete Callback ID */ |
148 | HAL_USART_TX_HALFCOMPLETE_CB_ID = 0x00U, /*!< USART Tx Half Complete Callback ID */ |
148 | HAL_USART_TX_COMPLETE_CB_ID = 0x01U, /*!< USART Tx Complete Callback ID */ |
149 | HAL_USART_TX_COMPLETE_CB_ID = 0x01U, /*!< USART Tx Complete Callback ID */ |
149 | HAL_USART_RX_HALFCOMPLETE_CB_ID = 0x02U, /*!< USART Rx Half Complete Callback ID */ |
150 | HAL_USART_RX_HALFCOMPLETE_CB_ID = 0x02U, /*!< USART Rx Half Complete Callback ID */ |
150 | HAL_USART_RX_COMPLETE_CB_ID = 0x03U, /*!< USART Rx Complete Callback ID */ |
151 | HAL_USART_RX_COMPLETE_CB_ID = 0x03U, /*!< USART Rx Complete Callback ID */ |
151 | HAL_USART_TX_RX_COMPLETE_CB_ID = 0x04U, /*!< USART Tx Rx Complete Callback ID */ |
152 | HAL_USART_TX_RX_COMPLETE_CB_ID = 0x04U, /*!< USART Tx Rx Complete Callback ID */ |
152 | HAL_USART_ERROR_CB_ID = 0x05U, /*!< USART Error Callback ID */ |
153 | HAL_USART_ERROR_CB_ID = 0x05U, /*!< USART Error Callback ID */ |
153 | HAL_USART_ABORT_COMPLETE_CB_ID = 0x06U, /*!< USART Abort Complete Callback ID */ |
154 | HAL_USART_ABORT_COMPLETE_CB_ID = 0x06U, /*!< USART Abort Complete Callback ID */ |
154 | |
155 | 155 | HAL_USART_MSPINIT_CB_ID = 0x07U, /*!< USART MspInit callback ID */ |
|
156 | HAL_USART_MSPINIT_CB_ID = 0x07U, /*!< USART MspInit callback ID */ |
156 | HAL_USART_MSPDEINIT_CB_ID = 0x08U /*!< USART MspDeInit callback ID */ |
157 | HAL_USART_MSPDEINIT_CB_ID = 0x08U /*!< USART MspDeInit callback ID */ |
157 | |
158 | 158 | } HAL_USART_CallbackIDTypeDef; |
|
159 | } HAL_USART_CallbackIDTypeDef; |
159 | |
160 | 160 | /** |
|
161 | /** |
161 | * @brief HAL USART Callback pointer definition |
162 | * @brief HAL USART Callback pointer definition |
162 | */ |
163 | */ |
163 | typedef void (*pUSART_CallbackTypeDef)(USART_HandleTypeDef *husart); /*!< pointer to an USART callback function */ |
164 | typedef void (*pUSART_CallbackTypeDef)(USART_HandleTypeDef *husart); /*!< pointer to an USART callback function */ |
164 | |
165 | 165 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
|
166 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
166 | |
167 | 167 | /** |
|
168 | /** |
168 | * @} |
169 | * @} |
169 | */ |
170 | */ |
170 | |
171 | 171 | /* Exported constants --------------------------------------------------------*/ |
|
172 | /* Exported constants --------------------------------------------------------*/ |
172 | /** @defgroup USART_Exported_Constants USART Exported Constants |
173 | /** @defgroup USART_Exported_Constants USART Exported Constants |
173 | * @{ |
174 | * @{ |
174 | */ |
175 | */ |
175 | |
176 | 176 | /** @defgroup USART_Error_Code USART Error Code |
|
177 | /** @defgroup USART_Error_Code USART Error Code |
177 | * @brief USART Error Code |
178 | * @brief USART Error Code |
178 | * @{ |
179 | * @{ |
179 | */ |
180 | */ |
180 | #define HAL_USART_ERROR_NONE 0x00000000U /*!< No error */ |
181 | #define HAL_USART_ERROR_NONE 0x00000000U /*!< No error */ |
181 | #define HAL_USART_ERROR_PE 0x00000001U /*!< Parity error */ |
182 | #define HAL_USART_ERROR_PE 0x00000001U /*!< Parity error */ |
182 | #define HAL_USART_ERROR_NE 0x00000002U /*!< Noise error */ |
183 | #define HAL_USART_ERROR_NE 0x00000002U /*!< Noise error */ |
183 | #define HAL_USART_ERROR_FE 0x00000004U /*!< Frame error */ |
184 | #define HAL_USART_ERROR_FE 0x00000004U /*!< Frame error */ |
184 | #define HAL_USART_ERROR_ORE 0x00000008U /*!< Overrun error */ |
185 | #define HAL_USART_ERROR_ORE 0x00000008U /*!< Overrun error */ |
185 | #define HAL_USART_ERROR_DMA 0x00000010U /*!< DMA transfer error */ |
186 | #define HAL_USART_ERROR_DMA 0x00000010U /*!< DMA transfer error */ |
186 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
187 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
187 | #define HAL_USART_ERROR_INVALID_CALLBACK 0x00000020U /*!< Invalid Callback error */ |
188 | #define HAL_USART_ERROR_INVALID_CALLBACK 0x00000020U /*!< Invalid Callback error */ |
188 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
189 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
189 | /** |
190 | /** |
190 | * @} |
191 | * @} |
191 | */ |
192 | */ |
192 | |
193 | 193 | /** @defgroup USART_Word_Length USART Word Length |
|
194 | /** @defgroup USART_Word_Length USART Word Length |
194 | * @{ |
195 | * @{ |
195 | */ |
196 | */ |
196 | #define USART_WORDLENGTH_8B 0x00000000U |
197 | #define USART_WORDLENGTH_8B 0x00000000U |
197 | #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M) |
198 | #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M) |
198 | /** |
199 | /** |
199 | * @} |
200 | * @} |
200 | */ |
201 | */ |
201 | |
202 | 202 | /** @defgroup USART_Stop_Bits USART Number of Stop Bits |
|
203 | /** @defgroup USART_Stop_Bits USART Number of Stop Bits |
203 | * @{ |
204 | * @{ |
204 | */ |
205 | */ |
205 | #define USART_STOPBITS_1 0x00000000U |
206 | #define USART_STOPBITS_1 0x00000000U |
206 | #define USART_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) |
207 | #define USART_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) |
207 | #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) |
208 | #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) |
208 | #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) |
209 | #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) |
209 | /** |
210 | /** |
210 | * @} |
211 | * @} |
211 | */ |
212 | */ |
212 | |
213 | 213 | /** @defgroup USART_Parity USART Parity |
|
214 | /** @defgroup USART_Parity USART Parity |
214 | * @{ |
215 | * @{ |
215 | */ |
216 | */ |
216 | #define USART_PARITY_NONE 0x00000000U |
217 | #define USART_PARITY_NONE 0x00000000U |
217 | #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) |
218 | #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) |
218 | #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) |
219 | #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) |
219 | /** |
220 | /** |
220 | * @} |
221 | * @} |
221 | */ |
222 | */ |
222 | |
223 | 223 | /** @defgroup USART_Mode USART Mode |
|
224 | /** @defgroup USART_Mode USART Mode |
224 | * @{ |
225 | * @{ |
225 | */ |
226 | */ |
226 | #define USART_MODE_RX ((uint32_t)USART_CR1_RE) |
227 | #define USART_MODE_RX ((uint32_t)USART_CR1_RE) |
227 | #define USART_MODE_TX ((uint32_t)USART_CR1_TE) |
228 | #define USART_MODE_TX ((uint32_t)USART_CR1_TE) |
228 | #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE | USART_CR1_RE)) |
229 | #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE | USART_CR1_RE)) |
229 | /** |
230 | /** |
230 | * @} |
231 | * @} |
231 | */ |
232 | */ |
232 | |
233 | 233 | /** @defgroup USART_Clock USART Clock |
|
234 | /** @defgroup USART_Clock USART Clock |
234 | * @{ |
235 | * @{ |
235 | */ |
236 | */ |
236 | #define USART_CLOCK_DISABLE 0x00000000U |
237 | #define USART_CLOCK_DISABLE 0x00000000U |
237 | #define USART_CLOCK_ENABLE ((uint32_t)USART_CR2_CLKEN) |
238 | #define USART_CLOCK_ENABLE ((uint32_t)USART_CR2_CLKEN) |
238 | /** |
239 | /** |
239 | * @} |
240 | * @} |
240 | */ |
241 | */ |
241 | |
242 | 242 | /** @defgroup USART_Clock_Polarity USART Clock Polarity |
|
243 | /** @defgroup USART_Clock_Polarity USART Clock Polarity |
243 | * @{ |
244 | * @{ |
244 | */ |
245 | */ |
245 | #define USART_POLARITY_LOW 0x00000000U |
246 | #define USART_POLARITY_LOW 0x00000000U |
246 | #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) |
247 | #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) |
247 | /** |
248 | /** |
248 | * @} |
249 | * @} |
249 | */ |
250 | */ |
250 | |
251 | 251 | /** @defgroup USART_Clock_Phase USART Clock Phase |
|
252 | /** @defgroup USART_Clock_Phase USART Clock Phase |
252 | * @{ |
253 | * @{ |
253 | */ |
254 | */ |
254 | #define USART_PHASE_1EDGE 0x00000000U |
255 | #define USART_PHASE_1EDGE 0x00000000U |
255 | #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) |
256 | #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) |
256 | /** |
257 | /** |
257 | * @} |
258 | * @} |
258 | */ |
259 | */ |
259 | |
260 | 260 | /** @defgroup USART_Last_Bit USART Last Bit |
|
261 | /** @defgroup USART_Last_Bit USART Last Bit |
261 | * @{ |
262 | * @{ |
262 | */ |
263 | */ |
263 | #define USART_LASTBIT_DISABLE 0x00000000U |
264 | #define USART_LASTBIT_DISABLE 0x00000000U |
264 | #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) |
265 | #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) |
265 | /** |
266 | /** |
266 | * @} |
267 | * @} |
267 | */ |
268 | */ |
268 | |
269 | 269 | /** @defgroup USART_NACK_State USART NACK State |
|
270 | /** @defgroup USART_NACK_State USART NACK State |
270 | * @{ |
271 | * @{ |
271 | */ |
272 | */ |
272 | #define USART_NACK_ENABLE ((uint32_t)USART_CR3_NACK) |
273 | #define USART_NACK_ENABLE ((uint32_t)USART_CR3_NACK) |
273 | #define USART_NACK_DISABLE 0x00000000U |
274 | #define USART_NACK_DISABLE 0x00000000U |
274 | /** |
275 | /** |
275 | * @} |
276 | * @} |
276 | */ |
277 | */ |
277 | |
278 | 278 | /** @defgroup USART_Flags USART Flags |
|
279 | /** @defgroup USART_Flags USART Flags |
279 | * Elements values convention: 0xXXXX |
280 | * Elements values convention: 0xXXXX |
280 | * - 0xXXXX : Flag mask in the SR register |
281 | * - 0xXXXX : Flag mask in the SR register |
281 | * @{ |
282 | * @{ |
282 | */ |
283 | */ |
283 | #define USART_FLAG_TXE ((uint32_t)USART_SR_TXE) |
284 | #define USART_FLAG_TXE ((uint32_t)USART_SR_TXE) |
284 | #define USART_FLAG_TC ((uint32_t)USART_SR_TC) |
285 | #define USART_FLAG_TC ((uint32_t)USART_SR_TC) |
285 | #define USART_FLAG_RXNE ((uint32_t)USART_SR_RXNE) |
286 | #define USART_FLAG_RXNE ((uint32_t)USART_SR_RXNE) |
286 | #define USART_FLAG_IDLE ((uint32_t)USART_SR_IDLE) |
287 | #define USART_FLAG_IDLE ((uint32_t)USART_SR_IDLE) |
287 | #define USART_FLAG_ORE ((uint32_t)USART_SR_ORE) |
288 | #define USART_FLAG_ORE ((uint32_t)USART_SR_ORE) |
288 | #define USART_FLAG_NE ((uint32_t)USART_SR_NE) |
289 | #define USART_FLAG_NE ((uint32_t)USART_SR_NE) |
289 | #define USART_FLAG_FE ((uint32_t)USART_SR_FE) |
290 | #define USART_FLAG_FE ((uint32_t)USART_SR_FE) |
290 | #define USART_FLAG_PE ((uint32_t)USART_SR_PE) |
291 | #define USART_FLAG_PE ((uint32_t)USART_SR_PE) |
291 | /** |
292 | /** |
292 | * @} |
293 | * @} |
293 | */ |
294 | */ |
294 | |
295 | 295 | /** @defgroup USART_Interrupt_definition USART Interrupts Definition |
|
296 | /** @defgroup USART_Interrupt_definition USART Interrupts Definition |
296 | * Elements values convention: 0xY000XXXX |
297 | * Elements values convention: 0xY000XXXX |
297 | * - XXXX : Interrupt mask in the XX register |
298 | * - XXXX : Interrupt mask in the XX register |
298 | * - Y : Interrupt source register (2bits) |
299 | * - Y : Interrupt source register (2bits) |
299 | * - 01: CR1 register |
300 | * - 01: CR1 register |
300 | * - 10: CR2 register |
301 | * - 10: CR2 register |
301 | * - 11: CR3 register |
302 | * - 11: CR3 register |
302 | * @{ |
303 | * @{ |
303 | */ |
304 | */ |
304 | #define USART_IT_PE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_PEIE)) |
305 | #define USART_IT_PE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_PEIE)) |
305 | #define USART_IT_TXE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_TXEIE)) |
306 | #define USART_IT_TXE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_TXEIE)) |
306 | #define USART_IT_TC ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_TCIE)) |
307 | #define USART_IT_TC ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_TCIE)) |
307 | #define USART_IT_RXNE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE)) |
308 | #define USART_IT_RXNE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE)) |
308 | #define USART_IT_IDLE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE)) |
309 | #define USART_IT_IDLE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE)) |
309 | #define USART_IT_ERR ((uint32_t)(USART_CR3_REG_INDEX << 28U | USART_CR3_EIE)) |
310 | #define USART_IT_ERR ((uint32_t)(USART_CR3_REG_INDEX << 28U | USART_CR3_EIE)) |
310 | /** |
311 | /** |
311 | * @} |
312 | * @} |
312 | */ |
313 | */ |
313 | |
314 | 314 | /** |
|
315 | /** |
315 | * @} |
316 | * @} |
316 | */ |
317 | */ |
317 | |
318 | 318 | /* Exported macro ------------------------------------------------------------*/ |
|
319 | /* Exported macro ------------------------------------------------------------*/ |
319 | /** @defgroup USART_Exported_Macros USART Exported Macros |
320 | /** @defgroup USART_Exported_Macros USART Exported Macros |
320 | * @{ |
321 | * @{ |
321 | */ |
322 | */ |
322 | |
323 | 323 | /** @brief Reset USART handle state |
|
324 | /** @brief Reset USART handle state |
324 | * @param __HANDLE__ specifies the USART Handle. |
325 | * @param __HANDLE__ specifies the USART Handle. |
325 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
326 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
326 | * @retval None |
327 | * @retval None |
327 | */ |
328 | */ |
328 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
329 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
329 | #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
330 | #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
330 | (__HANDLE__)->State = HAL_USART_STATE_RESET; \ |
331 | (__HANDLE__)->State = HAL_USART_STATE_RESET; \ |
331 | (__HANDLE__)->MspInitCallback = NULL; \ |
332 | (__HANDLE__)->MspInitCallback = NULL; \ |
332 | (__HANDLE__)->MspDeInitCallback = NULL; \ |
333 | (__HANDLE__)->MspDeInitCallback = NULL; \ |
333 | } while(0U) |
334 | } while(0U) |
334 | #else |
335 | #else |
335 | #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET) |
336 | #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET) |
336 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
337 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
337 | |
338 | 338 | /** @brief Check whether the specified USART flag is set or not. |
|
339 | /** @brief Check whether the specified USART flag is set or not. |
339 | * @param __HANDLE__ specifies the USART Handle. |
340 | * @param __HANDLE__ specifies the USART Handle. |
340 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
341 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
341 | * @param __FLAG__ specifies the flag to check. |
342 | * @param __FLAG__ specifies the flag to check. |
342 | * This parameter can be one of the following values: |
343 | * This parameter can be one of the following values: |
343 | * @arg USART_FLAG_TXE: Transmit data register empty flag |
344 | * @arg USART_FLAG_TXE: Transmit data register empty flag |
344 | * @arg USART_FLAG_TC: Transmission Complete flag |
345 | * @arg USART_FLAG_TC: Transmission Complete flag |
345 | * @arg USART_FLAG_RXNE: Receive data register not empty flag |
346 | * @arg USART_FLAG_RXNE: Receive data register not empty flag |
346 | * @arg USART_FLAG_IDLE: Idle Line detection flag |
347 | * @arg USART_FLAG_IDLE: Idle Line detection flag |
347 | * @arg USART_FLAG_ORE: Overrun Error flag |
348 | * @arg USART_FLAG_ORE: Overrun Error flag |
348 | * @arg USART_FLAG_NE: Noise Error flag |
349 | * @arg USART_FLAG_NE: Noise Error flag |
349 | * @arg USART_FLAG_FE: Framing Error flag |
350 | * @arg USART_FLAG_FE: Framing Error flag |
350 | * @arg USART_FLAG_PE: Parity Error flag |
351 | * @arg USART_FLAG_PE: Parity Error flag |
351 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
352 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
352 | */ |
353 | */ |
353 | #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
354 | #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
354 | |
355 | 355 | /** @brief Clear the specified USART pending flags. |
|
356 | /** @brief Clear the specified USART pending flags. |
356 | * @param __HANDLE__ specifies the USART Handle. |
357 | * @param __HANDLE__ specifies the USART Handle. |
357 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
358 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
358 | * @param __FLAG__ specifies the flag to check. |
359 | * @param __FLAG__ specifies the flag to check. |
359 | * This parameter can be any combination of the following values: |
360 | * This parameter can be any combination of the following values: |
360 | * @arg USART_FLAG_TC: Transmission Complete flag. |
361 | * @arg USART_FLAG_TC: Transmission Complete flag. |
361 | * @arg USART_FLAG_RXNE: Receive data register not empty flag. |
362 | * @arg USART_FLAG_RXNE: Receive data register not empty flag. |
362 | * |
363 | * |
363 | * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (Overrun |
364 | * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (Overrun |
364 | * error) and IDLE (Idle line detected) flags are cleared by software |
365 | * error) and IDLE (Idle line detected) flags are cleared by software |
365 | * sequence: a read operation to USART_SR register followed by a read |
366 | * sequence: a read operation to USART_SR register followed by a read |
366 | * operation to USART_DR register. |
367 | * operation to USART_DR register. |
367 | * @note RXNE flag can be also cleared by a read to the USART_DR register. |
368 | * @note RXNE flag can be also cleared by a read to the USART_DR register. |
368 | * @note TC flag can be also cleared by software sequence: a read operation to |
369 | * @note TC flag can be also cleared by software sequence: a read operation to |
369 | * USART_SR register followed by a write operation to USART_DR register. |
370 | * USART_SR register followed by a write operation to USART_DR register. |
370 | * @note TXE flag is cleared only by a write to the USART_DR register. |
371 | * @note TXE flag is cleared only by a write to the USART_DR register. |
371 | * |
372 | * |
372 | * @retval None |
373 | * @retval None |
373 | */ |
374 | */ |
374 | #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) |
375 | #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) |
375 | |
376 | 376 | /** @brief Clear the USART PE pending flag. |
|
377 | /** @brief Clear the USART PE pending flag. |
377 | * @param __HANDLE__ specifies the USART Handle. |
378 | * @param __HANDLE__ specifies the USART Handle. |
378 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
379 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
379 | * @retval None |
380 | * @retval None |
380 | */ |
381 | */ |
381 | #define __HAL_USART_CLEAR_PEFLAG(__HANDLE__) \ |
382 | #define __HAL_USART_CLEAR_PEFLAG(__HANDLE__) \ |
382 | do{ \ |
383 | do{ \ |
383 | __IO uint32_t tmpreg = 0x00U; \ |
384 | __IO uint32_t tmpreg = 0x00U; \ |
384 | tmpreg = (__HANDLE__)->Instance->SR; \ |
385 | tmpreg = (__HANDLE__)->Instance->SR; \ |
385 | tmpreg = (__HANDLE__)->Instance->DR; \ |
386 | tmpreg = (__HANDLE__)->Instance->DR; \ |
386 | UNUSED(tmpreg); \ |
387 | UNUSED(tmpreg); \ |
387 | } while(0U) |
388 | } while(0U) |
388 | |
389 | 389 | /** @brief Clear the USART FE pending flag. |
|
390 | /** @brief Clear the USART FE pending flag. |
390 | * @param __HANDLE__ specifies the USART Handle. |
391 | * @param __HANDLE__ specifies the USART Handle. |
391 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
392 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
392 | * @retval None |
393 | * @retval None |
393 | */ |
394 | */ |
394 | #define __HAL_USART_CLEAR_FEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
395 | #define __HAL_USART_CLEAR_FEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
395 | |
396 | 396 | /** @brief Clear the USART NE pending flag. |
|
397 | /** @brief Clear the USART NE pending flag. |
397 | * @param __HANDLE__ specifies the USART Handle. |
398 | * @param __HANDLE__ specifies the USART Handle. |
398 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
399 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
399 | * @retval None |
400 | * @retval None |
400 | */ |
401 | */ |
401 | #define __HAL_USART_CLEAR_NEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
402 | #define __HAL_USART_CLEAR_NEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
402 | |
403 | 403 | /** @brief Clear the USART ORE pending flag. |
|
404 | /** @brief Clear the USART ORE pending flag. |
404 | * @param __HANDLE__ specifies the USART Handle. |
405 | * @param __HANDLE__ specifies the USART Handle. |
405 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
406 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
406 | * @retval None |
407 | * @retval None |
407 | */ |
408 | */ |
408 | #define __HAL_USART_CLEAR_OREFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
409 | #define __HAL_USART_CLEAR_OREFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
409 | |
410 | 410 | /** @brief Clear the USART IDLE pending flag. |
|
411 | /** @brief Clear the USART IDLE pending flag. |
411 | * @param __HANDLE__ specifies the USART Handle. |
412 | * @param __HANDLE__ specifies the USART Handle. |
412 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
413 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
413 | * @retval None |
414 | * @retval None |
414 | */ |
415 | */ |
415 | #define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
416 | #define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) |
416 | |
417 | 417 | /** @brief Enables or disables the specified USART interrupts. |
|
418 | /** @brief Enables or disables the specified USART interrupts. |
418 | * @param __HANDLE__ specifies the USART Handle. |
419 | * @param __HANDLE__ specifies the USART Handle. |
419 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
420 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
420 | * @param __INTERRUPT__ specifies the USART interrupt source to check. |
421 | * @param __INTERRUPT__ specifies the USART interrupt source to check. |
421 | * This parameter can be one of the following values: |
422 | * This parameter can be one of the following values: |
422 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
423 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
423 | * @arg USART_IT_TC: Transmission complete interrupt |
424 | * @arg USART_IT_TC: Transmission complete interrupt |
424 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
425 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
425 | * @arg USART_IT_IDLE: Idle line detection interrupt |
426 | * @arg USART_IT_IDLE: Idle line detection interrupt |
426 | * @arg USART_IT_PE: Parity Error interrupt |
427 | * @arg USART_IT_PE: Parity Error interrupt |
427 | * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
428 | * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
428 | * @retval None |
429 | * @retval None |
429 | */ |
430 | */ |
430 | #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == USART_CR1_REG_INDEX)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & USART_IT_MASK)): \ |
431 | #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == USART_CR1_REG_INDEX)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & USART_IT_MASK)): \ |
431 | (((__INTERRUPT__) >> 28U) == USART_CR2_REG_INDEX)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & USART_IT_MASK)): \ |
432 | (((__INTERRUPT__) >> 28U) == USART_CR2_REG_INDEX)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & USART_IT_MASK)): \ |
432 | ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & USART_IT_MASK))) |
433 | ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & USART_IT_MASK))) |
433 | #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == USART_CR1_REG_INDEX)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & USART_IT_MASK)): \ |
434 | #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == USART_CR1_REG_INDEX)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & USART_IT_MASK)): \ |
434 | (((__INTERRUPT__) >> 28U) == USART_CR2_REG_INDEX)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & USART_IT_MASK)): \ |
435 | (((__INTERRUPT__) >> 28U) == USART_CR2_REG_INDEX)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & USART_IT_MASK)): \ |
435 | ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & USART_IT_MASK))) |
436 | ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & USART_IT_MASK))) |
436 | |
437 | 437 | /** @brief Checks whether the specified USART interrupt has occurred or not. |
|
438 | /** @brief Checks whether the specified USART interrupt has occurred or not. |
438 | * @param __HANDLE__ specifies the USART Handle. |
439 | * @param __HANDLE__ specifies the USART Handle. |
439 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
440 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
440 | * @param __IT__ specifies the USART interrupt source to check. |
441 | * @param __IT__ specifies the USART interrupt source to check. |
441 | * This parameter can be one of the following values: |
442 | * This parameter can be one of the following values: |
442 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
443 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
443 | * @arg USART_IT_TC: Transmission complete interrupt |
444 | * @arg USART_IT_TC: Transmission complete interrupt |
444 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
445 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
445 | * @arg USART_IT_IDLE: Idle line detection interrupt |
446 | * @arg USART_IT_IDLE: Idle line detection interrupt |
446 | * @arg USART_IT_ERR: Error interrupt |
447 | * @arg USART_IT_ERR: Error interrupt |
447 | * @arg USART_IT_PE: Parity Error interrupt |
448 | * @arg USART_IT_PE: Parity Error interrupt |
448 | * @retval The new state of __IT__ (TRUE or FALSE). |
449 | * @retval The new state of __IT__ (TRUE or FALSE). |
449 | */ |
450 | */ |
450 | #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28U) == USART_CR1_REG_INDEX)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == USART_CR2_REG_INDEX)? \ |
451 | #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28U) == USART_CR1_REG_INDEX)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == USART_CR2_REG_INDEX)? \ |
451 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & USART_IT_MASK)) |
452 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & USART_IT_MASK)) |
452 | |
453 | 453 | /** @brief Macro to enable the USART's one bit sample method |
|
454 | /** @brief Macro to enable the USART's one bit sample method |
454 | * @param __HANDLE__ specifies the USART Handle. |
455 | * @param __HANDLE__ specifies the USART Handle. |
455 | * @retval None |
456 | * @retval None |
456 | */ |
457 | */ |
457 | #define __HAL_USART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 |= USART_CR3_ONEBIT) |
458 | #define __HAL_USART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 |= USART_CR3_ONEBIT) |
458 | |
459 | 459 | /** @brief Macro to disable the USART's one bit sample method |
|
460 | /** @brief Macro to disable the USART's one bit sample method |
460 | * @param __HANDLE__ specifies the USART Handle. |
461 | * @param __HANDLE__ specifies the USART Handle. |
461 | * @retval None |
462 | * @retval None |
462 | */ |
463 | */ |
463 | #define __HAL_USART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3\ |
464 | #define __HAL_USART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT)) |
464 | &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT)) |
465 | 465 | ||
466 | /** @brief Enable USART |
466 | /** @brief Enable USART |
467 | * @param __HANDLE__ specifies the USART Handle. |
467 | * @param __HANDLE__ specifies the USART Handle. |
468 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
468 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
469 | * @retval None |
469 | * @retval None |
470 | */ |
470 | */ |
471 | #define __HAL_USART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
471 | #define __HAL_USART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
472 | 472 | ||
473 | /** @brief Disable USART |
473 | /** @brief Disable USART |
474 | * @param __HANDLE__ specifies the USART Handle. |
474 | * @param __HANDLE__ specifies the USART Handle. |
475 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
475 | * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). |
476 | * @retval None |
476 | * @retval None |
477 | */ |
477 | */ |
478 | #define __HAL_USART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
478 | #define __HAL_USART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
479 | 479 | ||
480 | /** |
480 | /** |
481 | * @} |
481 | * @} |
482 | */ |
482 | */ |
483 | /* Exported functions --------------------------------------------------------*/ |
483 | /* Exported functions --------------------------------------------------------*/ |
484 | /** @addtogroup USART_Exported_Functions |
484 | /** @addtogroup USART_Exported_Functions |
485 | * @{ |
485 | * @{ |
486 | */ |
486 | */ |
487 | 487 | ||
488 | /** @addtogroup USART_Exported_Functions_Group1 |
488 | /** @addtogroup USART_Exported_Functions_Group1 |
489 | * @{ |
489 | * @{ |
490 | */ |
490 | */ |
491 | /* Initialization/de-initialization functions **********************************/ |
491 | /* Initialization/de-initialization functions **********************************/ |
492 | HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart); |
492 | HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart); |
493 | HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart); |
493 | HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart); |
494 | void HAL_USART_MspInit(USART_HandleTypeDef *husart); |
494 | void HAL_USART_MspInit(USART_HandleTypeDef *husart); |
495 | void HAL_USART_MspDeInit(USART_HandleTypeDef *husart); |
495 | void HAL_USART_MspDeInit(USART_HandleTypeDef *husart); |
496 | 496 | ||
497 | /* Callbacks Register/UnRegister functions ***********************************/ |
497 | /* Callbacks Register/UnRegister functions ***********************************/ |
498 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
498 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
499 | HAL_StatusTypeDef HAL_USART_RegisterCallback(USART_HandleTypeDef *husart, HAL_USART_CallbackIDTypeDef CallbackID, pUSART_CallbackTypeDef pCallback); |
499 | HAL_StatusTypeDef HAL_USART_RegisterCallback(USART_HandleTypeDef *husart, HAL_USART_CallbackIDTypeDef CallbackID, |
500 | HAL_StatusTypeDef HAL_USART_UnRegisterCallback(USART_HandleTypeDef *husart, HAL_USART_CallbackIDTypeDef CallbackID); |
500 | pUSART_CallbackTypeDef pCallback); |
501 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
501 | HAL_StatusTypeDef HAL_USART_UnRegisterCallback(USART_HandleTypeDef *husart, HAL_USART_CallbackIDTypeDef CallbackID); |
502 | 502 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
|
503 | /** |
503 | |
504 | * @} |
504 | /** |
505 | */ |
505 | * @} |
506 | 506 | */ |
|
507 | /** @addtogroup USART_Exported_Functions_Group2 |
507 | |
508 | * @{ |
508 | /** @addtogroup USART_Exported_Functions_Group2 |
509 | */ |
509 | * @{ |
510 | /* IO operation functions *******************************************************/ |
510 | */ |
511 | HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout); |
511 | /* IO operation functions *******************************************************/ |
512 | HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
512 | HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, const uint8_t *pTxData, uint16_t Size, uint32_t Timeout); |
513 | HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
513 | HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
514 | HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); |
514 | HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, const uint8_t *pTxData, uint8_t *pRxData, |
515 | HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
515 | uint16_t Size, uint32_t Timeout); |
516 | HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); |
516 | HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, const uint8_t *pTxData, uint16_t Size); |
517 | HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); |
517 | HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
518 | HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
518 | HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, const uint8_t *pTxData, uint8_t *pRxData, |
519 | HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); |
519 | uint16_t Size); |
520 | HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart); |
520 | HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, const uint8_t *pTxData, uint16_t Size); |
521 | HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart); |
521 | HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
522 | HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart); |
522 | HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, const uint8_t *pTxData, uint8_t *pRxData, |
523 | /* Transfer Abort functions */ |
523 | uint16_t Size); |
524 | HAL_StatusTypeDef HAL_USART_Abort(USART_HandleTypeDef *husart); |
524 | HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart); |
525 | HAL_StatusTypeDef HAL_USART_Abort_IT(USART_HandleTypeDef *husart); |
525 | HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart); |
526 | 526 | HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart); |
|
527 | void HAL_USART_IRQHandler(USART_HandleTypeDef *husart); |
527 | /* Transfer Abort functions */ |
528 | void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart); |
528 | HAL_StatusTypeDef HAL_USART_Abort(USART_HandleTypeDef *husart); |
529 | void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart); |
529 | HAL_StatusTypeDef HAL_USART_Abort_IT(USART_HandleTypeDef *husart); |
530 | void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart); |
530 | |
531 | void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart); |
531 | void HAL_USART_IRQHandler(USART_HandleTypeDef *husart); |
532 | void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart); |
532 | void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart); |
533 | void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart); |
533 | void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart); |
534 | void HAL_USART_AbortCpltCallback(USART_HandleTypeDef *husart); |
534 | void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart); |
535 | /** |
535 | void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart); |
536 | * @} |
536 | void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart); |
537 | */ |
537 | void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart); |
538 | 538 | void HAL_USART_AbortCpltCallback(USART_HandleTypeDef *husart); |
|
539 | /** @addtogroup USART_Exported_Functions_Group3 |
539 | /** |
540 | * @{ |
540 | * @} |
541 | */ |
541 | */ |
542 | /* Peripheral State functions ************************************************/ |
542 | |
543 | HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart); |
543 | /** @addtogroup USART_Exported_Functions_Group3 |
544 | uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart); |
544 | * @{ |
545 | /** |
545 | */ |
546 | * @} |
546 | /* Peripheral State functions ************************************************/ |
547 | */ |
547 | HAL_USART_StateTypeDef HAL_USART_GetState(const USART_HandleTypeDef *husart); |
548 | 548 | uint32_t HAL_USART_GetError(const USART_HandleTypeDef *husart); |
|
549 | /** |
549 | /** |
550 | * @} |
550 | * @} |
551 | */ |
551 | */ |
552 | /* Private types -------------------------------------------------------------*/ |
552 | |
553 | /* Private variables ---------------------------------------------------------*/ |
553 | /** |
554 | /* Private constants ---------------------------------------------------------*/ |
554 | * @} |
555 | /** @defgroup USART_Private_Constants USART Private Constants |
555 | */ |
556 | * @{ |
556 | /* Private types -------------------------------------------------------------*/ |
557 | */ |
557 | /* Private variables ---------------------------------------------------------*/ |
558 | /** @brief USART interruptions flag mask |
558 | /* Private constants ---------------------------------------------------------*/ |
559 | * |
559 | /** @defgroup USART_Private_Constants USART Private Constants |
560 | */ |
560 | * @{ |
561 | #define USART_IT_MASK ((uint32_t) USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE | \ |
561 | */ |
562 | USART_CR1_IDLEIE | USART_CR2_LBDIE | USART_CR3_CTSIE | USART_CR3_EIE ) |
562 | /** @brief USART interruptions flag mask |
563 | 563 | * |
|
564 | #define USART_CR1_REG_INDEX 1U |
564 | */ |
565 | #define USART_CR2_REG_INDEX 2U |
565 | #define USART_IT_MASK ((uint32_t) USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE | \ |
566 | #define USART_CR3_REG_INDEX 3U |
566 | USART_CR1_IDLEIE | USART_CR2_LBDIE | USART_CR3_CTSIE | USART_CR3_EIE ) |
567 | /** |
567 | |
568 | * @} |
568 | #define USART_CR1_REG_INDEX 1U |
569 | */ |
569 | #define USART_CR2_REG_INDEX 2U |
570 | 570 | #define USART_CR3_REG_INDEX 3U |
|
571 | /* Private macros ------------------------------------------------------------*/ |
571 | /** |
572 | /** @defgroup USART_Private_Macros USART Private Macros |
572 | * @} |
573 | * @{ |
573 | */ |
574 | */ |
574 | |
575 | #define IS_USART_NACK_STATE(NACK) (((NACK) == USART_NACK_ENABLE) || \ |
575 | /* Private macros ------------------------------------------------------------*/ |
576 | ((NACK) == USART_NACK_DISABLE)) |
576 | /** @defgroup USART_Private_Macros USART Private Macros |
577 | 577 | * @{ |
|
578 | #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \ |
578 | */ |
579 | ((LASTBIT) == USART_LASTBIT_ENABLE)) |
579 | #define IS_USART_NACK_STATE(NACK) (((NACK) == USART_NACK_ENABLE) || \ |
580 | 580 | ((NACK) == USART_NACK_DISABLE)) |
|
581 | #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || \ |
581 | |
582 | ((CPHA) == USART_PHASE_2EDGE)) |
582 | #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \ |
583 | 583 | ((LASTBIT) == USART_LASTBIT_ENABLE)) |
|
584 | #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || \ |
584 | |
585 | ((CPOL) == USART_POLARITY_HIGH)) |
585 | #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || \ |
586 | 586 | ((CPHA) == USART_PHASE_2EDGE)) |
|
587 | #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLE) || \ |
587 | |
588 | ((CLOCK) == USART_CLOCK_ENABLE)) |
588 | #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || \ |
589 | 589 | ((CPOL) == USART_POLARITY_HIGH)) |
|
590 | #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WORDLENGTH_8B) || \ |
590 | |
591 | ((LENGTH) == USART_WORDLENGTH_9B)) |
591 | #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLE) || \ |
592 | 592 | ((CLOCK) == USART_CLOCK_ENABLE)) |
|
593 | #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \ |
593 | |
594 | ((STOPBITS) == USART_STOPBITS_0_5) || \ |
594 | #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WORDLENGTH_8B) || \ |
595 | ((STOPBITS) == USART_STOPBITS_1_5) || \ |
595 | ((LENGTH) == USART_WORDLENGTH_9B)) |
596 | ((STOPBITS) == USART_STOPBITS_2)) |
596 | |
597 | 597 | #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \ |
|
598 | #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \ |
598 | ((STOPBITS) == USART_STOPBITS_0_5) || \ |
599 | ((PARITY) == USART_PARITY_EVEN) || \ |
599 | ((STOPBITS) == USART_STOPBITS_1_5) || \ |
600 | ((PARITY) == USART_PARITY_ODD)) |
600 | ((STOPBITS) == USART_STOPBITS_2)) |
601 | 601 | ||
602 | #define IS_USART_MODE(MODE) ((((MODE) & (~((uint32_t)USART_MODE_TX_RX))) == 0x00U) && ((MODE) != 0x00U)) |
602 | #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \ |
603 | 603 | ((PARITY) == USART_PARITY_EVEN) || \ |
|
604 | #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) <= 4000000U) |
604 | ((PARITY) == USART_PARITY_ODD)) |
605 | 605 | ||
606 | #define USART_DIV(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(2U*(_BAUD_))) |
606 | #define IS_USART_MODE(MODE) ((((MODE) & (~((uint32_t)USART_MODE_TX_RX))) == 0x00U) && ((MODE) != 0x00U)) |
607 | 607 | ||
608 | #define USART_DIVMANT(_PCLK_, _BAUD_) (USART_DIV((_PCLK_), (_BAUD_))/100U) |
608 | #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) <= 4000000U) |
609 | 609 | ||
610 | #define USART_DIVFRAQ(_PCLK_, _BAUD_) ((((USART_DIV((_PCLK_), (_BAUD_)) - (USART_DIVMANT((_PCLK_), (_BAUD_)) * 100U)) * 8U) + 50U) / 100U) |
610 | #define USART_DIV(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(2U*(_BAUD_))) |
611 | 611 | ||
612 | /* UART BRR = mantissa + overflow + fraction |
612 | #define USART_DIVMANT(_PCLK_, _BAUD_) (USART_DIV((_PCLK_), (_BAUD_))/100U) |
613 | = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07U) */ |
613 | |
614 | 614 | #define USART_DIVFRAQ(_PCLK_, _BAUD_) ((((USART_DIV((_PCLK_), (_BAUD_)) - (USART_DIVMANT((_PCLK_), (_BAUD_)) * 100U)) * 8U) + 50U) / 100U) |
|
615 | #define USART_BRR(_PCLK_, _BAUD_) (((USART_DIVMANT((_PCLK_), (_BAUD_)) << 4U) + \ |
615 | |
616 | ((USART_DIVFRAQ((_PCLK_), (_BAUD_)) & 0xF8U) << 1U)) + \ |
616 | /* UART BRR = mantissa + overflow + fraction |
617 | (USART_DIVFRAQ((_PCLK_), (_BAUD_)) & 0x07U)) |
617 | = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07U) */ |
618 | /** |
618 | |
619 | * @} |
619 | #define USART_BRR(_PCLK_, _BAUD_) (((USART_DIVMANT((_PCLK_), (_BAUD_)) << 4U) + \ |
620 | */ |
620 | ((USART_DIVFRAQ((_PCLK_), (_BAUD_)) & 0xF8U) << 1U)) + \ |
621 | 621 | (USART_DIVFRAQ((_PCLK_), (_BAUD_)) & 0x07U)) |
|
622 | /* Private functions ---------------------------------------------------------*/ |
622 | /** |
623 | /** @defgroup USART_Private_Functions USART Private Functions |
623 | * @} |
624 | * @{ |
624 | */ |
625 | */ |
625 | |
626 | 626 | /* Private functions ---------------------------------------------------------*/ |
|
627 | /** |
627 | /** @addtogroup USART_Private_Functions |
628 | * @} |
628 | * @{ |
629 | */ |
629 | */ |
630 | 630 | ||
631 | /** |
631 | /** |
632 | * @} |
632 | * @} |
633 | */ |
633 | */ |
634 | 634 | ||
635 | /** |
635 | /** |
636 | * @} |
636 | * @} |
637 | */ |
637 | */ |
638 | 638 | ||
639 | #ifdef __cplusplus |
639 | /** |
640 | } |
640 | * @} |
641 | #endif |
641 | */ |
642 | 642 | ||
643 | #endif /* __STM32L1xx_HAL_USART_H */ |
643 | #ifdef __cplusplus |
644 | 644 | } |
|
645 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
645 | #endif |
- | 646 | ||
- | 647 | #endif /* __STM32L1xx_HAL_USART_H */ |
|
- | 648 |