Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 6 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | /** |
44 | /** |
| 45 | * @brief UART Init Structure definition |
45 | * @brief UART Init Structure definition |
| 46 | */ |
46 | */ |
| 47 | typedef struct |
47 | typedef struct |
| 48 | { |
48 | { |
| 49 | uint32_t BaudRate; /*!< This member configures the UART communication baud rate. |
49 | uint32_t BaudRate; /*!< This member configures the UART communication baud rate. |
| 50 | The baud rate register is computed using the following formula: |
50 | The baud rate register is computed using the following formula: |
| 51 | - If oversampling is 16 or in LIN mode, |
51 | - If oversampling is 16 or in LIN mode, |
| 52 | Baud Rate Register = ((uart_ker_ck) / ((huart->Init.BaudRate))) |
52 | Baud Rate Register = ((uart_ker_ck) / ((huart->Init.BaudRate))) |
| 53 | - If oversampling is 8, |
53 | - If oversampling is 8, |
| 54 | Baud Rate Register[15:4] = ((2 * uart_ker_ck) / ((huart->Init.BaudRate)))[15:4] |
54 | Baud Rate Register[15:4] = ((2 * uart_ker_ck) / |
| - | 55 | ((huart->Init.BaudRate)))[15:4] |
|
| 55 | Baud Rate Register[3] = 0 |
56 | Baud Rate Register[3] = 0 |
| - | 57 | Baud Rate Register[2:0] = (((2 * uart_ker_ck) / |
|
| 56 | Baud Rate Register[2:0] = (((2 * uart_ker_ck) / ((huart->Init.BaudRate)))[3:0]) >> 1 |
58 | ((huart->Init.BaudRate)))[3:0]) >> 1 |
| 57 | where uart_ker_ck is the UART input clock */ |
59 | where uart_ker_ck is the UART input clock */ |
| 58 | 60 | ||
| 59 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
61 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
| 60 | This parameter can be a value of @ref UARTEx_Word_Length. */ |
62 | This parameter can be a value of @ref UARTEx_Word_Length. */ |
| 61 | 63 | ||
| 62 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
64 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
| 63 | This parameter can be a value of @ref UART_Stop_Bits. */ |
65 | This parameter can be a value of @ref UART_Stop_Bits. */ |
| 64 | 66 | ||
| 65 | uint32_t Parity; /*!< Specifies the parity mode. |
67 | uint32_t Parity; /*!< Specifies the parity mode. |
| 66 | This parameter can be a value of @ref UART_Parity |
68 | This parameter can be a value of @ref UART_Parity |
| 67 | @note When parity is enabled, the computed parity is inserted |
69 | @note When parity is enabled, the computed parity is inserted |
| 68 | at the MSB position of the transmitted data (9th bit when |
70 | at the MSB position of the transmitted data (9th bit when |
| 69 | the word length is set to 9 data bits; 8th bit when the |
71 | the word length is set to 9 data bits; 8th bit when the |
| 70 | word length is set to 8 data bits). */ |
72 | word length is set to 8 data bits). */ |
| 71 | 73 | ||
| 72 | uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
74 | uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
| 73 | This parameter can be a value of @ref UART_Mode. */ |
75 | This parameter can be a value of @ref UART_Mode. */ |
| 74 | 76 | ||
| 75 | uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled |
77 | uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled |
| 76 | or disabled. |
78 | or disabled. |
| 77 | This parameter can be a value of @ref UART_Hardware_Flow_Control. */ |
79 | This parameter can be a value of @ref UART_Hardware_Flow_Control. */ |
| 78 | 80 | ||
| 79 | uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to f_PCLK/8). |
81 | uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, |
| - | 82 | to achieve higher speed (up to f_PCLK/8). |
|
| 80 | This parameter can be a value of @ref UART_Over_Sampling. */ |
83 | This parameter can be a value of @ref UART_Over_Sampling. */ |
| 81 | 84 | ||
| 82 | uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected. |
85 | uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected. |
| 83 | Selecting the single sample method increases the receiver tolerance to clock |
86 | Selecting the single sample method increases the receiver tolerance to clock |
| 84 | deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */ |
87 | deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */ |
| 85 | 88 | ||
| 86 | 89 | ||
| 87 | } UART_InitTypeDef; |
90 | } UART_InitTypeDef; |
| 88 | 91 | ||
| 89 | /** |
92 | /** |
| Line 91... | Line 94... | ||
| 91 | */ |
94 | */ |
| 92 | typedef struct |
95 | typedef struct |
| 93 | { |
96 | { |
| 94 | uint32_t AdvFeatureInit; /*!< Specifies which advanced UART features is initialized. Several |
97 | uint32_t AdvFeatureInit; /*!< Specifies which advanced UART features is initialized. Several |
| 95 | Advanced Features may be initialized at the same time . |
98 | Advanced Features may be initialized at the same time . |
| - | 99 | This parameter can be a value of |
|
| 96 | This parameter can be a value of @ref UART_Advanced_Features_Initialization_Type. */ |
100 | @ref UART_Advanced_Features_Initialization_Type. */ |
| 97 | 101 | ||
| 98 | uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted. |
102 | uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted. |
| 99 | This parameter can be a value of @ref UART_Tx_Inv. */ |
103 | This parameter can be a value of @ref UART_Tx_Inv. */ |
| 100 | 104 | ||
| 101 | uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted. |
105 | uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted. |
| Line 125... | Line 129... | ||
| 125 | This parameter can be a value of @ref UART_MSB_First. */ |
129 | This parameter can be a value of @ref UART_MSB_First. */ |
| 126 | } UART_AdvFeatureInitTypeDef; |
130 | } UART_AdvFeatureInitTypeDef; |
| 127 | 131 | ||
| 128 | /** |
132 | /** |
| 129 | * @brief HAL UART State definition |
133 | * @brief HAL UART State definition |
| 130 | * @note HAL UART State value is a combination of 2 different substates: gState and RxState (see @ref UART_State_Definition). |
134 | * @note HAL UART State value is a combination of 2 different substates: |
| - | 135 | * gState and RxState (see @ref UART_State_Definition). |
|
| 131 | * - gState contains UART state information related to global Handle management |
136 | * - gState contains UART state information related to global Handle management |
| 132 | * and also information related to Tx operations. |
137 | * and also information related to Tx operations. |
| 133 | * gState value coding follow below described bitmap : |
138 | * gState value coding follow below described bitmap : |
| 134 | * b7-b6 Error information |
139 | * b7-b6 Error information |
| 135 | * 00 : No Error |
140 | * 00 : No Error |
| 136 | * 01 : (Not Used) |
141 | * 01 : (Not Used) |
| 137 | * 10 : Timeout |
142 | * 10 : Timeout |
| 138 | * 11 : Error |
143 | * 11 : Error |
| 139 | * b5 Peripheral initialization status |
144 | * b5 Peripheral initialization status |
| 140 | * 0 : Reset (Peripheral not initialized) |
145 | * 0 : Reset (Peripheral not initialized) |
| 141 | * 1 : Init done (Peripheral not initialized. HAL UART Init function already called) |
146 | * 1 : Init done (Peripheral initialized. HAL UART Init function already called) |
| 142 | * b4-b3 (not used) |
147 | * b4-b3 (not used) |
| 143 | * xx : Should be set to 00 |
148 | * xx : Should be set to 00 |
| 144 | * b2 Intrinsic process state |
149 | * b2 Intrinsic process state |
| 145 | * 0 : Ready |
150 | * 0 : Ready |
| 146 | * 1 : Busy (Peripheral busy with some configuration or internal operations) |
151 | * 1 : Busy (Peripheral busy with some configuration or internal operations) |
| Line 153... | Line 158... | ||
| 153 | * RxState value coding follow below described bitmap : |
158 | * RxState value coding follow below described bitmap : |
| 154 | * b7-b6 (not used) |
159 | * b7-b6 (not used) |
| 155 | * xx : Should be set to 00 |
160 | * xx : Should be set to 00 |
| 156 | * b5 Peripheral initialization status |
161 | * b5 Peripheral initialization status |
| 157 | * 0 : Reset (Peripheral not initialized) |
162 | * 0 : Reset (Peripheral not initialized) |
| 158 | * 1 : Init done (Peripheral not initialized) |
163 | * 1 : Init done (Peripheral initialized) |
| 159 | * b4-b2 (not used) |
164 | * b4-b2 (not used) |
| 160 | * xxx : Should be set to 000 |
165 | * xxx : Should be set to 000 |
| 161 | * b1 Rx state |
166 | * b1 Rx state |
| 162 | * 0 : Ready (no Rx operation ongoing) |
167 | * 0 : Ready (no Rx operation ongoing) |
| 163 | * 1 : Busy (Rx operation ongoing) |
168 | * 1 : Busy (Rx operation ongoing) |
| Line 177... | Line 182... | ||
| 177 | UART_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */ |
182 | UART_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */ |
| 178 | UART_CLOCKSOURCE_UNDEFINED = 0x10U /*!< Undefined clock source */ |
183 | UART_CLOCKSOURCE_UNDEFINED = 0x10U /*!< Undefined clock source */ |
| 179 | } UART_ClockSourceTypeDef; |
184 | } UART_ClockSourceTypeDef; |
| 180 | 185 | ||
| 181 | /** |
186 | /** |
| - | 187 | * @brief HAL UART Reception type definition |
|
| - | 188 | * @note HAL UART Reception type value aims to identify which type of Reception is ongoing. |
|
| - | 189 | * It is expected to admit following values : |
|
| - | 190 | * HAL_UART_RECEPTION_STANDARD = 0x00U, |
|
| - | 191 | * HAL_UART_RECEPTION_TOIDLE = 0x01U, |
|
| - | 192 | * HAL_UART_RECEPTION_TORTO = 0x02U, |
|
| - | 193 | * HAL_UART_RECEPTION_TOCHARMATCH = 0x03U, |
|
| - | 194 | */ |
|
| - | 195 | typedef uint32_t HAL_UART_RxTypeTypeDef; |
|
| - | 196 | ||
| - | 197 | /** |
|
| 182 | * @brief UART handle Structure definition |
198 | * @brief UART handle Structure definition |
| 183 | */ |
199 | */ |
| 184 | typedef struct __UART_HandleTypeDef |
200 | typedef struct __UART_HandleTypeDef |
| 185 | { |
201 | { |
| 186 | USART_TypeDef *Instance; /*!< UART registers base address */ |
202 | USART_TypeDef *Instance; /*!< UART registers base address */ |
| Line 201... | Line 217... | ||
| 201 | 217 | ||
| 202 | __IO uint16_t RxXferCount; /*!< UART Rx Transfer Counter */ |
218 | __IO uint16_t RxXferCount; /*!< UART Rx Transfer Counter */ |
| 203 | 219 | ||
| 204 | uint16_t Mask; /*!< UART Rx RDR register mask */ |
220 | uint16_t Mask; /*!< UART Rx RDR register mask */ |
| 205 | 221 | ||
| - | 222 | __IO HAL_UART_RxTypeTypeDef ReceptionType; /*!< Type of ongoing reception */ |
|
| - | 223 | ||
| 206 | void (*RxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Rx IRQ handler */ |
224 | void (*RxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Rx IRQ handler */ |
| 207 | 225 | ||
| 208 | void (*TxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Tx IRQ handler */ |
226 | void (*TxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Tx IRQ handler */ |
| 209 | 227 | ||
| 210 | DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */ |
228 | DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */ |
| Line 212... | Line 230... | ||
| 212 | DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */ |
230 | DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */ |
| 213 | 231 | ||
| 214 | HAL_LockTypeDef Lock; /*!< Locking object */ |
232 | HAL_LockTypeDef Lock; /*!< Locking object */ |
| 215 | 233 | ||
| 216 | __IO HAL_UART_StateTypeDef gState; /*!< UART state information related to global Handle management |
234 | __IO HAL_UART_StateTypeDef gState; /*!< UART state information related to global Handle management |
| 217 | and also related to Tx operations. |
235 | and also related to Tx operations. This parameter |
| 218 | This parameter can be a value of @ref HAL_UART_StateTypeDef */ |
236 | can be a value of @ref HAL_UART_StateTypeDef */ |
| 219 | 237 | ||
| 220 | __IO HAL_UART_StateTypeDef RxState; /*!< UART state information related to Rx operations. |
238 | __IO HAL_UART_StateTypeDef RxState; /*!< UART state information related to Rx operations. This |
| 221 | This parameter can be a value of @ref HAL_UART_StateTypeDef */ |
239 | parameter can be a value of @ref HAL_UART_StateTypeDef */ |
| 222 | 240 | ||
| 223 | __IO uint32_t ErrorCode; /*!< UART Error code */ |
241 | __IO uint32_t ErrorCode; /*!< UART Error code */ |
| 224 | 242 | ||
| 225 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
243 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
| 226 | void (* TxHalfCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Half Complete Callback */ |
244 | void (* TxHalfCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Half Complete Callback */ |
| Line 229... | Line 247... | ||
| 229 | void (* RxCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Complete Callback */ |
247 | void (* RxCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Complete Callback */ |
| 230 | void (* ErrorCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Error Callback */ |
248 | void (* ErrorCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Error Callback */ |
| 231 | void (* AbortCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Complete Callback */ |
249 | void (* AbortCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Complete Callback */ |
| 232 | void (* AbortTransmitCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Transmit Complete Callback */ |
250 | void (* AbortTransmitCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Transmit Complete Callback */ |
| 233 | void (* AbortReceiveCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Receive Complete Callback */ |
251 | void (* AbortReceiveCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Receive Complete Callback */ |
| - | 252 | #if defined(USART_CR1_UESM) |
|
| - | 253 | #if defined(USART_CR3_WUFIE) |
|
| 234 | void (* WakeupCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Wakeup Callback */ |
254 | void (* WakeupCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Wakeup Callback */ |
| - | 255 | #endif /* USART_CR3_WUFIE */ |
|
| - | 256 | #endif /* USART_CR1_UESM */ |
|
| - | 257 | void (* RxEventCallback)(struct __UART_HandleTypeDef *huart, uint16_t Pos); /*!< UART Reception Event Callback */ |
|
| 235 | 258 | ||
| 236 | void (* MspInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp Init callback */ |
259 | void (* MspInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp Init callback */ |
| 237 | void (* MspDeInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp DeInit callback */ |
260 | void (* MspDeInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp DeInit callback */ |
| 238 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
261 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
| 239 | 262 | ||
| Line 261... | Line 284... | ||
| 261 | } HAL_UART_CallbackIDTypeDef; |
284 | } HAL_UART_CallbackIDTypeDef; |
| 262 | 285 | ||
| 263 | /** |
286 | /** |
| 264 | * @brief HAL UART Callback pointer definition |
287 | * @brief HAL UART Callback pointer definition |
| 265 | */ |
288 | */ |
| 266 | typedef void (*pUART_CallbackTypeDef)(UART_HandleTypeDef *huart); /*!< pointer to an UART callback function */ |
289 | typedef void (*pUART_CallbackTypeDef)(UART_HandleTypeDef *huart); /*!< pointer to an UART callback function */ |
| - | 290 | typedef void (*pUART_RxEventCallbackTypeDef) |
|
| - | 291 | (struct __UART_HandleTypeDef *huart, uint16_t Pos); /*!< pointer to a UART Rx Event specific callback function */ |
|
| 267 | 292 | ||
| 268 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
293 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
| 269 | 294 | ||
| 270 | /** |
295 | /** |
| 271 | * @} |
296 | * @} |
| Line 288... | Line 313... | ||
| 288 | #define HAL_UART_STATE_BUSY_TX 0x00000021U /*!< Data Transmission process is ongoing |
313 | #define HAL_UART_STATE_BUSY_TX 0x00000021U /*!< Data Transmission process is ongoing |
| 289 | Value is allowed for gState only */ |
314 | Value is allowed for gState only */ |
| 290 | #define HAL_UART_STATE_BUSY_RX 0x00000022U /*!< Data Reception process is ongoing |
315 | #define HAL_UART_STATE_BUSY_RX 0x00000022U /*!< Data Reception process is ongoing |
| 291 | Value is allowed for RxState only */ |
316 | Value is allowed for RxState only */ |
| 292 | #define HAL_UART_STATE_BUSY_TX_RX 0x00000023U /*!< Data Transmission and Reception process is ongoing |
317 | #define HAL_UART_STATE_BUSY_TX_RX 0x00000023U /*!< Data Transmission and Reception process is ongoing |
| 293 | Not to be used for neither gState nor RxState. |
318 | Not to be used for neither gState nor RxState.Value is result |
| 294 | Value is result of combination (Or) between gState and RxState values */ |
319 | of combination (Or) between gState and RxState values */ |
| 295 | #define HAL_UART_STATE_TIMEOUT 0x000000A0U /*!< Timeout state |
320 | #define HAL_UART_STATE_TIMEOUT 0x000000A0U /*!< Timeout state |
| 296 | Value is allowed for gState only */ |
321 | Value is allowed for gState only */ |
| 297 | #define HAL_UART_STATE_ERROR 0x000000E0U /*!< Error |
322 | #define HAL_UART_STATE_ERROR 0x000000E0U /*!< Error |
| 298 | Value is allowed for gState only */ |
323 | Value is allowed for gState only */ |
| 299 | /** |
324 | /** |
| Line 301... | Line 326... | ||
| 301 | */ |
326 | */ |
| 302 | 327 | ||
| 303 | /** @defgroup UART_Error_Definition UART Error Definition |
328 | /** @defgroup UART_Error_Definition UART Error Definition |
| 304 | * @{ |
329 | * @{ |
| 305 | */ |
330 | */ |
| 306 | #define HAL_UART_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ |
331 | #define HAL_UART_ERROR_NONE (0x00000000U) /*!< No error */ |
| 307 | #define HAL_UART_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */ |
332 | #define HAL_UART_ERROR_PE (0x00000001U) /*!< Parity error */ |
| 308 | #define HAL_UART_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */ |
333 | #define HAL_UART_ERROR_NE (0x00000002U) /*!< Noise error */ |
| 309 | #define HAL_UART_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */ |
334 | #define HAL_UART_ERROR_FE (0x00000004U) /*!< Frame error */ |
| 310 | #define HAL_UART_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */ |
335 | #define HAL_UART_ERROR_ORE (0x00000008U) /*!< Overrun error */ |
| 311 | #define HAL_UART_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ |
336 | #define HAL_UART_ERROR_DMA (0x00000010U) /*!< DMA transfer error */ |
| 312 | #define HAL_UART_ERROR_RTO ((uint32_t)0x00000020U) /*!< Receiver Timeout error */ |
337 | #define HAL_UART_ERROR_RTO (0x00000020U) /*!< Receiver Timeout error */ |
| 313 | 338 | ||
| 314 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
339 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
| 315 | #define HAL_UART_ERROR_INVALID_CALLBACK ((uint32_t)0x00000040U) /*!< Invalid Callback error */ |
340 | #define HAL_UART_ERROR_INVALID_CALLBACK (0x00000040U) /*!< Invalid Callback error */ |
| 316 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
341 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
| 317 | /** |
342 | /** |
| 318 | * @} |
343 | * @} |
| 319 | */ |
344 | */ |
| 320 | 345 | ||
| Line 388... | Line 413... | ||
| 388 | */ |
413 | */ |
| 389 | 414 | ||
| 390 | /** @defgroup UART_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode |
415 | /** @defgroup UART_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode |
| 391 | * @{ |
416 | * @{ |
| 392 | */ |
417 | */ |
| 393 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT 0x00000000U /*!< Auto Baud rate detection on start bit */ |
418 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT 0x00000000U /*!< Auto Baud rate detection |
| - | 419 | on start bit */ |
|
| 394 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE USART_CR2_ABRMODE_0 /*!< Auto Baud rate detection on falling edge */ |
420 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE USART_CR2_ABRMODE_0 /*!< Auto Baud rate detection |
| - | 421 | on falling edge */ |
|
| 395 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME USART_CR2_ABRMODE_1 /*!< Auto Baud rate detection on 0x7F frame detection */ |
422 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME USART_CR2_ABRMODE_1 /*!< Auto Baud rate detection |
| - | 423 | on 0x7F frame detection */ |
|
| 396 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME USART_CR2_ABRMODE /*!< Auto Baud rate detection on 0x55 frame detection */ |
424 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME USART_CR2_ABRMODE /*!< Auto Baud rate detection |
| - | 425 | on 0x55 frame detection */ |
|
| 397 | /** |
426 | /** |
| 398 | * @} |
427 | * @} |
| 399 | */ |
428 | */ |
| 400 | 429 | ||
| 401 | /** @defgroup UART_Receiver_Timeout UART Receiver Timeout |
430 | /** @defgroup UART_Receiver_Timeout UART Receiver Timeout |
| Line 553... | Line 582... | ||
| 553 | */ |
582 | */ |
| 554 | 583 | ||
| 555 | /** @defgroup UART_MSB_First UART Advanced Feature MSB First |
584 | /** @defgroup UART_MSB_First UART Advanced Feature MSB First |
| 556 | * @{ |
585 | * @{ |
| 557 | */ |
586 | */ |
| 558 | #define UART_ADVFEATURE_MSBFIRST_DISABLE 0x00000000U /*!< Most significant bit sent/received first disable */ |
587 | #define UART_ADVFEATURE_MSBFIRST_DISABLE 0x00000000U /*!< Most significant bit sent/received |
| - | 588 | first disable */ |
|
| 559 | #define UART_ADVFEATURE_MSBFIRST_ENABLE USART_CR2_MSBFIRST /*!< Most significant bit sent/received first enable */ |
589 | #define UART_ADVFEATURE_MSBFIRST_ENABLE USART_CR2_MSBFIRST /*!< Most significant bit sent/received |
| - | 590 | first enable */ |
|
| 560 | /** |
591 | /** |
| 561 | * @} |
592 | * @} |
| 562 | */ |
593 | */ |
| 563 | #if defined(USART_CR1_UESM) |
594 | #if defined(USART_CR1_UESM) |
| 564 | 595 | ||
| Line 582... | Line 613... | ||
| 582 | */ |
613 | */ |
| 583 | 614 | ||
| 584 | /** @defgroup UART_CR2_ADDRESS_LSB_POS UART Address-matching LSB Position In CR2 Register |
615 | /** @defgroup UART_CR2_ADDRESS_LSB_POS UART Address-matching LSB Position In CR2 Register |
| 585 | * @{ |
616 | * @{ |
| 586 | */ |
617 | */ |
| 587 | #define UART_CR2_ADDRESS_LSB_POS 24U /*!< UART address-matching LSB position in CR2 register */ |
618 | #define UART_CR2_ADDRESS_LSB_POS 24U /*!< UART address-matching LSB position in CR2 register */ |
| 588 | /** |
619 | /** |
| 589 | * @} |
620 | * @} |
| 590 | */ |
621 | */ |
| 591 | #if defined(USART_CR1_UESM) |
622 | #if defined(USART_CR1_UESM) |
| 592 | 623 | ||
| 593 | /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection |
624 | /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection |
| 594 | * @{ |
625 | * @{ |
| 595 | */ |
626 | */ |
| - | 627 | #if defined(USART_CR3_WUS) |
|
| 596 | #define UART_WAKEUP_ON_ADDRESS 0x00000000U /*!< UART wake-up on address */ |
628 | #define UART_WAKEUP_ON_ADDRESS 0x00000000U /*!< UART wake-up on address */ |
| 597 | #define UART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< UART wake-up on start bit */ |
629 | #define UART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< UART wake-up on start bit */ |
| 598 | #define UART_WAKEUP_ON_READDATA_NONEMPTY USART_CR3_WUS /*!< UART wake-up on receive data register not empty or RXFIFO is not empty */ |
630 | #define UART_WAKEUP_ON_READDATA_NONEMPTY USART_CR3_WUS /*!< UART wake-up on receive data register |
| - | 631 | not empty or RXFIFO is not empty */ |
|
| - | 632 | #else |
|
| - | 633 | #define UART_WAKEUP_ON_ADDRESS 0x00000000U /*!< UART wake-up on address */ |
|
| - | 634 | #define UART_WAKEUP_ON_READDATA_NONEMPTY 0x00000001U /*!< UART wake-up on receive data register |
|
| - | 635 | not empty or RXFIFO is not empty */ |
|
| - | 636 | #endif /* USART_CR3_WUS */ |
|
| 599 | /** |
637 | /** |
| 600 | * @} |
638 | * @} |
| 601 | */ |
639 | */ |
| 602 | #endif /* USART_CR1_UESM */ |
640 | #endif /* USART_CR1_UESM */ |
| 603 | 641 | ||
| Line 611... | Line 649... | ||
| 611 | */ |
649 | */ |
| 612 | 650 | ||
| 613 | /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS UART Driver Enable Assertion Time LSB Position In CR1 Register |
651 | /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS UART Driver Enable Assertion Time LSB Position In CR1 Register |
| 614 | * @{ |
652 | * @{ |
| 615 | */ |
653 | */ |
| 616 | #define UART_CR1_DEAT_ADDRESS_LSB_POS 21U /*!< UART Driver Enable assertion time LSB position in CR1 register */ |
654 | #define UART_CR1_DEAT_ADDRESS_LSB_POS 21U /*!< UART Driver Enable assertion time LSB |
| - | 655 | position in CR1 register */ |
|
| 617 | /** |
656 | /** |
| 618 | * @} |
657 | * @} |
| 619 | */ |
658 | */ |
| 620 | 659 | ||
| 621 | /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS UART Driver Enable DeAssertion Time LSB Position In CR1 Register |
660 | /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS UART Driver Enable DeAssertion Time LSB Position In CR1 Register |
| 622 | * @{ |
661 | * @{ |
| 623 | */ |
662 | */ |
| 624 | #define UART_CR1_DEDT_ADDRESS_LSB_POS 16U /*!< UART Driver Enable de-assertion time LSB position in CR1 register */ |
663 | #define UART_CR1_DEDT_ADDRESS_LSB_POS 16U /*!< UART Driver Enable de-assertion time LSB |
| - | 664 | position in CR1 register */ |
|
| 625 | /** |
665 | /** |
| 626 | * @} |
666 | * @} |
| 627 | */ |
667 | */ |
| 628 | 668 | ||
| 629 | /** @defgroup UART_Interruption_Mask UART Interruptions Flag Mask |
669 | /** @defgroup UART_Interruption_Mask UART Interruptions Flag Mask |
| Line 648... | Line 688... | ||
| 648 | * @{ |
688 | * @{ |
| 649 | */ |
689 | */ |
| 650 | #define UART_FLAG_REACK USART_ISR_REACK /*!< UART receive enable acknowledge flag */ |
690 | #define UART_FLAG_REACK USART_ISR_REACK /*!< UART receive enable acknowledge flag */ |
| 651 | #define UART_FLAG_TEACK USART_ISR_TEACK /*!< UART transmit enable acknowledge flag */ |
691 | #define UART_FLAG_TEACK USART_ISR_TEACK /*!< UART transmit enable acknowledge flag */ |
| 652 | #if defined(USART_CR1_UESM) |
692 | #if defined(USART_CR1_UESM) |
| - | 693 | #if defined(USART_CR3_WUFIE) |
|
| 653 | #define UART_FLAG_WUF USART_ISR_WUF /*!< UART wake-up from stop mode flag */ |
694 | #define UART_FLAG_WUF USART_ISR_WUF /*!< UART wake-up from stop mode flag */ |
| - | 695 | #endif /* USART_CR3_WUFIE */ |
|
| 654 | #endif /* USART_CR1_UESM */ |
696 | #endif /* USART_CR1_UESM */ |
| 655 | #define UART_FLAG_RWU USART_ISR_RWU /*!< UART receiver wake-up from mute mode flag */ |
697 | #define UART_FLAG_RWU USART_ISR_RWU /*!< UART receiver wake-up from mute mode flag */ |
| 656 | #define UART_FLAG_SBKF USART_ISR_SBKF /*!< UART send break flag */ |
698 | #define UART_FLAG_SBKF USART_ISR_SBKF /*!< UART send break flag */ |
| 657 | #define UART_FLAG_CMF USART_ISR_CMF /*!< UART character match flag */ |
699 | #define UART_FLAG_CMF USART_ISR_CMF /*!< UART character match flag */ |
| 658 | #define UART_FLAG_BUSY USART_ISR_BUSY /*!< UART busy flag */ |
700 | #define UART_FLAG_BUSY USART_ISR_BUSY /*!< UART busy flag */ |
| Line 690... | Line 732... | ||
| 690 | * - 11: CR3 register |
732 | * - 11: CR3 register |
| 691 | * Elements values convention: 0000ZZZZ00000000b |
733 | * Elements values convention: 0000ZZZZ00000000b |
| 692 | * - ZZZZ : Flag position in the ISR register(4bits) |
734 | * - ZZZZ : Flag position in the ISR register(4bits) |
| 693 | * @{ |
735 | * @{ |
| 694 | */ |
736 | */ |
| 695 | #define UART_IT_PE 0x0028U /*!< UART parity error interruption */ |
737 | #define UART_IT_PE 0x0028U /*!< UART parity error interruption */ |
| 696 | #define UART_IT_TXE 0x0727U /*!< UART transmit data register empty interruption */ |
738 | #define UART_IT_TXE 0x0727U /*!< UART transmit data register empty interruption */ |
| 697 | #define UART_IT_TC 0x0626U /*!< UART transmission complete interruption */ |
739 | #define UART_IT_TC 0x0626U /*!< UART transmission complete interruption */ |
| 698 | #define UART_IT_RXNE 0x0525U /*!< UART read data register not empty interruption */ |
740 | #define UART_IT_RXNE 0x0525U /*!< UART read data register not empty interruption */ |
| 699 | #define UART_IT_IDLE 0x0424U /*!< UART idle interruption */ |
741 | #define UART_IT_IDLE 0x0424U /*!< UART idle interruption */ |
| 700 | #define UART_IT_LBD 0x0846U /*!< UART LIN break detection interruption */ |
742 | #define UART_IT_LBD 0x0846U /*!< UART LIN break detection interruption */ |
| 701 | #define UART_IT_CTS 0x096AU /*!< UART CTS interruption */ |
743 | #define UART_IT_CTS 0x096AU /*!< UART CTS interruption */ |
| 702 | #define UART_IT_CM 0x112EU /*!< UART character match interruption */ |
744 | #define UART_IT_CM 0x112EU /*!< UART character match interruption */ |
| 703 | #if defined(USART_CR1_UESM) |
745 | #if defined(USART_CR1_UESM) |
| - | 746 | #if defined(USART_CR3_WUFIE) |
|
| 704 | #define UART_IT_WUF 0x1476U /*!< UART wake-up from stop mode interruption */ |
747 | #define UART_IT_WUF 0x1476U /*!< UART wake-up from stop mode interruption */ |
| - | 748 | #endif /* USART_CR3_WUFIE */ |
|
| 705 | #endif /* USART_CR1_UESM */ |
749 | #endif /* USART_CR1_UESM */ |
| 706 | #define UART_IT_RTO 0x0B3AU /*!< UART receiver timeout interruption */ |
750 | #define UART_IT_RTO 0x0B3AU /*!< UART receiver timeout interruption */ |
| 707 | 751 | ||
| 708 | #define UART_IT_ERR 0x0060U /*!< UART error interruption */ |
752 | #define UART_IT_ERR 0x0060U /*!< UART error interruption */ |
| 709 | 753 | ||
| 710 | #define UART_IT_ORE 0x0300U /*!< UART overrun error interruption */ |
754 | #define UART_IT_ORE 0x0300U /*!< UART overrun error interruption */ |
| 711 | #define UART_IT_NE 0x0200U /*!< UART noise error interruption */ |
755 | #define UART_IT_NE 0x0200U /*!< UART noise error interruption */ |
| 712 | #define UART_IT_FE 0x0100U /*!< UART frame error interruption */ |
756 | #define UART_IT_FE 0x0100U /*!< UART frame error interruption */ |
| 713 | /** |
757 | /** |
| 714 | * @} |
758 | * @} |
| 715 | */ |
759 | */ |
| 716 | 760 | ||
| 717 | /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags |
761 | /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags |
| Line 725... | Line 769... | ||
| 725 | #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
769 | #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
| 726 | #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag */ |
770 | #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag */ |
| 727 | #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
771 | #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
| 728 | #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */ |
772 | #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */ |
| 729 | #if defined(USART_CR1_UESM) |
773 | #if defined(USART_CR1_UESM) |
| - | 774 | #if defined(USART_CR3_WUFIE) |
|
| 730 | #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */ |
775 | #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */ |
| - | 776 | #endif /* USART_CR3_WUFIE */ |
|
| 731 | #endif /* USART_CR1_UESM */ |
777 | #endif /* USART_CR1_UESM */ |
| 732 | #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< UART receiver timeout clear flag */ |
778 | #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< UART receiver timeout clear flag */ |
| 733 | /** |
779 | /** |
| 734 | * @} |
780 | * @} |
| 735 | */ |
781 | */ |
| 736 | 782 | ||
| - | 783 | /** @defgroup UART_RECEPTION_TYPE_Values UART Reception type values |
|
| - | 784 | * @{ |
|
| - | 785 | */ |
|
| - | 786 | #define HAL_UART_RECEPTION_STANDARD (0x00000000U) /*!< Standard reception */ |
|
| - | 787 | #define HAL_UART_RECEPTION_TOIDLE (0x00000001U) /*!< Reception till completion or IDLE event */ |
|
| - | 788 | #define HAL_UART_RECEPTION_TORTO (0x00000002U) /*!< Reception till completion or RTO event */ |
|
| - | 789 | #define HAL_UART_RECEPTION_TOCHARMATCH (0x00000003U) /*!< Reception till completion or CM event */ |
|
| - | 790 | /** |
|
| - | 791 | * @} |
|
| - | 792 | */ |
|
| 737 | 793 | ||
| 738 | /** |
794 | /** |
| 739 | * @} |
795 | * @} |
| 740 | */ |
796 | */ |
| 741 | 797 | ||
| Line 785... | Line 841... | ||
| 785 | * @arg @ref UART_CLEAR_RTOF Receiver Timeout clear flag |
841 | * @arg @ref UART_CLEAR_RTOF Receiver Timeout clear flag |
| 786 | * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag |
842 | * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag |
| 787 | * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag |
843 | * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag |
| 788 | * @arg @ref UART_CLEAR_CMF Character Match Clear Flag |
844 | * @arg @ref UART_CLEAR_CMF Character Match Clear Flag |
| 789 | #if defined(USART_CR1_UESM) |
845 | #if defined(USART_CR1_UESM) |
| - | 846 | #if defined(USART_CR3_WUFIE) |
|
| 790 | * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag |
847 | * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag |
| 791 | #endif |
848 | #endif |
| - | 849 | #endif |
|
| 792 | * @retval None |
850 | * @retval None |
| 793 | */ |
851 | */ |
| 794 | #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
852 | #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
| 795 | 853 | ||
| 796 | /** @brief Clear the UART PE pending flag. |
854 | /** @brief Clear the UART PE pending flag. |
| Line 828... | Line 886... | ||
| 828 | * @param __HANDLE__ specifies the UART Handle. |
886 | * @param __HANDLE__ specifies the UART Handle. |
| 829 | * @param __FLAG__ specifies the flag to check. |
887 | * @param __FLAG__ specifies the flag to check. |
| 830 | * This parameter can be one of the following values: |
888 | * This parameter can be one of the following values: |
| 831 | * @arg @ref UART_FLAG_REACK Receive enable acknowledge flag |
889 | * @arg @ref UART_FLAG_REACK Receive enable acknowledge flag |
| 832 | * @arg @ref UART_FLAG_TEACK Transmit enable acknowledge flag |
890 | * @arg @ref UART_FLAG_TEACK Transmit enable acknowledge flag |
| 833 | #if defined(USART_CR1_UESM) |
891 | #if defined(USART_CR1_UESM) |
| - | 892 | #if defined(USART_CR3_WUFIE) |
|
| 834 | * @arg @ref UART_FLAG_WUF Wake up from stop mode flag |
893 | * @arg @ref UART_FLAG_WUF Wake up from stop mode flag |
| - | 894 | #endif |
|
| 835 | #endif |
895 | #endif |
| 836 | * @arg @ref UART_FLAG_RWU Receiver wake up flag (if the UART in mute mode) |
896 | * @arg @ref UART_FLAG_RWU Receiver wake up flag (if the UART in mute mode) |
| 837 | * @arg @ref UART_FLAG_SBKF Send Break flag |
897 | * @arg @ref UART_FLAG_SBKF Send Break flag |
| 838 | * @arg @ref UART_FLAG_CMF Character match flag |
898 | * @arg @ref UART_FLAG_CMF Character match flag |
| 839 | * @arg @ref UART_FLAG_BUSY Busy flag |
899 | * @arg @ref UART_FLAG_BUSY Busy flag |
| 840 | * @arg @ref UART_FLAG_ABRF Auto Baud rate detection flag |
900 | * @arg @ref UART_FLAG_ABRF Auto Baud rate detection flag |
| Line 857... | Line 917... | ||
| 857 | /** @brief Enable the specified UART interrupt. |
917 | /** @brief Enable the specified UART interrupt. |
| 858 | * @param __HANDLE__ specifies the UART Handle. |
918 | * @param __HANDLE__ specifies the UART Handle. |
| 859 | * @param __INTERRUPT__ specifies the UART interrupt source to enable. |
919 | * @param __INTERRUPT__ specifies the UART interrupt source to enable. |
| 860 | * This parameter can be one of the following values: |
920 | * This parameter can be one of the following values: |
| 861 | #if defined(USART_CR1_UESM) |
921 | #if defined(USART_CR1_UESM) |
| - | 922 | #if defined(USART_CR3_WUFIE) |
|
| 862 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
923 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
| 863 | #endif |
924 | #endif |
| - | 925 | #endif |
|
| 864 | * @arg @ref UART_IT_CM Character match interrupt |
926 | * @arg @ref UART_IT_CM Character match interrupt |
| 865 | * @arg @ref UART_IT_CTS CTS change interrupt |
927 | * @arg @ref UART_IT_CTS CTS change interrupt |
| 866 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
928 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
| 867 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
929 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
| 868 | * @arg @ref UART_IT_TC Transmission complete interrupt |
930 | * @arg @ref UART_IT_TC Transmission complete interrupt |
| Line 871... | Line 933... | ||
| 871 | * @arg @ref UART_IT_IDLE Idle line detection interrupt |
933 | * @arg @ref UART_IT_IDLE Idle line detection interrupt |
| 872 | * @arg @ref UART_IT_PE Parity Error interrupt |
934 | * @arg @ref UART_IT_PE Parity Error interrupt |
| 873 | * @arg @ref UART_IT_ERR Error interrupt (frame error, noise error, overrun error) |
935 | * @arg @ref UART_IT_ERR Error interrupt (frame error, noise error, overrun error) |
| 874 | * @retval None |
936 | * @retval None |
| 875 | */ |
937 | */ |
| - | 938 | #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (\ |
|
| - | 939 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)?\ |
|
| - | 940 | ((__HANDLE__)->Instance->CR1 |= (1U <<\ |
|
| 876 | #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \ |
941 | ((__INTERRUPT__) & UART_IT_MASK))): \ |
| 877 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \ |
942 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)?\ |
| - | 943 | ((__HANDLE__)->Instance->CR2 |= (1U <<\ |
|
| - | 944 | ((__INTERRUPT__) & UART_IT_MASK))): \ |
|
| - | 945 | ((__HANDLE__)->Instance->CR3 |= (1U <<\ |
|
| 878 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK)))) |
946 | ((__INTERRUPT__) & UART_IT_MASK)))) |
| 879 | - | ||
| 880 | 947 | ||
| 881 | /** @brief Disable the specified UART interrupt. |
948 | /** @brief Disable the specified UART interrupt. |
| 882 | * @param __HANDLE__ specifies the UART Handle. |
949 | * @param __HANDLE__ specifies the UART Handle. |
| 883 | * @param __INTERRUPT__ specifies the UART interrupt source to disable. |
950 | * @param __INTERRUPT__ specifies the UART interrupt source to disable. |
| 884 | * This parameter can be one of the following values: |
951 | * This parameter can be one of the following values: |
| 885 | #if defined(USART_CR1_UESM) |
952 | #if defined(USART_CR1_UESM) |
| - | 953 | #if defined(USART_CR3_WUFIE) |
|
| 886 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
954 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
| 887 | #endif |
955 | #endif |
| - | 956 | #endif |
|
| 888 | * @arg @ref UART_IT_CM Character match interrupt |
957 | * @arg @ref UART_IT_CM Character match interrupt |
| 889 | * @arg @ref UART_IT_CTS CTS change interrupt |
958 | * @arg @ref UART_IT_CTS CTS change interrupt |
| 890 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
959 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
| 891 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
960 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
| 892 | * @arg @ref UART_IT_TC Transmission complete interrupt |
961 | * @arg @ref UART_IT_TC Transmission complete interrupt |
| Line 895... | Line 964... | ||
| 895 | * @arg @ref UART_IT_IDLE Idle line detection interrupt |
964 | * @arg @ref UART_IT_IDLE Idle line detection interrupt |
| 896 | * @arg @ref UART_IT_PE Parity Error interrupt |
965 | * @arg @ref UART_IT_PE Parity Error interrupt |
| 897 | * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error) |
966 | * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error) |
| 898 | * @retval None |
967 | * @retval None |
| 899 | */ |
968 | */ |
| - | 969 | #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (\ |
|
| - | 970 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)?\ |
|
| - | 971 | ((__HANDLE__)->Instance->CR1 &= ~ (1U <<\ |
|
| 900 | #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \ |
972 | ((__INTERRUPT__) & UART_IT_MASK))): \ |
| 901 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \ |
973 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)?\ |
| - | 974 | ((__HANDLE__)->Instance->CR2 &= ~ (1U <<\ |
|
| - | 975 | ((__INTERRUPT__) & UART_IT_MASK))): \ |
|
| 902 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK)))) |
976 | ((__HANDLE__)->Instance->CR3 &= ~ (1U <<\ |
| - | 977 | ((__INTERRUPT__) & UART_IT_MASK)))) |
|
| 903 | 978 | ||
| 904 | /** @brief Check whether the specified UART interrupt has occurred or not. |
979 | /** @brief Check whether the specified UART interrupt has occurred or not. |
| 905 | * @param __HANDLE__ specifies the UART Handle. |
980 | * @param __HANDLE__ specifies the UART Handle. |
| 906 | * @param __INTERRUPT__ specifies the UART interrupt to check. |
981 | * @param __INTERRUPT__ specifies the UART interrupt to check. |
| 907 | * This parameter can be one of the following values: |
982 | * This parameter can be one of the following values: |
| 908 | #if defined(USART_CR1_UESM) |
983 | #if defined(USART_CR1_UESM) |
| - | 984 | #if defined(USART_CR3_WUFIE) |
|
| 909 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
985 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
| 910 | #endif |
986 | #endif |
| - | 987 | #endif |
|
| 911 | * @arg @ref UART_IT_CM Character match interrupt |
988 | * @arg @ref UART_IT_CM Character match interrupt |
| 912 | * @arg @ref UART_IT_CTS CTS change interrupt |
989 | * @arg @ref UART_IT_CTS CTS change interrupt |
| 913 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
990 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
| 914 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
991 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
| 915 | * @arg @ref UART_IT_TC Transmission complete interrupt |
992 | * @arg @ref UART_IT_TC Transmission complete interrupt |
| Line 926... | Line 1003... | ||
| 926 | /** @brief Check whether the specified UART interrupt source is enabled or not. |
1003 | /** @brief Check whether the specified UART interrupt source is enabled or not. |
| 927 | * @param __HANDLE__ specifies the UART Handle. |
1004 | * @param __HANDLE__ specifies the UART Handle. |
| 928 | * @param __INTERRUPT__ specifies the UART interrupt source to check. |
1005 | * @param __INTERRUPT__ specifies the UART interrupt source to check. |
| 929 | * This parameter can be one of the following values: |
1006 | * This parameter can be one of the following values: |
| 930 | #if defined(USART_CR1_UESM) |
1007 | #if defined(USART_CR1_UESM) |
| - | 1008 | #if defined(USART_CR3_WUFIE) |
|
| 931 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
1009 | * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt |
| 932 | #endif |
1010 | #endif |
| - | 1011 | #endif |
|
| 933 | * @arg @ref UART_IT_CM Character match interrupt |
1012 | * @arg @ref UART_IT_CM Character match interrupt |
| 934 | * @arg @ref UART_IT_CTS CTS change interrupt |
1013 | * @arg @ref UART_IT_CTS CTS change interrupt |
| 935 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
1014 | * @arg @ref UART_IT_LBD LIN Break detection interrupt |
| 936 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
1015 | * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt |
| 937 | * @arg @ref UART_IT_TC Transmission complete interrupt |
1016 | * @arg @ref UART_IT_TC Transmission complete interrupt |
| Line 940... | Line 1019... | ||
| 940 | * @arg @ref UART_IT_IDLE Idle line detection interrupt |
1019 | * @arg @ref UART_IT_IDLE Idle line detection interrupt |
| 941 | * @arg @ref UART_IT_PE Parity Error interrupt |
1020 | * @arg @ref UART_IT_PE Parity Error interrupt |
| 942 | * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error) |
1021 | * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error) |
| 943 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
1022 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
| 944 | */ |
1023 | */ |
| 945 | #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U) ? (__HANDLE__)->Instance->CR1 : \ |
1024 | #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U) ?\ |
| - | 1025 | (__HANDLE__)->Instance->CR1 : \ |
|
| 946 | (((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U) ? (__HANDLE__)->Instance->CR2 : \ |
1026 | (((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U) ?\ |
| - | 1027 | (__HANDLE__)->Instance->CR2 : \ |
|
| - | 1028 | (__HANDLE__)->Instance->CR3)) & (1U <<\ |
|
| - | 1029 | (((uint16_t)(__INTERRUPT__)) &\ |
|
| 947 | (__HANDLE__)->Instance->CR3)) & (1U << (((uint16_t)(__INTERRUPT__)) & UART_IT_MASK))) != RESET) ? SET : RESET) |
1030 | UART_IT_MASK))) != RESET) ? SET : RESET) |
| 948 | 1031 | ||
| 949 | /** @brief Clear the specified UART ISR flag, in setting the proper ICR register flag. |
1032 | /** @brief Clear the specified UART ISR flag, in setting the proper ICR register flag. |
| 950 | * @param __HANDLE__ specifies the UART Handle. |
1033 | * @param __HANDLE__ specifies the UART Handle. |
| 951 | * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set |
1034 | * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set |
| 952 | * to clear the corresponding interrupt |
1035 | * to clear the corresponding interrupt |
| Line 959... | Line 1042... | ||
| 959 | * @arg @ref UART_CLEAR_RTOF Receiver timeout clear flag |
1042 | * @arg @ref UART_CLEAR_RTOF Receiver timeout clear flag |
| 960 | * @arg @ref UART_CLEAR_TCF Transmission Complete Clear Flag |
1043 | * @arg @ref UART_CLEAR_TCF Transmission Complete Clear Flag |
| 961 | * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag |
1044 | * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag |
| 962 | * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag |
1045 | * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag |
| 963 | * @arg @ref UART_CLEAR_CMF Character Match Clear Flag |
1046 | * @arg @ref UART_CLEAR_CMF Character Match Clear Flag |
| 964 | #if defined(USART_CR1_UESM) |
1047 | #if defined(USART_CR1_UESM) |
| - | 1048 | #if defined(USART_CR3_WUFIE) |
|
| 965 | * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag |
1049 | * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag |
| 966 | #endif |
1050 | #endif |
| - | 1051 | #endif |
|
| 967 | * @retval None |
1052 | * @retval None |
| 968 | */ |
1053 | */ |
| 969 | #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
1054 | #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
| 970 | 1055 | ||
| 971 | /** @brief Set a specific UART request flag. |
1056 | /** @brief Set a specific UART request flag. |
| Line 1010... | Line 1095... | ||
| 1010 | * without need to call HAL_UART_Init() function. |
1095 | * without need to call HAL_UART_Init() function. |
| 1011 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
1096 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
| 1012 | * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need |
1097 | * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need |
| 1013 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
1098 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
| 1014 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
1099 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
| 1015 | * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__)) |
1100 | * - macro could only be called when corresponding UART instance is disabled |
| - | 1101 | * (i.e. __HAL_UART_DISABLE(__HANDLE__)) and should be followed by an Enable |
|
| 1016 | * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
1102 | * macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
| 1017 | * @param __HANDLE__ specifies the UART Handle. |
1103 | * @param __HANDLE__ specifies the UART Handle. |
| 1018 | * @retval None |
1104 | * @retval None |
| 1019 | */ |
1105 | */ |
| 1020 | #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \ |
1106 | #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \ |
| 1021 | do{ \ |
1107 | do{ \ |
| 1022 | SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \ |
1108 | ATOMIC_SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \ |
| 1023 | (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \ |
1109 | (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \ |
| 1024 | } while(0U) |
1110 | } while(0U) |
| 1025 | 1111 | ||
| 1026 | /** @brief Disable CTS flow control. |
1112 | /** @brief Disable CTS flow control. |
| 1027 | * @note This macro allows to disable CTS hardware flow control for a given UART instance, |
1113 | * @note This macro allows to disable CTS hardware flow control for a given UART instance, |
| 1028 | * without need to call HAL_UART_Init() function. |
1114 | * without need to call HAL_UART_Init() function. |
| 1029 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
1115 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
| 1030 | * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need |
1116 | * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need |
| 1031 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
1117 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
| 1032 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
1118 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
| 1033 | * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__)) |
1119 | * - macro could only be called when corresponding UART instance is disabled |
| - | 1120 | * (i.e. __HAL_UART_DISABLE(__HANDLE__)) and should be followed by an Enable |
|
| 1034 | * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
1121 | * macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
| 1035 | * @param __HANDLE__ specifies the UART Handle. |
1122 | * @param __HANDLE__ specifies the UART Handle. |
| 1036 | * @retval None |
1123 | * @retval None |
| 1037 | */ |
1124 | */ |
| 1038 | #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \ |
1125 | #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \ |
| 1039 | do{ \ |
1126 | do{ \ |
| 1040 | CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \ |
1127 | ATOMIC_CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \ |
| 1041 | (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \ |
1128 | (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \ |
| 1042 | } while(0U) |
1129 | } while(0U) |
| 1043 | 1130 | ||
| 1044 | /** @brief Enable RTS flow control. |
1131 | /** @brief Enable RTS flow control. |
| 1045 | * @note This macro allows to enable RTS hardware flow control for a given UART instance, |
1132 | * @note This macro allows to enable RTS hardware flow control for a given UART instance, |
| 1046 | * without need to call HAL_UART_Init() function. |
1133 | * without need to call HAL_UART_Init() function. |
| 1047 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
1134 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
| 1048 | * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need |
1135 | * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need |
| 1049 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
1136 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
| 1050 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
1137 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
| 1051 | * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__)) |
1138 | * - macro could only be called when corresponding UART instance is disabled |
| - | 1139 | * (i.e. __HAL_UART_DISABLE(__HANDLE__)) and should be followed by an Enable |
|
| 1052 | * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
1140 | * macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
| 1053 | * @param __HANDLE__ specifies the UART Handle. |
1141 | * @param __HANDLE__ specifies the UART Handle. |
| 1054 | * @retval None |
1142 | * @retval None |
| 1055 | */ |
1143 | */ |
| 1056 | #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \ |
1144 | #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \ |
| 1057 | do{ \ |
1145 | do{ \ |
| 1058 | SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \ |
1146 | ATOMIC_SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \ |
| 1059 | (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \ |
1147 | (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \ |
| 1060 | } while(0U) |
1148 | } while(0U) |
| 1061 | 1149 | ||
| 1062 | /** @brief Disable RTS flow control. |
1150 | /** @brief Disable RTS flow control. |
| 1063 | * @note This macro allows to disable RTS hardware flow control for a given UART instance, |
1151 | * @note This macro allows to disable RTS hardware flow control for a given UART instance, |
| 1064 | * without need to call HAL_UART_Init() function. |
1152 | * without need to call HAL_UART_Init() function. |
| 1065 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
1153 | * As involving direct access to UART registers, usage of this macro should be fully endorsed by user. |
| 1066 | * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need |
1154 | * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need |
| 1067 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
1155 | * for USART instance Deinit/Init, following conditions for macro call should be fulfilled : |
| 1068 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
1156 | * - UART instance should have already been initialised (through call of HAL_UART_Init() ) |
| 1069 | * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__)) |
1157 | * - macro could only be called when corresponding UART instance is disabled |
| - | 1158 | * (i.e. __HAL_UART_DISABLE(__HANDLE__)) and should be followed by an Enable |
|
| 1070 | * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
1159 | * macro (i.e. __HAL_UART_ENABLE(__HANDLE__)). |
| 1071 | * @param __HANDLE__ specifies the UART Handle. |
1160 | * @param __HANDLE__ specifies the UART Handle. |
| 1072 | * @retval None |
1161 | * @retval None |
| 1073 | */ |
1162 | */ |
| 1074 | #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \ |
1163 | #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \ |
| 1075 | do{ \ |
1164 | do{ \ |
| 1076 | CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\ |
1165 | ATOMIC_CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\ |
| 1077 | (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \ |
1166 | (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \ |
| 1078 | } while(0U) |
1167 | } while(0U) |
| 1079 | /** |
1168 | /** |
| 1080 | * @} |
1169 | * @} |
| 1081 | */ |
1170 | */ |
| 1082 | 1171 | ||
| Line 1325... | Line 1414... | ||
| 1325 | /** |
1414 | /** |
| 1326 | * @brief Ensure that UART auto Baud rate state is valid. |
1415 | * @brief Ensure that UART auto Baud rate state is valid. |
| 1327 | * @param __AUTOBAUDRATE__ UART auto Baud rate state. |
1416 | * @param __AUTOBAUDRATE__ UART auto Baud rate state. |
| 1328 | * @retval SET (__AUTOBAUDRATE__ is valid) or RESET (__AUTOBAUDRATE__ is invalid) |
1417 | * @retval SET (__AUTOBAUDRATE__ is valid) or RESET (__AUTOBAUDRATE__ is invalid) |
| 1329 | */ |
1418 | */ |
| 1330 | #define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__) (((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \ |
1419 | #define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__) (((__AUTOBAUDRATE__) == \ |
| - | 1420 | UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \ |
|
| 1331 | ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE)) |
1421 | ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE)) |
| 1332 | 1422 | ||
| 1333 | /** |
1423 | /** |
| 1334 | * @brief Ensure that UART DMA enabling or disabling on error setting is valid. |
1424 | * @brief Ensure that UART DMA enabling or disabling on error setting is valid. |
| 1335 | * @param __DMA__ UART DMA enabling or disabling on error setting. |
1425 | * @param __DMA__ UART DMA enabling or disabling on error setting. |
| 1336 | * @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid) |
1426 | * @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid) |
| Line 1368... | Line 1458... | ||
| 1368 | /** |
1458 | /** |
| 1369 | * @brief Ensure that UART wake-up selection is valid. |
1459 | * @brief Ensure that UART wake-up selection is valid. |
| 1370 | * @param __WAKE__ UART wake-up selection. |
1460 | * @param __WAKE__ UART wake-up selection. |
| 1371 | * @retval SET (__WAKE__ is valid) or RESET (__WAKE__ is invalid) |
1461 | * @retval SET (__WAKE__ is valid) or RESET (__WAKE__ is invalid) |
| 1372 | */ |
1462 | */ |
| - | 1463 | #if defined(USART_CR3_WUFIE) |
|
| 1373 | #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \ |
1464 | #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \ |
| 1374 | ((__WAKE__) == UART_WAKEUP_ON_STARTBIT) || \ |
1465 | ((__WAKE__) == UART_WAKEUP_ON_STARTBIT) || \ |
| 1375 | ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY)) |
1466 | ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY)) |
| - | 1467 | #else |
|
| - | 1468 | #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \ |
|
| - | 1469 | ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY)) |
|
| - | 1470 | #endif /* USART_CR3_WUFIE */ |
|
| 1376 | #endif /* USART_CR1_UESM */ |
1471 | #endif /* USART_CR1_UESM */ |
| 1377 | 1472 | ||
| 1378 | /** |
1473 | /** |
| 1379 | * @brief Ensure that UART driver enable polarity is valid. |
1474 | * @brief Ensure that UART driver enable polarity is valid. |
| 1380 | * @param __POLARITY__ UART driver enable polarity. |
1475 | * @param __POLARITY__ UART driver enable polarity. |
| Line 1389... | Line 1484... | ||
| 1389 | */ |
1484 | */ |
| 1390 | 1485 | ||
| 1391 | /* Include UART HAL Extended module */ |
1486 | /* Include UART HAL Extended module */ |
| 1392 | #include "stm32f0xx_hal_uart_ex.h" |
1487 | #include "stm32f0xx_hal_uart_ex.h" |
| 1393 | 1488 | ||
| 1394 | - | ||
| 1395 | /* Exported functions --------------------------------------------------------*/ |
1489 | /* Exported functions --------------------------------------------------------*/ |
| 1396 | /** @addtogroup UART_Exported_Functions UART Exported Functions |
1490 | /** @addtogroup UART_Exported_Functions UART Exported Functions |
| 1397 | * @{ |
1491 | * @{ |
| 1398 | */ |
1492 | */ |
| 1399 | 1493 | ||
| Line 1415... | Line 1509... | ||
| 1415 | /* Callbacks Register/UnRegister functions ***********************************/ |
1509 | /* Callbacks Register/UnRegister functions ***********************************/ |
| 1416 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
1510 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
| 1417 | HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID, |
1511 | HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID, |
| 1418 | pUART_CallbackTypeDef pCallback); |
1512 | pUART_CallbackTypeDef pCallback); |
| 1419 | HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID); |
1513 | HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID); |
| - | 1514 | ||
| - | 1515 | HAL_StatusTypeDef HAL_UART_RegisterRxEventCallback(UART_HandleTypeDef *huart, pUART_RxEventCallbackTypeDef pCallback); |
|
| - | 1516 | HAL_StatusTypeDef HAL_UART_UnRegisterRxEventCallback(UART_HandleTypeDef *huart); |
|
| 1420 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
1517 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
| 1421 | 1518 | ||
| 1422 | /** |
1519 | /** |
| 1423 | * @} |
1520 | * @} |
| 1424 | */ |
1521 | */ |
| Line 1453... | Line 1550... | ||
| 1453 | void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart); |
1550 | void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart); |
| 1454 | void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart); |
1551 | void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart); |
| 1455 | void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart); |
1552 | void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart); |
| 1456 | void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart); |
1553 | void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart); |
| 1457 | 1554 | ||
| - | 1555 | void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size); |
|
| - | 1556 | ||
| 1458 | /** |
1557 | /** |
| 1459 | * @} |
1558 | * @} |
| 1460 | */ |
1559 | */ |
| 1461 | 1560 | ||
| 1462 | /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions |
1561 | /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions |
| Line 1500... | Line 1599... | ||
| 1500 | /* Private functions -----------------------------------------------------------*/ |
1599 | /* Private functions -----------------------------------------------------------*/ |
| 1501 | /** @addtogroup UART_Private_Functions UART Private Functions |
1600 | /** @addtogroup UART_Private_Functions UART Private Functions |
| 1502 | * @{ |
1601 | * @{ |
| 1503 | */ |
1602 | */ |
| 1504 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
1603 | #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) |
| 1505 | void UART_InitCallbacksToDefault(UART_HandleTypeDef *huart); |
1604 | void UART_InitCallbacksToDefault(UART_HandleTypeDef *huart); |
| 1506 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
1605 | #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ |
| 1507 | HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart); |
1606 | HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart); |
| 1508 | HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart); |
1607 | HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart); |
| 1509 | HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, |
1608 | HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, |
| 1510 | uint32_t Tickstart, uint32_t Timeout); |
1609 | uint32_t Tickstart, uint32_t Timeout); |
| 1511 | void UART_AdvFeatureConfig(UART_HandleTypeDef *huart); |
1610 | void UART_AdvFeatureConfig(UART_HandleTypeDef *huart); |
| - | 1611 | HAL_StatusTypeDef UART_Start_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size); |
|
| - | 1612 | HAL_StatusTypeDef UART_Start_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size); |
|
| 1512 | 1613 | ||
| 1513 | /** |
1614 | /** |
| 1514 | * @} |
1615 | * @} |
| 1515 | */ |
1616 | */ |
| 1516 | 1617 | ||
| - | 1618 | /* Private variables -----------------------------------------------------------*/ |
|
| 1517 | /** |
1619 | /** |
| 1518 | * @} |
1620 | * @} |
| 1519 | */ |
1621 | */ |
| 1520 | 1622 | ||
| 1521 | /** |
1623 | /** |