Go to the documentation of this file.
21 #ifndef STM32F7xx_HAL_UART_EX_H
22 #define STM32F7xx_HAL_UART_EX_H
44 #if defined(USART_CR1_UESM)
55 uint16_t AddressLength;
74 #define UART_WORDLENGTH_7B USART_CR1_M1
75 #define UART_WORDLENGTH_8B 0x00000000U
76 #define UART_WORDLENGTH_9B USART_CR1_M0
84 #define UART_ADDRESS_DETECT_4B 0x00000000U
85 #define UART_ADDRESS_DETECT_7B USART_CR2_ADDM7
106 uint32_t DeassertionTime);
116 #if defined(USART_CR1_UESM)
130 #if defined(USART_CR1_UESM)
136 #if defined(USART_CR3_UCESM)
162 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
164 if((__HANDLE__)->Instance == USART1) \
166 switch(__HAL_RCC_GET_USART1_SOURCE()) \
168 case RCC_USART1CLKSOURCE_PCLK2: \
169 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK2; \
171 case RCC_USART1CLKSOURCE_HSI: \
172 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
174 case RCC_USART1CLKSOURCE_SYSCLK: \
175 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
177 case RCC_USART1CLKSOURCE_LSE: \
178 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
181 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
185 else if((__HANDLE__)->Instance == USART2) \
187 switch(__HAL_RCC_GET_USART2_SOURCE()) \
189 case RCC_USART2CLKSOURCE_PCLK1: \
190 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
192 case RCC_USART2CLKSOURCE_HSI: \
193 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
195 case RCC_USART2CLKSOURCE_SYSCLK: \
196 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
198 case RCC_USART2CLKSOURCE_LSE: \
199 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
202 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
206 else if((__HANDLE__)->Instance == USART3) \
208 switch(__HAL_RCC_GET_USART3_SOURCE()) \
210 case RCC_USART3CLKSOURCE_PCLK1: \
211 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
213 case RCC_USART3CLKSOURCE_HSI: \
214 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
216 case RCC_USART3CLKSOURCE_SYSCLK: \
217 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
219 case RCC_USART3CLKSOURCE_LSE: \
220 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
223 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
227 else if((__HANDLE__)->Instance == UART4) \
229 switch(__HAL_RCC_GET_UART4_SOURCE()) \
231 case RCC_UART4CLKSOURCE_PCLK1: \
232 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
234 case RCC_UART4CLKSOURCE_HSI: \
235 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
237 case RCC_UART4CLKSOURCE_SYSCLK: \
238 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
240 case RCC_UART4CLKSOURCE_LSE: \
241 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
244 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
248 else if ((__HANDLE__)->Instance == UART5) \
250 switch(__HAL_RCC_GET_UART5_SOURCE()) \
252 case RCC_UART5CLKSOURCE_PCLK1: \
253 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
255 case RCC_UART5CLKSOURCE_HSI: \
256 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
258 case RCC_UART5CLKSOURCE_SYSCLK: \
259 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
261 case RCC_UART5CLKSOURCE_LSE: \
262 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
265 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
269 else if((__HANDLE__)->Instance == USART6) \
271 switch(__HAL_RCC_GET_USART6_SOURCE()) \
273 case RCC_USART6CLKSOURCE_PCLK2: \
274 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK2; \
276 case RCC_USART6CLKSOURCE_HSI: \
277 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
279 case RCC_USART6CLKSOURCE_SYSCLK: \
280 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
282 case RCC_USART6CLKSOURCE_LSE: \
283 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
286 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
290 else if ((__HANDLE__)->Instance == UART7) \
292 switch(__HAL_RCC_GET_UART7_SOURCE()) \
294 case RCC_UART7CLKSOURCE_PCLK1: \
295 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
297 case RCC_UART7CLKSOURCE_HSI: \
298 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
300 case RCC_UART7CLKSOURCE_SYSCLK: \
301 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
303 case RCC_UART7CLKSOURCE_LSE: \
304 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
307 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
311 else if ((__HANDLE__)->Instance == UART8) \
313 switch(__HAL_RCC_GET_UART8_SOURCE()) \
315 case RCC_UART8CLKSOURCE_PCLK1: \
316 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
318 case RCC_UART8CLKSOURCE_HSI: \
319 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
321 case RCC_UART8CLKSOURCE_SYSCLK: \
322 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
324 case RCC_UART8CLKSOURCE_LSE: \
325 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
328 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
334 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
347 #define UART_MASK_COMPUTATION(__HANDLE__) \
349 if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \
351 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
353 (__HANDLE__)->Mask = 0x01FFU ; \
357 (__HANDLE__)->Mask = 0x00FFU ; \
360 else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \
362 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
364 (__HANDLE__)->Mask = 0x00FFU ; \
368 (__HANDLE__)->Mask = 0x007FU ; \
371 else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \
373 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
375 (__HANDLE__)->Mask = 0x007FU ; \
379 (__HANDLE__)->Mask = 0x003FU ; \
384 (__HANDLE__)->Mask = 0x0000U; \
393 #define IS_UART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == UART_WORDLENGTH_7B) || \
394 ((__LENGTH__) == UART_WORDLENGTH_8B) || \
395 ((__LENGTH__) == UART_WORDLENGTH_9B))
402 #define IS_UART_ADDRESSLENGTH_DETECT(__ADDRESS__) (((__ADDRESS__) == UART_ADDRESS_DETECT_4B) || \
403 ((__ADDRESS__) == UART_ADDRESS_DETECT_7B))
HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength)
HAL_StatusTypeDef
HAL Status structures definition
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart)
UART handle Structure definition.
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart)
UART wake up from stop mode parameters.
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime, uint32_t DeassertionTime)
void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart)