]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L1/stm32l1xx_hal_irda.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L1 / stm32l1xx_hal_irda.h
1 /**
2 ******************************************************************************
3 * @file stm32l1xx_hal_irda.h
4 * @author MCD Application Team
5 * @version V1.0.0
6 * @date 5-September-2014
7 * @brief This file contains all the functions prototypes for the IRDA
8 * firmware library.
9 ******************************************************************************
10 * @attention
11 *
12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
13 *
14 * Redistribution and use in source and binary forms, with or without modification,
15 * are permitted provided that the following conditions are met:
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 ******************************************************************************
37 */
38
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __STM32L1xx_HAL_IRDA_H
41 #define __STM32L1xx_HAL_IRDA_H
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32l1xx_hal_def.h"
49
50 /** @addtogroup STM32L1xx_HAL_Driver
51 * @{
52 */
53
54 /** @addtogroup IRDA
55 * @{
56 */
57
58 /* Exported types ------------------------------------------------------------*/
59 /** @defgroup IRDA_Exported_Types IRDA Exported Types
60 * @{
61 */
62
63 /**
64 * @brief IRDA Init Structure definition
65 */
66 typedef struct
67 {
68 uint32_t BaudRate; /*!< This member configures the IRDA communication baud rate.
69 The baud rate is computed using the following formula:
70 - IntegerDivider = ((PCLKx) / (8 * (hirda->Init.BaudRate)))
71 - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */
72
73 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
74 This parameter can be a value of @ref IRDA_Word_Length */
75
76
77 uint32_t Parity; /*!< Specifies the parity mode.
78 This parameter can be a value of @ref IRDA_Parity
79 @note When parity is enabled, the computed parity is inserted
80 at the MSB position of the transmitted data (9th bit when
81 the word length is set to 9 data bits; 8th bit when the
82 word length is set to 8 data bits). */
83
84 uint32_t Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
85 This parameter can be a value of @ref IRDA_Transfer_Mode */
86
87 uint8_t Prescaler; /*!< Specifies the Prescaler */
88
89 uint32_t IrDAMode; /*!< Specifies the IrDA mode
90 This parameter can be a value of @ref IRDA_Low_Power */
91 }IRDA_InitTypeDef;
92
93 /**
94 * @brief HAL IRDA State structures definition
95 */
96 typedef enum
97 {
98 HAL_IRDA_STATE_RESET = 0x00, /*!< Peripheral is not initialized */
99 HAL_IRDA_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
100 HAL_IRDA_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
101 HAL_IRDA_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
102 HAL_IRDA_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
103 HAL_IRDA_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
104 HAL_IRDA_STATE_TIMEOUT = 0x03, /*!< Timeout state */
105 HAL_IRDA_STATE_ERROR = 0x04 /*!< Error */
106 }HAL_IRDA_StateTypeDef;
107
108 /**
109 * @brief HAL IRDA Error Code structure definition
110 */
111 typedef enum
112 {
113 HAL_IRDA_ERROR_NONE = 0x00, /*!< No error */
114 HAL_IRDA_ERROR_PE = 0x01, /*!< Parity error */
115 HAL_IRDA_ERROR_NE = 0x02, /*!< Noise error */
116 HAL_IRDA_ERROR_FE = 0x04, /*!< frame error */
117 HAL_IRDA_ERROR_ORE = 0x08, /*!< Overrun error */
118 HAL_IRDA_ERROR_DMA = 0x10 /*!< DMA transfer error */
119 }HAL_IRDA_ErrorTypeDef;
120
121 /**
122 * @brief IRDA handle Structure definition
123 */
124 typedef struct
125 {
126 USART_TypeDef *Instance; /* USART registers base address */
127
128 IRDA_InitTypeDef Init; /* IRDA communication parameters */
129
130 uint8_t *pTxBuffPtr; /* Pointer to IRDA Tx transfer Buffer */
131
132 uint16_t TxXferSize; /* IRDA Tx Transfer size */
133
134 uint16_t TxXferCount; /* IRDA Tx Transfer Counter */
135
136 uint8_t *pRxBuffPtr; /* Pointer to IRDA Rx transfer Buffer */
137
138 uint16_t RxXferSize; /* IRDA Rx Transfer size */
139
140 uint16_t RxXferCount; /* IRDA Rx Transfer Counter */
141
142 DMA_HandleTypeDef *hdmatx; /* IRDA Tx DMA Handle parameters */
143
144 DMA_HandleTypeDef *hdmarx; /* IRDA Rx DMA Handle parameters */
145
146 HAL_LockTypeDef Lock; /* Locking object */
147
148 __IO HAL_IRDA_StateTypeDef State; /* IRDA communication state */
149
150 __IO HAL_IRDA_ErrorTypeDef ErrorCode; /* IRDA Error code */
151
152 }IRDA_HandleTypeDef;
153
154 /**
155 * @}
156 */
157
158 /* Exported constants --------------------------------------------------------*/
159 /** @defgroup IRDA_Exported_Constants IRDA Exported constants
160 * @{
161 */
162
163 /** @defgroup IRDA_Word_Length IRDA Word Length
164 * @{
165 */
166 #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000)
167 #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M)
168 #define IS_IRDA_WORD_LENGTH(LENGTH) (((LENGTH) == IRDA_WORDLENGTH_8B) || \
169 ((LENGTH) == IRDA_WORDLENGTH_9B))
170 /**
171 * @}
172 */
173
174
175 /** @defgroup IRDA_Parity IRDA Parity
176 * @{
177 */
178 #define IRDA_PARITY_NONE ((uint32_t)0x00000000)
179 #define IRDA_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
180 #define IRDA_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
181 #define IS_IRDA_PARITY(PARITY) (((PARITY) == IRDA_PARITY_NONE) || \
182 ((PARITY) == IRDA_PARITY_EVEN) || \
183 ((PARITY) == IRDA_PARITY_ODD))
184 /**
185 * @}
186 */
187
188
189 /** @defgroup IRDA_Transfer_Mode IRDA Transfer Mode
190 * @{
191 */
192 #define IRDA_MODE_RX ((uint32_t)USART_CR1_RE)
193 #define IRDA_MODE_TX ((uint32_t)USART_CR1_TE)
194 #define IRDA_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
195 #define IS_IRDA_MODE(MODE) ((((MODE) & (uint32_t)0x0000FFF3) == 0x00) && ((MODE) != (uint32_t)0x000000))
196 /**
197 * @}
198 */
199
200 /** @defgroup IRDA_Low_Power IRDA Low Power
201 * @{
202 */
203 #define IRDA_POWERMODE_LOWPOWER ((uint32_t)USART_CR3_IRLP)
204 #define IRDA_POWERMODE_NORMAL ((uint32_t)0x00000000)
205 #define IS_IRDA_POWERMODE(MODE) (((MODE) == IRDA_POWERMODE_LOWPOWER) || \
206 ((MODE) == IRDA_POWERMODE_NORMAL))
207 /**
208 * @}
209 */
210
211 /** @defgroup IRDA_Flags IRDA Flags
212 * Elements values convention: 0xXXXX
213 * - 0xXXXX : Flag mask in the SR register
214 * @{
215 */
216 #define IRDA_FLAG_TXE ((uint32_t)USART_SR_TXE)
217 #define IRDA_FLAG_TC ((uint32_t)USART_SR_TC)
218 #define IRDA_FLAG_RXNE ((uint32_t)USART_SR_RXNE)
219 #define IRDA_FLAG_IDLE ((uint32_t)USART_SR_IDLE)
220 #define IRDA_FLAG_ORE ((uint32_t)USART_SR_ORE)
221 #define IRDA_FLAG_NE ((uint32_t)USART_SR_NE)
222 #define IRDA_FLAG_FE ((uint32_t)USART_SR_FE)
223 #define IRDA_FLAG_PE ((uint32_t)USART_SR_PE)
224 /**
225 * @}
226 */
227
228 /** @defgroup IRDA_Interrupt_definition IRDA Interrupt Definitions
229 * Elements values convention: 0xY000XXXX
230 * - XXXX : Interrupt mask in the XX register
231 * - Y : Interrupt source register (4 bits)
232 * - 01: CR1 register
233 * - 10: CR2 register
234 * - 11: CR3 register
235 *
236 * @{
237 */
238
239 #define IRDA_IT_PE ((uint32_t)0x10000100)
240 #define IRDA_IT_TXE ((uint32_t)0x10000080)
241 #define IRDA_IT_TC ((uint32_t)0x10000040)
242 #define IRDA_IT_RXNE ((uint32_t)0x10000020)
243 #define IRDA_IT_IDLE ((uint32_t)0x10000010)
244
245 #define IRDA_IT_LBD ((uint32_t)0x20000040)
246
247 #define IRDA_IT_CTS ((uint32_t)0x30000400)
248 #define IRDA_IT_ERR ((uint32_t)0x30000001)
249
250 /**
251 * @}
252 */
253
254 /** @defgroup IRDA_Interruption_Mask IRDA interruptions flag mask
255 * @{
256 */
257 #define IRDA_IT_MASK ((uint32_t)0x0000FFFF)
258 /**
259 * @}
260 */
261
262 /**
263 * @}
264 */
265
266 /* Exported macro ------------------------------------------------------------*/
267 /** @defgroup IRDA_Exported_Macros IRDA Exported Macros
268 * @{
269 */
270
271 /** @brief Reset IRDA handle state
272 * @param __HANDLE__: specifies the IRDA Handle.
273 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
274 * UART peripheral (availability depending on device for UARTy).
275 * @retval None
276 */
277 #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_IRDA_STATE_RESET)
278
279 /** @brief Flushs the IRDA DR register
280 * @param __HANDLE__: specifies the USART Handle.
281 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
282 * UART peripheral (availability depending on device for UARTy).
283 */
284 #define __HAL_IRDA_FLUSH_DRREGISTER(__HANDLE__) ((__HANDLE__)->Instance->DR)
285
286 /** @brief Checks whether the specified IRDA flag is set or not.
287 * @param __HANDLE__: specifies the IRDA Handle.
288 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
289 * UART peripheral (availability depending on device for UARTy).
290 * @param __FLAG__: specifies the flag to check.
291 * This parameter can be one of the following values:
292 * @arg IRDA_FLAG_TXE: Transmit data register empty flag
293 * @arg IRDA_FLAG_TC: Transmission Complete flag
294 * @arg IRDA_FLAG_RXNE: Receive data register not empty flag
295 * @arg IRDA_FLAG_IDLE: Idle Line detection flag
296 * @arg IRDA_FLAG_ORE: OverRun Error flag
297 * @arg IRDA_FLAG_NE: Noise Error flag
298 * @arg IRDA_FLAG_FE: Framing Error flag
299 * @arg IRDA_FLAG_PE: Parity Error flag
300 * @retval The new state of __FLAG__ (TRUE or FALSE).
301 */
302 #define __HAL_IRDA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
303
304 /** @brief Clears the specified IRDA pending flag.
305 * @param __HANDLE__: specifies the IRDA Handle.
306 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
307 * UART peripheral (availability depending on device for UARTy).
308 * @param __FLAG__: specifies the flag to check.
309 * This parameter can be any combination of the following values:
310 * @arg IRDA_FLAG_TC: Transmission Complete flag.
311 * @arg IRDA_FLAG_RXNE: Receive data register not empty flag.
312 *
313 * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun
314 * error) and IDLE (Idle line detected) flags are cleared by software
315 * sequence: a read operation to USART_SR register followed by a read
316 * operation to USART_DR register.
317 * @note RXNE flag can be also cleared by a read to the USART_DR register.
318 * @note TC flag can be also cleared by software sequence: a read operation to
319 * USART_SR register followed by a write operation to USART_DR register.
320 * @note TXE flag is cleared only by a write to the USART_DR register.
321 *
322 * @retval None
323 */
324 #define __HAL_IRDA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
325
326 /** @brief Clear the IRDA PE pending flag.
327 * @param __HANDLE__: specifies the IRDA Handle.
328 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
329 * UART peripheral (availability depending on device for UARTy).
330 * @retval None
331 */
332 #define __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) do{(__HANDLE__)->Instance->SR;\
333 (__HANDLE__)->Instance->DR;}while(0)
334 /** @brief Clear the IRDA FE pending flag.
335 * @param __HANDLE__: specifies the IRDA Handle.
336 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
337 * UART peripheral (availability depending on device for UARTy).
338 * @retval None
339 */
340 #define __HAL_IRDA_CLEAR_FEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__)
341
342 /** @brief Clear the IRDA NE pending flag.
343 * @param __HANDLE__: specifies the IRDA Handle.
344 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
345 * UART peripheral (availability depending on device for UARTy).
346 * @retval None
347 */
348 #define __HAL_IRDA_CLEAR_NEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__)
349
350 /** @brief Clear the IRDA ORE pending flag.
351 * @param __HANDLE__: specifies the IRDA Handle.
352 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
353 * UART peripheral (availability depending on device for UARTy).
354 * @retval None
355 */
356 #define __HAL_IRDA_CLEAR_OREFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__)
357
358 /** @brief Clear the IRDA IDLE pending flag.
359 * @param __HANDLE__: specifies the IRDA Handle.
360 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
361 * UART peripheral (availability depending on device for UARTy).
362 * @retval None
363 */
364 #define __HAL_IRDA_CLEAR_IDLEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__)
365
366 /** @brief Enables the specified IRDA interrupt.
367 * @param __HANDLE__: specifies the IRDA Handle.
368 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
369 * UART peripheral (availability depending on device for UARTy).
370 * @param __INTERRUPT__: specifies the IRDA interrupt source to enable.
371 * This parameter can be one of the following values:
372 * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt
373 * @arg IRDA_IT_TC: Transmission complete interrupt
374 * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt
375 * @arg IRDA_IT_IDLE: Idle line detection interrupt
376 * @arg IRDA_IT_PE: Parity Error interrupt
377 * @arg IRDA_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
378 * @retval None
379 */
380 #define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & IRDA_IT_MASK)): \
381 (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & IRDA_IT_MASK)): \
382 ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & IRDA_IT_MASK)))
383
384 /** @brief Disables the specified IRDA interrupt.
385 * @param __HANDLE__: specifies the IRDA Handle.
386 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
387 * UART peripheral (availability depending on device for UARTy).
388 * @param __INTERRUPT__: specifies the IRDA interrupt source to disable.
389 * This parameter can be one of the following values:
390 * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt
391 * @arg IRDA_IT_TC: Transmission complete interrupt
392 * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt
393 * @arg IRDA_IT_IDLE: Idle line detection interrupt
394 * @arg IRDA_IT_PE: Parity Error interrupt
395 * @arg IRDA_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
396 * @retval None
397 */
398 #define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & IRDA_IT_MASK)): \
399 (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & IRDA_IT_MASK)): \
400 ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & IRDA_IT_MASK)))
401
402 /** @brief Checks whether the specified IRDA interrupt has occurred or not.
403 * @param __HANDLE__: specifies the IRDA Handle.
404 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
405 * UART peripheral (availability depending on device for UARTy).
406 * @param __IT__: specifies the IRDA interrupt source to check.
407 * This parameter can be one of the following values:
408 * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt
409 * @arg IRDA_IT_TC: Transmission complete interrupt
410 * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt
411 * @arg IRDA_IT_IDLE: Idle line detection interrupt
412 * @arg USART_IT_ERR: Error interrupt
413 * @arg IRDA_IT_PE: Parity Error interrupt
414 * @retval The new state of __IT__ (TRUE or FALSE).
415 */
416 #define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28) == 1)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28) == 2)? \
417 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & IRDA_IT_MASK))
418
419 /** @brief Enable UART/USART associated to IRDA Handle
420 * @param __HANDLE__: specifies the IRDA Handle.
421 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
422 * UART peripheral (availability depending on device for UARTy).
423 * @retval None
424 */
425 #define __HAL_IRDA_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, USART_CR1_UE))
426
427 /** @brief Disable UART/USART associated to IRDA Handle
428 * @param __HANDLE__: specifies the IRDA Handle.
429 * This parameter can be USARTx with x: 1, 2 or 3, or UARTy with y:4 or 5 to select the USART or
430 * UART peripheral (availability depending on device for UARTy).
431 * @retval None
432 */
433 #define __HAL_IRDA_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, USART_CR1_UE))
434
435 /**
436 * @}
437 */
438
439 /* Private macros --------------------------------------------------------*/
440 /** @defgroup IRDA_Private_Macros IRDA Private Macros
441 * @{
442 */
443
444 #define IRDA_DIV(__PCLK__, __BAUD__) (((__PCLK__)*25)/(4*(__BAUD__)))
445 #define IRDA_DIVMANT(__PCLK__, __BAUD__) (IRDA_DIV((__PCLK__), (__BAUD__))/100)
446 #define IRDA_DIVFRAQ(__PCLK__, __BAUD__) (((IRDA_DIV((__PCLK__), (__BAUD__)) - (IRDA_DIVMANT((__PCLK__), (__BAUD__)) * 100)) * 16 + 50) / 100)
447 #define IRDA_BRR(__PCLK__, __BAUD__) ((IRDA_DIVMANT((__PCLK__), (__BAUD__)) << 4)|(IRDA_DIVFRAQ((__PCLK__), (__BAUD__)) & 0x0F))
448
449 /** @brief Ensure that IRDA Baud rate is less or equal to maximum value
450 * @param __BAUDRATE__: specifies the IRDA Baudrate set by the user.
451 * @retval True or False
452 */
453 #define IS_IRDA_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 115201)
454
455 /**
456 * @}
457 */
458
459
460 /* Exported functions --------------------------------------------------------*/
461
462 /** @addtogroup IRDA_Exported_Functions IRDA Exported Functions
463 * @{
464 */
465
466 /** @addtogroup IRDA_Exported_Functions_Group1 IrDA Initialization and de-initialization functions
467 * @{
468 */
469
470 /* Initialization and de-initialization functions ****************************/
471 HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda);
472 HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda);
473 void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda);
474 void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda);
475
476 /**
477 * @}
478 */
479
480 /** @addtogroup IRDA_Exported_Functions_Group2 IO operation functions
481 * @{
482 */
483
484 /* IO operation functions *****************************************************/
485 HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout);
486 HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout);
487 HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
488 HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
489 HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
490 HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
491 HAL_StatusTypeDef HAL_IRDA_DMAPause(IRDA_HandleTypeDef *hirda);
492 HAL_StatusTypeDef HAL_IRDA_DMAResume(IRDA_HandleTypeDef *hirda);
493 HAL_StatusTypeDef HAL_IRDA_DMAStop(IRDA_HandleTypeDef *hirda);
494 void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda);
495 void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda);
496 void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda);
497 void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda);
498 void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda);
499 void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda);
500
501 /**
502 * @}
503 */
504
505 /** @addtogroup IRDA_Exported_Functions_Group3 Peripheral State and Errors functions
506 * @{
507 */
508
509 /* Peripheral State and Error functions ***************************************/
510 HAL_IRDA_StateTypeDef HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda);
511 uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda);
512
513 /**
514 * @}
515 */
516
517 /**
518 * @}
519 */
520
521 /**
522 * @}
523 */
524
525 /**
526 * @}
527 */
528
529 #ifdef __cplusplus
530 }
531 #endif
532
533 #endif /* __STM32L1xx_HAL_IRDA_H */
534
535 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Imprint / Impressum