stm32f7xx_hal_uart_ex.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_HAL_UART_EX_H
22 #define STM32F7xx_HAL_UART_EX_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
44 #if defined(USART_CR1_UESM)
45 
48 typedef struct
49 {
50  uint32_t WakeUpEvent;
55  uint16_t AddressLength;
58  uint8_t Address;
60 
61 #endif /* USART_CR1_UESM */
62 
66 /* Exported constants --------------------------------------------------------*/
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
94 /* Exported macros -----------------------------------------------------------*/
95 /* Exported functions --------------------------------------------------------*/
104 /* Initialization and de-initialization functions ****************************/
105 HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime,
106  uint32_t DeassertionTime);
107 
116 #if defined(USART_CR1_UESM)
118 
119 #endif /* USART_CR1_UESM */
120 
129 /* Peripheral Control functions **********************************************/
130 #if defined(USART_CR1_UESM)
134 
135 #endif/* USART_CR1_UESM */
136 #if defined(USART_CR3_UCESM)
137 HAL_StatusTypeDef HAL_UARTEx_EnableClockStopMode(UART_HandleTypeDef *huart);
138 HAL_StatusTypeDef HAL_UARTEx_DisableClockStopMode(UART_HandleTypeDef *huart);
139 
140 #endif /* USART_CR3_UCESM */
142 
143 
152 /* Private macros ------------------------------------------------------------*/
162 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
163  do { \
164  if((__HANDLE__)->Instance == USART1) \
165  { \
166  switch(__HAL_RCC_GET_USART1_SOURCE()) \
167  { \
168  case RCC_USART1CLKSOURCE_PCLK2: \
169  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK2; \
170  break; \
171  case RCC_USART1CLKSOURCE_HSI: \
172  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
173  break; \
174  case RCC_USART1CLKSOURCE_SYSCLK: \
175  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
176  break; \
177  case RCC_USART1CLKSOURCE_LSE: \
178  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
179  break; \
180  default: \
181  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
182  break; \
183  } \
184  } \
185  else if((__HANDLE__)->Instance == USART2) \
186  { \
187  switch(__HAL_RCC_GET_USART2_SOURCE()) \
188  { \
189  case RCC_USART2CLKSOURCE_PCLK1: \
190  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
191  break; \
192  case RCC_USART2CLKSOURCE_HSI: \
193  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
194  break; \
195  case RCC_USART2CLKSOURCE_SYSCLK: \
196  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
197  break; \
198  case RCC_USART2CLKSOURCE_LSE: \
199  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
200  break; \
201  default: \
202  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
203  break; \
204  } \
205  } \
206  else if((__HANDLE__)->Instance == USART3) \
207  { \
208  switch(__HAL_RCC_GET_USART3_SOURCE()) \
209  { \
210  case RCC_USART3CLKSOURCE_PCLK1: \
211  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
212  break; \
213  case RCC_USART3CLKSOURCE_HSI: \
214  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
215  break; \
216  case RCC_USART3CLKSOURCE_SYSCLK: \
217  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
218  break; \
219  case RCC_USART3CLKSOURCE_LSE: \
220  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
221  break; \
222  default: \
223  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
224  break; \
225  } \
226  } \
227  else if((__HANDLE__)->Instance == UART4) \
228  { \
229  switch(__HAL_RCC_GET_UART4_SOURCE()) \
230  { \
231  case RCC_UART4CLKSOURCE_PCLK1: \
232  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
233  break; \
234  case RCC_UART4CLKSOURCE_HSI: \
235  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
236  break; \
237  case RCC_UART4CLKSOURCE_SYSCLK: \
238  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
239  break; \
240  case RCC_UART4CLKSOURCE_LSE: \
241  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
242  break; \
243  default: \
244  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
245  break; \
246  } \
247  } \
248  else if ((__HANDLE__)->Instance == UART5) \
249  { \
250  switch(__HAL_RCC_GET_UART5_SOURCE()) \
251  { \
252  case RCC_UART5CLKSOURCE_PCLK1: \
253  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
254  break; \
255  case RCC_UART5CLKSOURCE_HSI: \
256  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
257  break; \
258  case RCC_UART5CLKSOURCE_SYSCLK: \
259  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
260  break; \
261  case RCC_UART5CLKSOURCE_LSE: \
262  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
263  break; \
264  default: \
265  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
266  break; \
267  } \
268  } \
269  else if((__HANDLE__)->Instance == USART6) \
270  { \
271  switch(__HAL_RCC_GET_USART6_SOURCE()) \
272  { \
273  case RCC_USART6CLKSOURCE_PCLK2: \
274  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK2; \
275  break; \
276  case RCC_USART6CLKSOURCE_HSI: \
277  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
278  break; \
279  case RCC_USART6CLKSOURCE_SYSCLK: \
280  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
281  break; \
282  case RCC_USART6CLKSOURCE_LSE: \
283  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
284  break; \
285  default: \
286  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
287  break; \
288  } \
289  } \
290  else if ((__HANDLE__)->Instance == UART7) \
291  { \
292  switch(__HAL_RCC_GET_UART7_SOURCE()) \
293  { \
294  case RCC_UART7CLKSOURCE_PCLK1: \
295  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
296  break; \
297  case RCC_UART7CLKSOURCE_HSI: \
298  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
299  break; \
300  case RCC_UART7CLKSOURCE_SYSCLK: \
301  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
302  break; \
303  case RCC_UART7CLKSOURCE_LSE: \
304  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
305  break; \
306  default: \
307  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
308  break; \
309  } \
310  } \
311  else if ((__HANDLE__)->Instance == UART8) \
312  { \
313  switch(__HAL_RCC_GET_UART8_SOURCE()) \
314  { \
315  case RCC_UART8CLKSOURCE_PCLK1: \
316  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
317  break; \
318  case RCC_UART8CLKSOURCE_HSI: \
319  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
320  break; \
321  case RCC_UART8CLKSOURCE_SYSCLK: \
322  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
323  break; \
324  case RCC_UART8CLKSOURCE_LSE: \
325  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
326  break; \
327  default: \
328  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
329  break; \
330  } \
331  } \
332  else \
333  { \
334  (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
335  } \
336  } while(0U)
337 
347 #define UART_MASK_COMPUTATION(__HANDLE__) \
348  do { \
349  if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \
350  { \
351  if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
352  { \
353  (__HANDLE__)->Mask = 0x01FFU ; \
354  } \
355  else \
356  { \
357  (__HANDLE__)->Mask = 0x00FFU ; \
358  } \
359  } \
360  else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \
361  { \
362  if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
363  { \
364  (__HANDLE__)->Mask = 0x00FFU ; \
365  } \
366  else \
367  { \
368  (__HANDLE__)->Mask = 0x007FU ; \
369  } \
370  } \
371  else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \
372  { \
373  if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
374  { \
375  (__HANDLE__)->Mask = 0x007FU ; \
376  } \
377  else \
378  { \
379  (__HANDLE__)->Mask = 0x003FU ; \
380  } \
381  } \
382  else \
383  { \
384  (__HANDLE__)->Mask = 0x0000U; \
385  } \
386  } while(0U)
387 
393 #define IS_UART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == UART_WORDLENGTH_7B) || \
394  ((__LENGTH__) == UART_WORDLENGTH_8B) || \
395  ((__LENGTH__) == UART_WORDLENGTH_9B))
396 
402 #define IS_UART_ADDRESSLENGTH_DETECT(__ADDRESS__) (((__ADDRESS__) == UART_ADDRESS_DETECT_4B) || \
403  ((__ADDRESS__) == UART_ADDRESS_DETECT_7B))
404 
409 /* Private functions ---------------------------------------------------------*/
410 
419 #ifdef __cplusplus
420 }
421 #endif
422 
423 #endif /* STM32F7xx_HAL_UART_EX_H */
424 
425 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_MultiProcessorEx_AddressLength_Set
HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength)
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
HAL_UARTEx_StopModeWakeUpSourceConfig
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
huart
UART_HandleTypeDef huart
Definition: pv_stm32f469.c:31
HAL_UARTEx_DisableStopMode
HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart)
__UART_HandleTypeDef
UART handle Structure definition.
Definition: stm32f4xx_hal_uart.h:141
HAL_UARTEx_EnableStopMode
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart)
UART_WakeUpTypeDef
UART wake up from stop mode parameters.
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h:47
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_RS485Ex_Init
HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime, uint32_t DeassertionTime)
HAL_UARTEx_WakeupCallback
void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53