stm32f7xx_hal_irda_ex.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_HAL_IRDA_EX_H
22 #define STM32F7xx_HAL_IRDA_EX_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
30 
40 /* Exported types ------------------------------------------------------------*/
41 /* Exported constants --------------------------------------------------------*/
49 #define IRDA_WORDLENGTH_7B USART_CR1_M1
50 #define IRDA_WORDLENGTH_8B 0x00000000U
51 #define IRDA_WORDLENGTH_9B USART_CR1_M0
60 /* Exported macros -----------------------------------------------------------*/
61 
62 /* Private macros ------------------------------------------------------------*/
63 
73 #define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
74  do { \
75  if((__HANDLE__)->Instance == USART1) \
76  { \
77  switch(__HAL_RCC_GET_USART1_SOURCE()) \
78  { \
79  case RCC_USART1CLKSOURCE_PCLK2: \
80  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK2; \
81  break; \
82  case RCC_USART1CLKSOURCE_HSI: \
83  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
84  break; \
85  case RCC_USART1CLKSOURCE_SYSCLK: \
86  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
87  break; \
88  case RCC_USART1CLKSOURCE_LSE: \
89  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
90  break; \
91  default: \
92  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
93  break; \
94  } \
95  } \
96  else if((__HANDLE__)->Instance == USART2) \
97  { \
98  switch(__HAL_RCC_GET_USART2_SOURCE()) \
99  { \
100  case RCC_USART2CLKSOURCE_PCLK1: \
101  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
102  break; \
103  case RCC_USART2CLKSOURCE_HSI: \
104  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
105  break; \
106  case RCC_USART2CLKSOURCE_SYSCLK: \
107  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
108  break; \
109  case RCC_USART2CLKSOURCE_LSE: \
110  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
111  break; \
112  default: \
113  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
114  break; \
115  } \
116  } \
117  else if((__HANDLE__)->Instance == USART3) \
118  { \
119  switch(__HAL_RCC_GET_USART3_SOURCE()) \
120  { \
121  case RCC_USART3CLKSOURCE_PCLK1: \
122  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
123  break; \
124  case RCC_USART3CLKSOURCE_HSI: \
125  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
126  break; \
127  case RCC_USART3CLKSOURCE_SYSCLK: \
128  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
129  break; \
130  case RCC_USART3CLKSOURCE_LSE: \
131  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
132  break; \
133  default: \
134  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
135  break; \
136  } \
137  } \
138  else if((__HANDLE__)->Instance == UART4) \
139  { \
140  switch(__HAL_RCC_GET_UART4_SOURCE()) \
141  { \
142  case RCC_UART4CLKSOURCE_PCLK1: \
143  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
144  break; \
145  case RCC_UART4CLKSOURCE_HSI: \
146  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
147  break; \
148  case RCC_UART4CLKSOURCE_SYSCLK: \
149  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
150  break; \
151  case RCC_UART4CLKSOURCE_LSE: \
152  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
153  break; \
154  default: \
155  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
156  break; \
157  } \
158  } \
159  else if ((__HANDLE__)->Instance == UART5) \
160  { \
161  switch(__HAL_RCC_GET_UART5_SOURCE()) \
162  { \
163  case RCC_UART5CLKSOURCE_PCLK1: \
164  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
165  break; \
166  case RCC_UART5CLKSOURCE_HSI: \
167  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
168  break; \
169  case RCC_UART5CLKSOURCE_SYSCLK: \
170  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
171  break; \
172  case RCC_UART5CLKSOURCE_LSE: \
173  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
174  break; \
175  default: \
176  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
177  break; \
178  } \
179  } \
180  else if((__HANDLE__)->Instance == USART6) \
181  { \
182  switch(__HAL_RCC_GET_USART6_SOURCE()) \
183  { \
184  case RCC_USART6CLKSOURCE_PCLK2: \
185  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK2; \
186  break; \
187  case RCC_USART6CLKSOURCE_HSI: \
188  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
189  break; \
190  case RCC_USART6CLKSOURCE_SYSCLK: \
191  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
192  break; \
193  case RCC_USART6CLKSOURCE_LSE: \
194  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
195  break; \
196  default: \
197  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
198  break; \
199  } \
200  } \
201  else if ((__HANDLE__)->Instance == UART7) \
202  { \
203  switch(__HAL_RCC_GET_UART7_SOURCE()) \
204  { \
205  case RCC_UART7CLKSOURCE_PCLK1: \
206  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
207  break; \
208  case RCC_UART7CLKSOURCE_HSI: \
209  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
210  break; \
211  case RCC_UART7CLKSOURCE_SYSCLK: \
212  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
213  break; \
214  case RCC_UART7CLKSOURCE_LSE: \
215  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
216  break; \
217  default: \
218  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
219  break; \
220  } \
221  } \
222  else if ((__HANDLE__)->Instance == UART8) \
223  { \
224  switch(__HAL_RCC_GET_UART8_SOURCE()) \
225  { \
226  case RCC_UART8CLKSOURCE_PCLK1: \
227  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
228  break; \
229  case RCC_UART8CLKSOURCE_HSI: \
230  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
231  break; \
232  case RCC_UART8CLKSOURCE_SYSCLK: \
233  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
234  break; \
235  case RCC_UART8CLKSOURCE_LSE: \
236  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
237  break; \
238  default: \
239  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
240  break; \
241  } \
242  } \
243  else \
244  { \
245  (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
246  } \
247  } while(0U)
248 
254 #define IRDA_MASK_COMPUTATION(__HANDLE__) \
255  do { \
256  if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
257  { \
258  if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
259  { \
260  (__HANDLE__)->Mask = 0x01FFU ; \
261  } \
262  else \
263  { \
264  (__HANDLE__)->Mask = 0x00FFU ; \
265  } \
266  } \
267  else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
268  { \
269  if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
270  { \
271  (__HANDLE__)->Mask = 0x00FFU ; \
272  } \
273  else \
274  { \
275  (__HANDLE__)->Mask = 0x007FU ; \
276  } \
277  } \
278  else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \
279  { \
280  if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
281  { \
282  (__HANDLE__)->Mask = 0x007FU ; \
283  } \
284  else \
285  { \
286  (__HANDLE__)->Mask = 0x003FU ; \
287  } \
288  } \
289  else \
290  { \
291  (__HANDLE__)->Mask = 0x0000U; \
292  } \
293  } while(0U)
294 
299 #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \
300  ((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
301  ((__LENGTH__) == IRDA_WORDLENGTH_9B))
302 
306 /* Exported functions --------------------------------------------------------*/
307 
316 #ifdef __cplusplus
317 }
318 #endif
319 
320 #endif /* STM32F7xx_HAL_IRDA_EX_H */
321 
322 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.


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