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