1 /**
2   ******************************************************************************
3   * @file    stm32wbxx_hal_irda.h
4   * @author  MCD Application Team
5   * @brief   Header file of IRDA HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2019 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32WBxx_HAL_IRDA_H
21 #define STM32WBxx_HAL_IRDA_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32wbxx_hal_def.h"
29 
30 /** @addtogroup STM32WBxx_HAL_Driver
31   * @{
32   */
33 
34 /** @addtogroup IRDA
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 /** @defgroup IRDA_Exported_Types IRDA Exported Types
40   * @{
41   */
42 
43 /**
44   * @brief IRDA Init Structure definition
45   */
46 typedef struct
47 {
48   uint32_t BaudRate;                  /*!< This member configures the IRDA communication baud rate.
49                                            The baud rate register is computed using the following formula:
50                                               Baud Rate Register = ((usart_ker_ckpres) / ((hirda->Init.BaudRate)))
51                                            where usart_ker_ckpres is the IRDA input clock divided by a prescaler */
52 
53   uint32_t WordLength;                /*!< Specifies the number of data bits transmitted or received in a frame.
54                                            This parameter can be a value of @ref IRDA_Word_Length */
55 
56   uint32_t Parity;                    /*!< Specifies the parity mode.
57                                            This parameter can be a value of @ref IRDA_Parity
58                                            @note When parity is enabled, the computed parity is inserted
59                                                  at the MSB position of the transmitted data (9th bit when
60                                                  the word length is set to 9 data bits; 8th bit when the
61                                                  word length is set to 8 data bits). */
62 
63   uint32_t Mode;                      /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
64                                            This parameter can be a value of @ref IRDA_Transfer_Mode */
65 
66   uint8_t  Prescaler;                 /*!< Specifies the Prescaler value for dividing the UART/USART source clock
67                                            to achieve low-power frequency.
68                                            @note Prescaler value 0 is forbidden */
69 
70   uint16_t PowerMode;                 /*!< Specifies the IRDA power mode.
71                                            This parameter can be a value of @ref IRDA_Low_Power */
72 
73   uint32_t ClockPrescaler;            /*!< Specifies the prescaler value used to divide the IRDA clock source.
74                                            This parameter can be a value of @ref IRDA_ClockPrescaler. */
75 
76 } IRDA_InitTypeDef;
77 
78 /**
79   * @brief HAL IRDA State definition
80   * @note  HAL IRDA State value is a combination of 2 different substates:
81   *        gState and RxState (see @ref IRDA_State_Definition).
82   *        - gState contains IRDA state information related to global Handle management
83   *          and also information related to Tx operations.
84   *          gState value coding follow below described bitmap :
85   *          b7-b6  Error information
86   *             00 : No Error
87   *             01 : (Not Used)
88   *             10 : Timeout
89   *             11 : Error
90   *          b5     Peripheral initialization status
91   *             0  : Reset (Peripheral not initialized)
92   *             1  : Init done (Peripheral initialized. HAL IRDA Init function already called)
93   *          b4-b3  (not used)
94   *             xx : Should be set to 00
95   *          b2     Intrinsic process state
96   *             0  : Ready
97   *             1  : Busy (Peripheral busy with some configuration or internal operations)
98   *          b1     (not used)
99   *             x  : Should be set to 0
100   *          b0     Tx state
101   *             0  : Ready (no Tx operation ongoing)
102   *             1  : Busy (Tx operation ongoing)
103   *        - RxState contains information related to Rx operations.
104   *          RxState value coding follow below described bitmap :
105   *          b7-b6  (not used)
106   *             xx : Should be set to 00
107   *          b5     Peripheral initialization status
108   *             0  : Reset (Peripheral not initialized)
109   *             1  : Init done (Peripheral initialized)
110   *          b4-b2  (not used)
111   *            xxx : Should be set to 000
112   *          b1     Rx state
113   *             0  : Ready (no Rx operation ongoing)
114   *             1  : Busy (Rx operation ongoing)
115   *          b0     (not used)
116   *             x  : Should be set to 0.
117   */
118 typedef uint32_t HAL_IRDA_StateTypeDef;
119 
120 /**
121   * @brief IRDA clock sources definition
122   */
123 typedef enum
124 {
125   IRDA_CLOCKSOURCE_PCLK2      = 0x01U,    /*!< PCLK2 clock source         */
126   IRDA_CLOCKSOURCE_HSI        = 0x02U,    /*!< HSI clock source           */
127   IRDA_CLOCKSOURCE_SYSCLK     = 0x04U,    /*!< SYSCLK clock source        */
128   IRDA_CLOCKSOURCE_LSE        = 0x10U,    /*!< LSE clock source           */
129   IRDA_CLOCKSOURCE_UNDEFINED  = 0x20U     /*!< Undefined clock source     */
130 } IRDA_ClockSourceTypeDef;
131 
132 /**
133   * @brief  IRDA handle Structure definition
134   */
135 #if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
136 typedef struct __IRDA_HandleTypeDef
137 #else
138 typedef struct
139 #endif  /* USE_HAL_IRDA_REGISTER_CALLBACKS */
140 {
141   USART_TypeDef            *Instance;        /*!< USART registers base address       */
142 
143   IRDA_InitTypeDef         Init;             /*!< IRDA communication parameters      */
144 
145   const uint8_t            *pTxBuffPtr;      /*!< Pointer to IRDA Tx transfer Buffer */
146 
147   uint16_t                 TxXferSize;       /*!< IRDA Tx Transfer size              */
148 
149   __IO uint16_t            TxXferCount;      /*!< IRDA Tx Transfer Counter           */
150 
151   uint8_t                  *pRxBuffPtr;      /*!< Pointer to IRDA Rx transfer Buffer */
152 
153   uint16_t                 RxXferSize;       /*!< IRDA Rx Transfer size              */
154 
155   __IO uint16_t            RxXferCount;      /*!< IRDA Rx Transfer Counter           */
156 
157   uint16_t                 Mask;             /*!< USART RX RDR register mask         */
158 
159   DMA_HandleTypeDef        *hdmatx;          /*!< IRDA Tx DMA Handle parameters      */
160 
161   DMA_HandleTypeDef        *hdmarx;          /*!< IRDA Rx DMA Handle parameters      */
162 
163   HAL_LockTypeDef          Lock;             /*!< Locking object                     */
164 
165   __IO HAL_IRDA_StateTypeDef    gState;      /*!< IRDA state information related to global Handle management
166                                                   and also related to Tx operations.
167                                                   This parameter can be a value of @ref HAL_IRDA_StateTypeDef */
168 
169   __IO HAL_IRDA_StateTypeDef    RxState;     /*!< IRDA state information related to Rx operations.
170                                                   This parameter can be a value of @ref HAL_IRDA_StateTypeDef */
171 
172   uint32_t                 ErrorCode;        /*!< IRDA Error code                    */
173 
174 #if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
175   void (* TxHalfCpltCallback)(struct __IRDA_HandleTypeDef *hirda);        /*!< IRDA Tx Half Complete Callback        */
176 
177   void (* TxCpltCallback)(struct __IRDA_HandleTypeDef *hirda);            /*!< IRDA Tx Complete Callback             */
178 
179   void (* RxHalfCpltCallback)(struct __IRDA_HandleTypeDef *hirda);        /*!< IRDA Rx Half Complete Callback        */
180 
181   void (* RxCpltCallback)(struct __IRDA_HandleTypeDef *hirda);            /*!< IRDA Rx Complete Callback             */
182 
183   void (* ErrorCallback)(struct __IRDA_HandleTypeDef *hirda);             /*!< IRDA Error Callback                   */
184 
185   void (* AbortCpltCallback)(struct __IRDA_HandleTypeDef *hirda);         /*!< IRDA Abort Complete Callback          */
186 
187   void (* AbortTransmitCpltCallback)(struct __IRDA_HandleTypeDef *hirda); /*!< IRDA Abort Transmit Complete Callback */
188 
189   void (* AbortReceiveCpltCallback)(struct __IRDA_HandleTypeDef *hirda);  /*!< IRDA Abort Receive Complete Callback  */
190 
191 
192   void (* MspInitCallback)(struct __IRDA_HandleTypeDef *hirda);           /*!< IRDA Msp Init callback                */
193 
194   void (* MspDeInitCallback)(struct __IRDA_HandleTypeDef *hirda);         /*!< IRDA Msp DeInit callback              */
195 #endif  /* USE_HAL_IRDA_REGISTER_CALLBACKS */
196 
197 } IRDA_HandleTypeDef;
198 
199 #if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
200 /**
201   * @brief  HAL IRDA Callback ID enumeration definition
202   */
203 typedef enum
204 {
205   HAL_IRDA_TX_HALFCOMPLETE_CB_ID         = 0x00U,    /*!< IRDA Tx Half Complete Callback ID        */
206   HAL_IRDA_TX_COMPLETE_CB_ID             = 0x01U,    /*!< IRDA Tx Complete Callback ID             */
207   HAL_IRDA_RX_HALFCOMPLETE_CB_ID         = 0x02U,    /*!< IRDA Rx Half Complete Callback ID        */
208   HAL_IRDA_RX_COMPLETE_CB_ID             = 0x03U,    /*!< IRDA Rx Complete Callback ID             */
209   HAL_IRDA_ERROR_CB_ID                   = 0x04U,    /*!< IRDA Error Callback ID                   */
210   HAL_IRDA_ABORT_COMPLETE_CB_ID          = 0x05U,    /*!< IRDA Abort Complete Callback ID          */
211   HAL_IRDA_ABORT_TRANSMIT_COMPLETE_CB_ID = 0x06U,    /*!< IRDA Abort Transmit Complete Callback ID */
212   HAL_IRDA_ABORT_RECEIVE_COMPLETE_CB_ID  = 0x07U,    /*!< IRDA Abort Receive Complete Callback ID  */
213 
214   HAL_IRDA_MSPINIT_CB_ID                 = 0x08U,    /*!< IRDA MspInit callback ID                 */
215   HAL_IRDA_MSPDEINIT_CB_ID               = 0x09U     /*!< IRDA MspDeInit callback ID               */
216 
217 } HAL_IRDA_CallbackIDTypeDef;
218 
219 /**
220   * @brief  HAL IRDA Callback pointer definition
221   */
222 typedef  void (*pIRDA_CallbackTypeDef)(IRDA_HandleTypeDef *hirda);  /*!< pointer to an IRDA callback function */
223 
224 #endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
225 
226 /**
227   * @}
228   */
229 
230 /* Exported constants --------------------------------------------------------*/
231 /** @defgroup IRDA_Exported_Constants IRDA Exported Constants
232   * @{
233   */
234 
235 /** @defgroup IRDA_State_Definition IRDA State Code Definition
236   * @{
237   */
238 #define HAL_IRDA_STATE_RESET                0x00000000U   /*!< Peripheral is not initialized
239                                                                Value is allowed for gState and RxState */
240 #define HAL_IRDA_STATE_READY                0x00000020U   /*!< Peripheral Initialized and ready for use
241                                                                Value is allowed for gState and RxState */
242 #define HAL_IRDA_STATE_BUSY                 0x00000024U   /*!< An internal process is ongoing
243                                                                Value is allowed for gState only */
244 #define HAL_IRDA_STATE_BUSY_TX              0x00000021U   /*!< Data Transmission process is ongoing
245                                                                Value is allowed for gState only */
246 #define HAL_IRDA_STATE_BUSY_RX              0x00000022U   /*!< Data Reception process is ongoing
247                                                                Value is allowed for RxState only */
248 #define HAL_IRDA_STATE_BUSY_TX_RX           0x00000023U   /*!< Data Transmission and Reception process is ongoing
249                                                                Not to be used for neither gState nor RxState.
250                                                                Value is result of combination (Or) between gState and RxState values */
251 #define HAL_IRDA_STATE_TIMEOUT              0x000000A0U   /*!< Timeout state
252                                                                Value is allowed for gState only */
253 #define HAL_IRDA_STATE_ERROR                0x000000E0U   /*!< Error
254                                                                Value is allowed for gState only */
255 /**
256   * @}
257   */
258 
259 /** @defgroup IRDA_Error_Definition IRDA Error Code Definition
260   * @{
261   */
262 #define HAL_IRDA_ERROR_NONE                 ((uint32_t)0x00000000U)          /*!< No error                */
263 #define HAL_IRDA_ERROR_PE                   ((uint32_t)0x00000001U)          /*!< Parity error            */
264 #define HAL_IRDA_ERROR_NE                   ((uint32_t)0x00000002U)          /*!< Noise error             */
265 #define HAL_IRDA_ERROR_FE                   ((uint32_t)0x00000004U)          /*!< frame error             */
266 #define HAL_IRDA_ERROR_ORE                  ((uint32_t)0x00000008U)          /*!< Overrun error           */
267 #define HAL_IRDA_ERROR_DMA                  ((uint32_t)0x00000010U)          /*!< DMA transfer error      */
268 #define HAL_IRDA_ERROR_BUSY                 ((uint32_t)0x00000020U)          /*!< Busy Error              */
269 #if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
270 #define HAL_IRDA_ERROR_INVALID_CALLBACK     ((uint32_t)0x00000040U)          /*!< Invalid Callback error  */
271 #endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
272 /**
273   * @}
274   */
275 
276 /** @defgroup IRDA_Word_Length IRDA Word Length
277   * @{
278   */
279 #define IRDA_WORDLENGTH_7B                  USART_CR1_M1   /*!< 7-bit long frame */
280 #define IRDA_WORDLENGTH_8B                  0x00000000U    /*!< 8-bit long frame */
281 #define IRDA_WORDLENGTH_9B                  USART_CR1_M0   /*!< 9-bit long frame */
282 /**
283   * @}
284   */
285 
286 /** @defgroup IRDA_Parity IRDA Parity
287   * @{
288   */
289 #define IRDA_PARITY_NONE                    0x00000000U                      /*!< No parity   */
290 #define IRDA_PARITY_EVEN                    USART_CR1_PCE                    /*!< Even parity */
291 #define IRDA_PARITY_ODD                     (USART_CR1_PCE | USART_CR1_PS)   /*!< Odd parity  */
292 /**
293   * @}
294   */
295 
296 /** @defgroup IRDA_Transfer_Mode IRDA Transfer Mode
297   * @{
298   */
299 #define IRDA_MODE_RX                        USART_CR1_RE                   /*!< RX mode        */
300 #define IRDA_MODE_TX                        USART_CR1_TE                   /*!< TX mode        */
301 #define IRDA_MODE_TX_RX                     (USART_CR1_TE |USART_CR1_RE)   /*!< RX and TX mode */
302 /**
303   * @}
304   */
305 
306 /** @defgroup IRDA_Low_Power IRDA Low Power
307   * @{
308   */
309 #define IRDA_POWERMODE_NORMAL               0x00000000U       /*!< IRDA normal power mode */
310 #define IRDA_POWERMODE_LOWPOWER             USART_CR3_IRLP    /*!< IRDA low power mode    */
311 /**
312   * @}
313   */
314 
315 /** @defgroup IRDA_ClockPrescaler  Clock Prescaler
316   * @{
317   */
318 #define IRDA_PRESCALER_DIV1    0x00000000U  /*!< fclk_pres = fclk     */
319 #define IRDA_PRESCALER_DIV2    0x00000001U  /*!< fclk_pres = fclk/2   */
320 #define IRDA_PRESCALER_DIV4    0x00000002U  /*!< fclk_pres = fclk/4   */
321 #define IRDA_PRESCALER_DIV6    0x00000003U  /*!< fclk_pres = fclk/6   */
322 #define IRDA_PRESCALER_DIV8    0x00000004U  /*!< fclk_pres = fclk/8   */
323 #define IRDA_PRESCALER_DIV10   0x00000005U  /*!< fclk_pres = fclk/10  */
324 #define IRDA_PRESCALER_DIV12   0x00000006U  /*!< fclk_pres = fclk/12  */
325 #define IRDA_PRESCALER_DIV16   0x00000007U  /*!< fclk_pres = fclk/16  */
326 #define IRDA_PRESCALER_DIV32   0x00000008U  /*!< fclk_pres = fclk/32  */
327 #define IRDA_PRESCALER_DIV64   0x00000009U  /*!< fclk_pres = fclk/64  */
328 #define IRDA_PRESCALER_DIV128  0x0000000AU  /*!< fclk_pres = fclk/128 */
329 #define IRDA_PRESCALER_DIV256  0x0000000BU  /*!< fclk_pres = fclk/256 */
330 /**
331   * @}
332   */
333 
334 /** @defgroup IRDA_State IRDA State
335   * @{
336   */
337 #define IRDA_STATE_DISABLE                  0x00000000U     /*!< IRDA disabled  */
338 #define IRDA_STATE_ENABLE                   USART_CR1_UE    /*!< IRDA enabled   */
339 /**
340   * @}
341   */
342 
343 /** @defgroup IRDA_Mode  IRDA Mode
344   * @{
345   */
346 #define IRDA_MODE_DISABLE                   0x00000000U      /*!< Associated UART disabled in IRDA mode */
347 #define IRDA_MODE_ENABLE                    USART_CR3_IREN   /*!< Associated UART enabled in IRDA mode  */
348 /**
349   * @}
350   */
351 
352 /** @defgroup IRDA_One_Bit  IRDA One Bit Sampling
353   * @{
354   */
355 #define IRDA_ONE_BIT_SAMPLE_DISABLE         0x00000000U       /*!< One-bit sampling disabled */
356 #define IRDA_ONE_BIT_SAMPLE_ENABLE          USART_CR3_ONEBIT  /*!< One-bit sampling enabled  */
357 /**
358   * @}
359   */
360 
361 /** @defgroup IRDA_DMA_Tx IRDA DMA Tx
362   * @{
363   */
364 #define IRDA_DMA_TX_DISABLE                 0x00000000U       /*!< IRDA DMA TX disabled */
365 #define IRDA_DMA_TX_ENABLE                  USART_CR3_DMAT    /*!< IRDA DMA TX enabled  */
366 /**
367   * @}
368   */
369 
370 /** @defgroup IRDA_DMA_Rx  IRDA DMA Rx
371   * @{
372   */
373 #define IRDA_DMA_RX_DISABLE                 0x00000000U       /*!< IRDA DMA RX disabled */
374 #define IRDA_DMA_RX_ENABLE                  USART_CR3_DMAR    /*!< IRDA DMA RX enabled  */
375 /**
376   * @}
377   */
378 
379 /** @defgroup IRDA_Request_Parameters IRDA Request Parameters
380   * @{
381   */
382 #define IRDA_AUTOBAUD_REQUEST            USART_RQR_ABRRQ        /*!< Auto-Baud Rate Request      */
383 #define IRDA_RXDATA_FLUSH_REQUEST        USART_RQR_RXFRQ        /*!< Receive Data flush Request  */
384 #define IRDA_TXDATA_FLUSH_REQUEST        USART_RQR_TXFRQ        /*!< Transmit data flush Request */
385 /**
386   * @}
387   */
388 
389 /** @defgroup IRDA_Flags IRDA Flags
390   *        Elements values convention: 0xXXXX
391   *           - 0xXXXX  : Flag mask in the ISR register
392   * @{
393   */
394 #define IRDA_FLAG_REACK                     USART_ISR_REACK         /*!< IRDA receive enable acknowledge flag      */
395 #define IRDA_FLAG_TEACK                     USART_ISR_TEACK         /*!< IRDA transmit enable acknowledge flag     */
396 #define IRDA_FLAG_BUSY                      USART_ISR_BUSY          /*!< IRDA busy flag                            */
397 #define IRDA_FLAG_ABRF                      USART_ISR_ABRF          /*!< IRDA auto Baud rate flag                  */
398 #define IRDA_FLAG_ABRE                      USART_ISR_ABRE          /*!< IRDA auto Baud rate error                 */
399 #define IRDA_FLAG_TXE                       USART_ISR_TXE_TXFNF     /*!< IRDA transmit data register empty         */
400 #define IRDA_FLAG_TC                        USART_ISR_TC            /*!< IRDA transmission complete                */
401 #define IRDA_FLAG_RXNE                      USART_ISR_RXNE_RXFNE    /*!< IRDA read data register not empty         */
402 #define IRDA_FLAG_ORE                       USART_ISR_ORE           /*!< IRDA overrun error                        */
403 #define IRDA_FLAG_NE                        USART_ISR_NE            /*!< IRDA noise error                          */
404 #define IRDA_FLAG_FE                        USART_ISR_FE            /*!< IRDA frame error                          */
405 #define IRDA_FLAG_PE                        USART_ISR_PE            /*!< IRDA parity error                         */
406 /**
407   * @}
408   */
409 
410 /** @defgroup IRDA_Interrupt_definition IRDA Interrupts Definition
411   *        Elements values convention: 0000ZZZZ0XXYYYYYb
412   *           - YYYYY  : Interrupt source position in the XX register (5bits)
413   *           - XX  : Interrupt source register (2bits)
414   *                 - 01: CR1 register
415   *                 - 10: CR2 register
416   *                 - 11: CR3 register
417   *           - ZZZZ  : Flag position in the ISR register(4bits)
418   * @{
419   */
420 #define IRDA_IT_PE                          0x0028U     /*!< IRDA Parity error interruption                 */
421 #define IRDA_IT_TXE                         0x0727U     /*!< IRDA Transmit data register empty interruption */
422 #define IRDA_IT_TC                          0x0626U     /*!< IRDA Transmission complete interruption        */
423 #define IRDA_IT_RXNE                        0x0525U     /*!< IRDA Read data register not empty interruption */
424 #define IRDA_IT_IDLE                        0x0424U     /*!< IRDA Idle interruption                         */
425 
426 /*       Elements values convention: 000000000XXYYYYYb
427              - YYYYY  : Interrupt source position in the XX register (5bits)
428              - XX  : Interrupt source register (2bits)
429                    - 01: CR1 register
430                    - 10: CR2 register
431                    - 11: CR3 register */
432 #define IRDA_IT_ERR                         0x0060U       /*!< IRDA Error interruption        */
433 
434 /*       Elements values convention: 0000ZZZZ00000000b
435              - ZZZZ  : Flag position in the ISR register(4bits) */
436 #define IRDA_IT_ORE                         0x0300U      /*!< IRDA Overrun error interruption */
437 #define IRDA_IT_NE                          0x0200U      /*!< IRDA Noise error interruption   */
438 #define IRDA_IT_FE                          0x0100U      /*!< IRDA Frame error interruption   */
439 /**
440   * @}
441   */
442 
443 /** @defgroup IRDA_IT_CLEAR_Flags   IRDA Interruption Clear Flags
444   * @{
445   */
446 #define IRDA_CLEAR_PEF                       USART_ICR_PECF            /*!< Parity Error Clear Flag          */
447 #define IRDA_CLEAR_FEF                       USART_ICR_FECF            /*!< Framing Error Clear Flag         */
448 #define IRDA_CLEAR_NEF                       USART_ICR_NECF            /*!< Noise Error detected Clear Flag  */
449 #define IRDA_CLEAR_OREF                      USART_ICR_ORECF           /*!< OverRun Error Clear Flag         */
450 #define IRDA_CLEAR_IDLEF                     USART_ICR_IDLECF          /*!< IDLE line detected Clear Flag    */
451 #define IRDA_CLEAR_TCF                       USART_ICR_TCCF            /*!< Transmission Complete Clear Flag */
452 /**
453   * @}
454   */
455 
456 /** @defgroup IRDA_Interruption_Mask    IRDA interruptions flags mask
457   * @{
458   */
459 #define IRDA_IT_MASK  0x001FU  /*!< IRDA Interruptions flags mask  */
460 #define IRDA_CR_MASK  0x00E0U  /*!< IRDA control register mask     */
461 #define IRDA_CR_POS   5U       /*!< IRDA control register position */
462 #define IRDA_ISR_MASK 0x1F00U  /*!< IRDA ISR register mask         */
463 #define IRDA_ISR_POS  8U       /*!< IRDA ISR register position     */
464 /**
465   * @}
466   */
467 
468 /**
469  * @}
470  */
471 
472 
473 /* Exported macros -----------------------------------------------------------*/
474 /** @defgroup IRDA_Exported_Macros IRDA Exported Macros
475   * @{
476   */
477 
478 /** @brief  Reset IRDA handle state.
479   * @param  __HANDLE__ IRDA handle.
480   * @retval None
481   */
482 #if USE_HAL_IRDA_REGISTER_CALLBACKS == 1
483 #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__)  do{                                                   \
484                                                        (__HANDLE__)->gState = HAL_IRDA_STATE_RESET;      \
485                                                        (__HANDLE__)->RxState = HAL_IRDA_STATE_RESET;     \
486                                                        (__HANDLE__)->MspInitCallback = NULL;             \
487                                                        (__HANDLE__)->MspDeInitCallback = NULL;           \
488                                                      } while(0)
489 #else
490 #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__)  do{                                                   \
491                                                        (__HANDLE__)->gState = HAL_IRDA_STATE_RESET;      \
492                                                        (__HANDLE__)->RxState = HAL_IRDA_STATE_RESET;     \
493                                                      } while(0)
494 #endif /*USE_HAL_IRDA_REGISTER_CALLBACKS  */
495 
496 /** @brief  Flush the IRDA DR register.
497   * @param  __HANDLE__ specifies the IRDA Handle.
498   * @retval None
499   */
500 #define __HAL_IRDA_FLUSH_DRREGISTER(__HANDLE__)                            \
501     do{                                                                    \
502          SET_BIT((__HANDLE__)->Instance->RQR, IRDA_RXDATA_FLUSH_REQUEST); \
503          SET_BIT((__HANDLE__)->Instance->RQR, IRDA_TXDATA_FLUSH_REQUEST); \
504       } while(0)
505 
506 /** @brief  Clear the specified IRDA pending flag.
507   * @param  __HANDLE__ specifies the IRDA Handle.
508   * @param  __FLAG__ specifies the flag to check.
509   *          This parameter can be any combination of the following values:
510   *            @arg @ref IRDA_CLEAR_PEF
511   *            @arg @ref IRDA_CLEAR_FEF
512   *            @arg @ref IRDA_CLEAR_NEF
513   *            @arg @ref IRDA_CLEAR_OREF
514   *            @arg @ref IRDA_CLEAR_TCF
515   *            @arg @ref IRDA_CLEAR_IDLEF
516   * @retval None
517   */
518 #define __HAL_IRDA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
519 
520 /** @brief  Clear the IRDA PE pending flag.
521   * @param  __HANDLE__ specifies the IRDA Handle.
522   * @retval None
523   */
524 #define __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__)    __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_PEF)
525 
526 
527 /** @brief  Clear the IRDA FE pending flag.
528   * @param  __HANDLE__ specifies the IRDA Handle.
529   * @retval None
530   */
531 #define __HAL_IRDA_CLEAR_FEFLAG(__HANDLE__)    __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_FEF)
532 
533 /** @brief  Clear the IRDA NE pending flag.
534   * @param  __HANDLE__ specifies the IRDA Handle.
535   * @retval None
536   */
537 #define __HAL_IRDA_CLEAR_NEFLAG(__HANDLE__)    __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_NEF)
538 
539 /** @brief  Clear the IRDA ORE pending flag.
540   * @param  __HANDLE__ specifies the IRDA Handle.
541   * @retval None
542   */
543 #define __HAL_IRDA_CLEAR_OREFLAG(__HANDLE__)    __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_OREF)
544 
545 /** @brief  Clear the IRDA IDLE pending flag.
546   * @param  __HANDLE__ specifies the IRDA Handle.
547   * @retval None
548   */
549 #define __HAL_IRDA_CLEAR_IDLEFLAG(__HANDLE__)   __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_IDLEF)
550 
551 /** @brief  Check whether the specified IRDA flag is set or not.
552   * @param  __HANDLE__ specifies the IRDA Handle.
553   * @param  __FLAG__ specifies the flag to check.
554   *        This parameter can be one of the following values:
555   *            @arg @ref IRDA_FLAG_REACK Receive enable acknowledge flag
556   *            @arg @ref IRDA_FLAG_TEACK Transmit enable acknowledge flag
557   *            @arg @ref IRDA_FLAG_BUSY  Busy flag
558   *            @arg @ref IRDA_FLAG_ABRF  Auto Baud rate detection flag
559   *            @arg @ref IRDA_FLAG_ABRE  Auto Baud rate detection error flag
560   *            @arg @ref IRDA_FLAG_TXE   Transmit data register empty flag
561   *            @arg @ref IRDA_FLAG_TC    Transmission Complete flag
562   *            @arg @ref IRDA_FLAG_RXNE  Receive data register not empty flag
563   *            @arg @ref IRDA_FLAG_ORE   OverRun Error flag
564   *            @arg @ref IRDA_FLAG_NE    Noise Error flag
565   *            @arg @ref IRDA_FLAG_FE    Framing Error flag
566   *            @arg @ref IRDA_FLAG_PE    Parity Error flag
567   * @retval The new state of __FLAG__ (TRUE or FALSE).
568   */
569 #define __HAL_IRDA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
570 
571 
572 /** @brief  Enable the specified IRDA interrupt.
573   * @param  __HANDLE__ specifies the IRDA Handle.
574   * @param  __INTERRUPT__ specifies the IRDA interrupt source to enable.
575   *          This parameter can be one of the following values:
576   *            @arg @ref IRDA_IT_TXE  Transmit Data Register empty interrupt
577   *            @arg @ref IRDA_IT_TC   Transmission complete interrupt
578   *            @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
579   *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
580   *            @arg @ref IRDA_IT_PE   Parity Error interrupt
581   *            @arg @ref IRDA_IT_ERR  Error interrupt(Frame error, noise error, overrun error)
582   * @retval None
583   */
584 #define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__)   (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 1)? ((__HANDLE__)->Instance->CR1 |= ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
585                                                            ((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 2)? ((__HANDLE__)->Instance->CR2 |= ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
586                                                            ((__HANDLE__)->Instance->CR3 |= ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))))
587 
588 /** @brief  Disable the specified IRDA interrupt.
589   * @param  __HANDLE__ specifies the IRDA Handle.
590   * @param  __INTERRUPT__ specifies the IRDA interrupt source to disable.
591   *          This parameter can be one of the following values:
592   *            @arg @ref IRDA_IT_TXE  Transmit Data Register empty interrupt
593   *            @arg @ref IRDA_IT_TC   Transmission complete interrupt
594   *            @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
595   *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
596   *            @arg @ref IRDA_IT_PE   Parity Error interrupt
597   *            @arg @ref IRDA_IT_ERR  Error interrupt(Frame error, noise error, overrun error)
598   * @retval None
599   */
600 #define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__)  (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
601                                                            ((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
602                                                            ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))))
603 
604 
605 /** @brief  Check whether the specified IRDA interrupt has occurred or not.
606   * @param  __HANDLE__ specifies the IRDA Handle.
607   * @param  __INTERRUPT__ specifies the IRDA interrupt source to check.
608   *          This parameter can be one of the following values:
609   *            @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt
610   *            @arg @ref IRDA_IT_TC  Transmission complete interrupt
611   *            @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
612   *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
613   *            @arg @ref IRDA_IT_ORE OverRun Error interrupt
614   *            @arg @ref IRDA_IT_NE Noise Error interrupt
615   *            @arg @ref IRDA_IT_FE Framing Error interrupt
616   *            @arg @ref IRDA_IT_PE Parity Error interrupt
617   * @retval The new state of __IT__ (SET or RESET).
618   */
619 #define __HAL_IRDA_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR & (0x01U << (((__INTERRUPT__) & IRDA_ISR_MASK)>> IRDA_ISR_POS))) != 0U) ? SET : RESET)
620 
621 /** @brief  Check whether the specified IRDA interrupt source is enabled or not.
622   * @param  __HANDLE__ specifies the IRDA Handle.
623   * @param  __INTERRUPT__ specifies the IRDA interrupt source to check.
624   *          This parameter can be one of the following values:
625   *            @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt
626   *            @arg @ref IRDA_IT_TC  Transmission complete interrupt
627   *            @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
628   *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
629   *            @arg @ref IRDA_IT_ERR Framing, overrun or noise error interrupt
630   *            @arg @ref IRDA_IT_PE Parity Error interrupt
631   * @retval The new state of __IT__ (SET or RESET).
632   */
633 #define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 0x01U)? (__HANDLE__)->Instance->CR1 : \
634                                                                (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 0x02U)? (__HANDLE__)->Instance->CR2 : \
635                                                                (__HANDLE__)->Instance->CR3)) & ((uint32_t)0x01U << (((uint16_t)(__INTERRUPT__)) & IRDA_IT_MASK))) != 0U) ? SET : RESET)
636 
637 /** @brief  Clear the specified IRDA ISR flag, in setting the proper ICR register flag.
638   * @param  __HANDLE__ specifies the IRDA Handle.
639   * @param  __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
640   *                       to clear the corresponding interrupt
641   *          This parameter can be one of the following values:
642   *            @arg @ref IRDA_CLEAR_PEF Parity Error Clear Flag
643   *            @arg @ref IRDA_CLEAR_FEF Framing Error Clear Flag
644   *            @arg @ref IRDA_CLEAR_NEF Noise detected Clear Flag
645   *            @arg @ref IRDA_CLEAR_OREF OverRun Error Clear Flag
646   *            @arg @ref IRDA_CLEAR_TCF Transmission Complete Clear Flag
647   * @retval None
648   */
649 #define __HAL_IRDA_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
650 
651 
652 /** @brief  Set a specific IRDA request flag.
653   * @param  __HANDLE__ specifies the IRDA Handle.
654   * @param  __REQ__ specifies the request flag to set
655   *          This parameter can be one of the following values:
656   *            @arg @ref IRDA_AUTOBAUD_REQUEST Auto-Baud Rate Request
657   *            @arg @ref IRDA_RXDATA_FLUSH_REQUEST Receive Data flush Request
658   *            @arg @ref IRDA_TXDATA_FLUSH_REQUEST Transmit data flush Request
659   *
660   * @retval None
661   */
662 #define __HAL_IRDA_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
663 
664 /** @brief  Enable the IRDA one bit sample method.
665   * @param  __HANDLE__ specifies the IRDA Handle.
666   * @retval None
667   */
668 #define __HAL_IRDA_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
669 
670 /** @brief  Disable the IRDA one bit sample method.
671   * @param  __HANDLE__ specifies the IRDA Handle.
672   * @retval None
673   */
674 #define __HAL_IRDA_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT))
675 
676 /** @brief  Enable UART/USART associated to IRDA Handle.
677   * @param  __HANDLE__ specifies the IRDA Handle.
678   * @retval None
679   */
680 #define __HAL_IRDA_ENABLE(__HANDLE__)                   ((__HANDLE__)->Instance->CR1 |=  USART_CR1_UE)
681 
682 /** @brief  Disable UART/USART associated to IRDA Handle.
683   * @param  __HANDLE__ specifies the IRDA Handle.
684   * @retval None
685   */
686 #define __HAL_IRDA_DISABLE(__HANDLE__)                  ((__HANDLE__)->Instance->CR1 &=  ~USART_CR1_UE)
687 
688 /**
689   * @}
690   */
691 
692 /* Private macros --------------------------------------------------------*/
693 /** @addtogroup IRDA_Private_Macros
694   * @{
695   */
696 
697 /** @brief  Compute the mask to apply to retrieve the received data
698   *         according to the word length and to the parity bits activation.
699   * @param  __HANDLE__ specifies the IRDA Handle.
700   * @retval None, the mask to apply to the associated UART RDR register is stored in (__HANDLE__)->Mask field.
701   */
702 #define IRDA_MASK_COMPUTATION(__HANDLE__)                             \
703   do {                                                                \
704   if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B)            \
705   {                                                                   \
706      if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE)               \
707      {                                                                \
708         (__HANDLE__)->Mask = 0x01FF ;                                 \
709      }                                                                \
710      else                                                             \
711      {                                                                \
712         (__HANDLE__)->Mask = 0x00FF ;                                 \
713      }                                                                \
714   }                                                                   \
715   else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B)       \
716   {                                                                   \
717      if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE)               \
718      {                                                                \
719         (__HANDLE__)->Mask = 0x00FF ;                                 \
720      }                                                                \
721      else                                                             \
722      {                                                                \
723         (__HANDLE__)->Mask = 0x007F ;                                 \
724      }                                                                \
725   }                                                                   \
726   else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B)       \
727   {                                                                   \
728      if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE)               \
729      {                                                                \
730         (__HANDLE__)->Mask = 0x007F ;                                 \
731      }                                                                \
732      else                                                             \
733      {                                                                \
734         (__HANDLE__)->Mask = 0x003F ;                                 \
735      }                                                                \
736   }                                                                   \
737   else                                                                \
738   {                                                                   \
739     (__HANDLE__)->Mask = 0x0000U;                                     \
740   }                                                                   \
741 } while(0)
742 
743 /** @brief  Ensure that IRDA Baud rate is less or equal to maximum value.
744   * @param  __BAUDRATE__ specifies the IRDA Baudrate set by the user.
745   * @retval True or False
746   */
747 #define IS_IRDA_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 115201U)
748 
749 /** @brief  Ensure that IRDA prescaler value is strictly larger than 0.
750   * @param  __PRESCALER__ specifies the IRDA prescaler value set by the user.
751   * @retval True or False
752   */
753 #define IS_IRDA_PRESCALER(__PRESCALER__) ((__PRESCALER__) > 0U)
754 
755 /**
756   * @brief Ensure that IRDA frame length is valid.
757   * @param __LENGTH__ IRDA frame length.
758   * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
759   */
760 #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \
761                                          ((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
762                                          ((__LENGTH__) == IRDA_WORDLENGTH_9B))
763 
764 /**
765   * @brief Ensure that IRDA frame parity is valid.
766   * @param __PARITY__ IRDA frame parity.
767   * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid)
768   */
769 #define IS_IRDA_PARITY(__PARITY__) (((__PARITY__) == IRDA_PARITY_NONE) || \
770                                     ((__PARITY__) == IRDA_PARITY_EVEN) || \
771                                     ((__PARITY__) == IRDA_PARITY_ODD))
772 
773 /**
774   * @brief Ensure that IRDA communication mode is valid.
775   * @param __MODE__ IRDA communication mode.
776   * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
777   */
778 #define IS_IRDA_TX_RX_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(IRDA_MODE_TX_RX)))) == 0x00U) && ((__MODE__) != 0x00U))
779 
780 /**
781   * @brief Ensure that IRDA power mode is valid.
782   * @param __MODE__ IRDA power mode.
783   * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
784   */
785 #define IS_IRDA_POWERMODE(__MODE__) (((__MODE__) == IRDA_POWERMODE_LOWPOWER) || \
786                                      ((__MODE__) == IRDA_POWERMODE_NORMAL))
787 
788 /**
789   * @brief Ensure that IRDA clock Prescaler is valid.
790   * @param __CLOCKPRESCALER__ IRDA clock Prescaler value.
791   * @retval SET (__CLOCKPRESCALER__ is valid) or RESET (__CLOCKPRESCALER__ is invalid)
792   */
793 #define IS_IRDA_CLOCKPRESCALER(__CLOCKPRESCALER__) (((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV1) || \
794               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV2)   || \
795               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV4)   || \
796               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV6)   || \
797               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV8)   || \
798               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV10)  || \
799               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV12)  || \
800               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV16)  || \
801               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV32)  || \
802               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV64)  || \
803               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV128) || \
804               ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV256))
805 
806 /**
807   * @brief Ensure that IRDA state is valid.
808   * @param __STATE__ IRDA state mode.
809   * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid)
810   */
811 #define IS_IRDA_STATE(__STATE__) (((__STATE__) == IRDA_STATE_DISABLE) || \
812                                   ((__STATE__) == IRDA_STATE_ENABLE))
813 
814 /**
815   * @brief Ensure that IRDA associated UART/USART mode is valid.
816   * @param __MODE__ IRDA associated UART/USART mode.
817   * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
818   */
819 #define IS_IRDA_MODE(__MODE__)  (((__MODE__) == IRDA_MODE_DISABLE) || \
820                                  ((__MODE__) == IRDA_MODE_ENABLE))
821 
822 /**
823   * @brief Ensure that IRDA sampling rate is valid.
824   * @param __ONEBIT__ IRDA sampling rate.
825   * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid)
826   */
827 #define IS_IRDA_ONE_BIT_SAMPLE(__ONEBIT__)      (((__ONEBIT__) == IRDA_ONE_BIT_SAMPLE_DISABLE) || \
828                                                  ((__ONEBIT__) == IRDA_ONE_BIT_SAMPLE_ENABLE))
829 
830 /**
831   * @brief Ensure that IRDA DMA TX mode is valid.
832   * @param __DMATX__ IRDA DMA TX mode.
833   * @retval SET (__DMATX__ is valid) or RESET (__DMATX__ is invalid)
834   */
835 #define IS_IRDA_DMA_TX(__DMATX__)     (((__DMATX__) == IRDA_DMA_TX_DISABLE) || \
836                                        ((__DMATX__) == IRDA_DMA_TX_ENABLE))
837 
838 /**
839   * @brief Ensure that IRDA DMA RX mode is valid.
840   * @param __DMARX__ IRDA DMA RX mode.
841   * @retval SET (__DMARX__ is valid) or RESET (__DMARX__ is invalid)
842   */
843 #define IS_IRDA_DMA_RX(__DMARX__) (((__DMARX__) == IRDA_DMA_RX_DISABLE) || \
844                                    ((__DMARX__) == IRDA_DMA_RX_ENABLE))
845 
846 /**
847   * @brief Ensure that IRDA request is valid.
848   * @param __PARAM__ IRDA request.
849   * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid)
850   */
851 #define IS_IRDA_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == IRDA_AUTOBAUD_REQUEST) || \
852                                               ((__PARAM__) == IRDA_RXDATA_FLUSH_REQUEST) || \
853                                               ((__PARAM__) == IRDA_TXDATA_FLUSH_REQUEST))
854 /**
855  * @}
856  */
857 
858 /* Include IRDA HAL Extended module */
859 #include "stm32wbxx_hal_irda_ex.h"
860 
861 /* Exported functions --------------------------------------------------------*/
862 /** @addtogroup IRDA_Exported_Functions IRDA Exported Functions
863   * @{
864   */
865 
866 /** @addtogroup IRDA_Exported_Functions_Group1 Initialization and de-initialization functions
867   * @{
868   */
869 
870 /* Initialization and de-initialization functions  ****************************/
871 HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda);
872 HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda);
873 void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda);
874 void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda);
875 
876 #if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
877 /* Callbacks Register/UnRegister functions  ***********************************/
878 HAL_StatusTypeDef HAL_IRDA_RegisterCallback(IRDA_HandleTypeDef *hirda, HAL_IRDA_CallbackIDTypeDef CallbackID, pIRDA_CallbackTypeDef pCallback);
879 HAL_StatusTypeDef HAL_IRDA_UnRegisterCallback(IRDA_HandleTypeDef *hirda, HAL_IRDA_CallbackIDTypeDef CallbackID);
880 #endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
881 
882 /**
883   * @}
884   */
885 
886 /** @addtogroup IRDA_Exported_Functions_Group2 IO operation functions
887   * @{
888   */
889 
890 /* IO operation functions *****************************************************/
891 HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, const uint8_t *pData, uint16_t Size, uint32_t Timeout);
892 HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout);
893 HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, const uint8_t *pData, uint16_t Size);
894 HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
895 HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, const uint8_t *pData, uint16_t Size);
896 HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
897 HAL_StatusTypeDef HAL_IRDA_DMAPause(IRDA_HandleTypeDef *hirda);
898 HAL_StatusTypeDef HAL_IRDA_DMAResume(IRDA_HandleTypeDef *hirda);
899 HAL_StatusTypeDef HAL_IRDA_DMAStop(IRDA_HandleTypeDef *hirda);
900 /* Transfer Abort functions */
901 HAL_StatusTypeDef HAL_IRDA_Abort(IRDA_HandleTypeDef *hirda);
902 HAL_StatusTypeDef HAL_IRDA_AbortTransmit(IRDA_HandleTypeDef *hirda);
903 HAL_StatusTypeDef HAL_IRDA_AbortReceive(IRDA_HandleTypeDef *hirda);
904 HAL_StatusTypeDef HAL_IRDA_Abort_IT(IRDA_HandleTypeDef *hirda);
905 HAL_StatusTypeDef HAL_IRDA_AbortTransmit_IT(IRDA_HandleTypeDef *hirda);
906 HAL_StatusTypeDef HAL_IRDA_AbortReceive_IT(IRDA_HandleTypeDef *hirda);
907 
908 void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda);
909 void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda);
910 void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda);
911 void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda);
912 void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda);
913 void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda);
914 void HAL_IRDA_AbortCpltCallback(IRDA_HandleTypeDef *hirda);
915 void HAL_IRDA_AbortTransmitCpltCallback(IRDA_HandleTypeDef *hirda);
916 void HAL_IRDA_AbortReceiveCpltCallback(IRDA_HandleTypeDef *hirda);
917 
918 /**
919   * @}
920   */
921 
922 /* Peripheral Control functions  ************************************************/
923 
924 /** @addtogroup IRDA_Exported_Functions_Group4 Peripheral State and Error functions
925   * @{
926   */
927 
928 /* Peripheral State and Error functions ***************************************/
929 HAL_IRDA_StateTypeDef HAL_IRDA_GetState(const IRDA_HandleTypeDef *hirda);
930 uint32_t              HAL_IRDA_GetError(const IRDA_HandleTypeDef *hirda);
931 
932 /**
933   * @}
934   */
935 
936 /**
937   * @}
938   */
939 
940 /**
941   * @}
942   */
943 
944 /**
945   * @}
946   */
947 
948 #ifdef __cplusplus
949 }
950 #endif
951 
952 #endif /* STM32WBxx_HAL_IRDA_H */
953 
954