stm32l4xx_hal_irda.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  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. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32L4xx_HAL_IRDA_H
  37. #define __STM32L4xx_HAL_IRDA_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32l4xx_hal_def.h"
  43. /** @addtogroup STM32L4xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup IRDA
  47. * @{
  48. */
  49. /* Exported types ------------------------------------------------------------*/
  50. /** @defgroup IRDA_Exported_Types IRDA Exported Types
  51. * @{
  52. */
  53. /**
  54. * @brief IRDA Init Structure definition
  55. */
  56. typedef struct
  57. {
  58. uint32_t BaudRate; /*!< This member configures the IRDA communication baud rate.
  59. The baud rate register is computed using the following formula:
  60. Baud Rate Register = ((usart_ker_ckpres) / ((hirda->Init.BaudRate)))
  61. where usart_ker_ckpres is the IRDA input clock divided by a prescaler */
  62. uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
  63. This parameter can be a value of @ref IRDA_Word_Length */
  64. uint32_t Parity; /*!< Specifies the parity mode.
  65. This parameter can be a value of @ref IRDA_Parity
  66. @note When parity is enabled, the computed parity is inserted
  67. at the MSB position of the transmitted data (9th bit when
  68. the word length is set to 9 data bits; 8th bit when the
  69. word length is set to 8 data bits). */
  70. uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
  71. This parameter can be a value of @ref IRDA_Transfer_Mode */
  72. uint8_t Prescaler; /*!< Specifies the Prescaler value for dividing the UART/USART source clock
  73. to achieve low-power frequency.
  74. @note Prescaler value 0 is forbidden */
  75. uint16_t PowerMode; /*!< Specifies the IRDA power mode.
  76. This parameter can be a value of @ref IRDA_Low_Power */
  77. #if defined(USART_PRESC_PRESCALER)
  78. uint32_t ClockPrescaler; /*!< Specifies the prescaler value used to divide the IRDA clock source.
  79. This parameter can be a value of @ref IRDA_ClockPrescaler. */
  80. #endif
  81. }IRDA_InitTypeDef;
  82. /**
  83. * @brief HAL IRDA State structures definition
  84. * @note HAL IRDA State value is a combination of 2 different substates: gState and RxState.
  85. * - gState contains IRDA state information related to global Handle management
  86. * and also information related to Tx operations.
  87. * gState value coding follow below described bitmap :
  88. * b7-b6 Error information
  89. * 00 : No Error
  90. * 01 : (Not Used)
  91. * 10 : Timeout
  92. * 11 : Error
  93. * b5 IP initilisation status
  94. * 0 : Reset (IP not initialized)
  95. * 1 : Init done (IP not initialized. HAL IRDA Init function already called)
  96. * b4-b3 (not used)
  97. * xx : Should be set to 00
  98. * b2 Intrinsic process state
  99. * 0 : Ready
  100. * 1 : Busy (IP busy with some configuration or internal operations)
  101. * b1 (not used)
  102. * x : Should be set to 0
  103. * b0 Tx state
  104. * 0 : Ready (no Tx operation ongoing)
  105. * 1 : Busy (Tx operation ongoing)
  106. * - RxState contains information related to Rx operations.
  107. * RxState value coding follow below described bitmap :
  108. * b7-b6 (not used)
  109. * xx : Should be set to 00
  110. * b5 IP initilisation status
  111. * 0 : Reset (IP not initialized)
  112. * 1 : Init done (IP not initialized)
  113. * b4-b2 (not used)
  114. * xxx : Should be set to 000
  115. * b1 Rx state
  116. * 0 : Ready (no Rx operation ongoing)
  117. * 1 : Busy (Rx operation ongoing)
  118. * b0 (not used)
  119. * x : Should be set to 0.
  120. */
  121. typedef enum
  122. {
  123. HAL_IRDA_STATE_RESET = 0x00U, /*!< Peripheral is not initialized
  124. Value is allowed for gState and RxState */
  125. HAL_IRDA_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use
  126. Value is allowed for gState and RxState */
  127. HAL_IRDA_STATE_BUSY = 0x24U, /*!< an internal process is ongoing
  128. Value is allowed for gState only */
  129. HAL_IRDA_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing
  130. Value is allowed for gState only */
  131. HAL_IRDA_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing
  132. Value is allowed for RxState only */
  133. HAL_IRDA_STATE_BUSY_TX_RX = 0x23U, /*!< Data Transmission and Reception process is ongoing
  134. Not to be used for neither gState nor RxState.
  135. Value is result of combination (Or) between gState and RxState values */
  136. HAL_IRDA_STATE_TIMEOUT = 0xA0U, /*!< Timeout state
  137. Value is allowed for gState only */
  138. HAL_IRDA_STATE_ERROR = 0xE0U /*!< Error
  139. Value is allowed for gState only */
  140. }HAL_IRDA_StateTypeDef;
  141. /**
  142. * @brief HAL IRDA Error Code structure definition
  143. */
  144. typedef enum
  145. {
  146. HAL_IRDA_ERROR_NONE = 0x00U, /*!< No error */
  147. HAL_IRDA_ERROR_PE = 0x01U, /*!< Parity error */
  148. HAL_IRDA_ERROR_NE = 0x02U, /*!< Noise error */
  149. HAL_IRDA_ERROR_FE = 0x04U, /*!< frame error */
  150. HAL_IRDA_ERROR_ORE = 0x08U, /*!< Overrun error */
  151. HAL_IRDA_ERROR_DMA = 0x10U, /*!< DMA transfer error */
  152. HAL_IRDA_ERROR_BUSY = 0x20U /*!< Busy Error */
  153. }HAL_IRDA_ErrorTypeDef;
  154. /**
  155. * @brief IRDA clock sources definition
  156. */
  157. typedef enum
  158. {
  159. IRDA_CLOCKSOURCE_PCLK1 = 0x00U, /*!< PCLK1 clock source */
  160. IRDA_CLOCKSOURCE_PCLK2 = 0x01U, /*!< PCLK2 clock source */
  161. IRDA_CLOCKSOURCE_HSI = 0x02U, /*!< HSI clock source */
  162. IRDA_CLOCKSOURCE_SYSCLK = 0x04U, /*!< SYSCLK clock source */
  163. IRDA_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */
  164. IRDA_CLOCKSOURCE_UNDEFINED = 0x10U /*!< Undefined clock source */
  165. }IRDA_ClockSourceTypeDef;
  166. /**
  167. * @brief IRDA handle Structure definition
  168. */
  169. typedef struct
  170. {
  171. USART_TypeDef *Instance; /*!< USART registers base address */
  172. IRDA_InitTypeDef Init; /*!< IRDA communication parameters */
  173. uint8_t *pTxBuffPtr; /*!< Pointer to IRDA Tx transfer Buffer */
  174. uint16_t TxXferSize; /*!< IRDA Tx Transfer size */
  175. __IO uint16_t TxXferCount; /*!< IRDA Tx Transfer Counter */
  176. uint8_t *pRxBuffPtr; /*!< Pointer to IRDA Rx transfer Buffer */
  177. uint16_t RxXferSize; /*!< IRDA Rx Transfer size */
  178. __IO uint16_t RxXferCount; /*!< IRDA Rx Transfer Counter */
  179. uint16_t Mask; /*!< USART RX RDR register mask */
  180. DMA_HandleTypeDef *hdmatx; /*!< IRDA Tx DMA Handle parameters */
  181. DMA_HandleTypeDef *hdmarx; /*!< IRDA Rx DMA Handle parameters */
  182. HAL_LockTypeDef Lock; /*!< Locking object */
  183. __IO HAL_IRDA_StateTypeDef gState; /*!< IRDA state information related to global Handle management
  184. and also related to Tx operations.
  185. This parameter can be a value of @ref HAL_IRDA_StateTypeDef */
  186. __IO HAL_IRDA_StateTypeDef RxState; /*!< IRDA state information related to Rx operations.
  187. This parameter can be a value of @ref HAL_IRDA_StateTypeDef */
  188. uint32_t ErrorCode; /*!< IRDA Error code */
  189. }IRDA_HandleTypeDef;
  190. /**
  191. * @brief IRDA Configuration enumeration values definition
  192. */
  193. typedef enum
  194. {
  195. IRDA_BAUDRATE = 0x00U, /*!< IRDA Baud rate */
  196. IRDA_PARITY = 0x01U, /*!< IRDA frame parity */
  197. IRDA_WORDLENGTH = 0x02U, /*!< IRDA frame length */
  198. IRDA_MODE = 0x03U, /*!< IRDA communication mode */
  199. IRDA_PRESCALER = 0x04U, /*!< IRDA prescaling */
  200. IRDA_POWERMODE = 0x05U /*!< IRDA power mode */
  201. }IRDA_ControlTypeDef;
  202. /**
  203. * @}
  204. */
  205. /* Exported constants --------------------------------------------------------*/
  206. /** @defgroup IRDA_Exported_Constants IRDA Exported Constants
  207. * @{
  208. */
  209. /** @defgroup IRDA_Word_Length IRDA Word Length
  210. * @{
  211. */
  212. #define IRDA_WORDLENGTH_7B USART_CR1_M1 /*!< 7-bit long frame */
  213. #define IRDA_WORDLENGTH_8B 0x00000000U /*!< 8-bit long frame */
  214. #define IRDA_WORDLENGTH_9B USART_CR1_M0 /*!< 9-bit long frame */
  215. /**
  216. * @}
  217. */
  218. /** @defgroup IRDA_Parity IRDA Parity
  219. * @{
  220. */
  221. #define IRDA_PARITY_NONE 0x00000000U /*!< No parity */
  222. #define IRDA_PARITY_EVEN USART_CR1_PCE /*!< Even parity */
  223. #define IRDA_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Odd parity */
  224. /**
  225. * @}
  226. */
  227. /** @defgroup IRDA_Transfer_Mode IRDA Transfer Mode
  228. * @{
  229. */
  230. #define IRDA_MODE_RX USART_CR1_RE /*!< RX mode */
  231. #define IRDA_MODE_TX USART_CR1_TE /*!< TX mode */
  232. #define IRDA_MODE_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< RX and TX mode */
  233. /**
  234. * @}
  235. */
  236. /** @defgroup IRDA_Low_Power IRDA Low Power
  237. * @{
  238. */
  239. #define IRDA_POWERMODE_NORMAL 0x00000000U /*!< IRDA normal power mode */
  240. #define IRDA_POWERMODE_LOWPOWER USART_CR3_IRLP /*!< IRDA low power mode */
  241. /**
  242. * @}
  243. */
  244. #if defined(USART_PRESC_PRESCALER)
  245. /** @defgroup IRDA_ClockPrescaler Clock Prescaler
  246. * @{
  247. */
  248. #define IRDA_PRESCALER_DIV1 0x00000000U /*!< fclk_pres = fclk */
  249. #define IRDA_PRESCALER_DIV2 0x00000001U /*!< fclk_pres = fclk/2 */
  250. #define IRDA_PRESCALER_DIV4 0x00000002U /*!< fclk_pres = fclk/4 */
  251. #define IRDA_PRESCALER_DIV6 0x00000003U /*!< fclk_pres = fclk/6 */
  252. #define IRDA_PRESCALER_DIV8 0x00000004U /*!< fclk_pres = fclk/8 */
  253. #define IRDA_PRESCALER_DIV10 0x00000005U /*!< fclk_pres = fclk/10 */
  254. #define IRDA_PRESCALER_DIV12 0x00000006U /*!< fclk_pres = fclk/12 */
  255. #define IRDA_PRESCALER_DIV16 0x00000007U /*!< fclk_pres = fclk/16 */
  256. #define IRDA_PRESCALER_DIV32 0x00000008U /*!< fclk_pres = fclk/32 */
  257. #define IRDA_PRESCALER_DIV64 0x00000009U /*!< fclk_pres = fclk/64 */
  258. #define IRDA_PRESCALER_DIV128 0x0000000AU /*!< fclk_pres = fclk/128 */
  259. #define IRDA_PRESCALER_DIV256 0x0000000BU /*!< fclk_pres = fclk/256 */
  260. /**
  261. * @}
  262. */
  263. #endif
  264. /** @defgroup IRDA_State IRDA State
  265. * @{
  266. */
  267. #define IRDA_STATE_DISABLE 0x00000000U /*!< IRDA disabled */
  268. #define IRDA_STATE_ENABLE USART_CR1_UE /*!< IRDA enabled */
  269. /**
  270. * @}
  271. */
  272. /** @defgroup IRDA_Mode IRDA Mode
  273. * @{
  274. */
  275. #define IRDA_MODE_DISABLE 0x00000000U /*!< Associated UART disabled in IRDA mode */
  276. #define IRDA_MODE_ENABLE USART_CR3_IREN /*!< Associated UART enabled in IRDA mode */
  277. /**
  278. * @}
  279. */
  280. /** @defgroup IRDA_One_Bit IRDA One Bit Sampling
  281. * @{
  282. */
  283. #define IRDA_ONE_BIT_SAMPLE_DISABLE 0x00000000U /*!< One-bit sampling disabled */
  284. #define IRDA_ONE_BIT_SAMPLE_ENABLE USART_CR3_ONEBIT /*!< One-bit sampling enabled */
  285. /**
  286. * @}
  287. */
  288. /** @defgroup IRDA_DMA_Tx IRDA DMA Tx
  289. * @{
  290. */
  291. #define IRDA_DMA_TX_DISABLE 0x00000000U /*!< IRDA DMA TX disabled */
  292. #define IRDA_DMA_TX_ENABLE USART_CR3_DMAT /*!< IRDA DMA TX enabled */
  293. /**
  294. * @}
  295. */
  296. /** @defgroup IRDA_DMA_Rx IRDA DMA Rx
  297. * @{
  298. */
  299. #define IRDA_DMA_RX_DISABLE 0x00000000U /*!< IRDA DMA RX disabled */
  300. #define IRDA_DMA_RX_ENABLE USART_CR3_DMAR /*!< IRDA DMA RX enabled */
  301. /**
  302. * @}
  303. */
  304. /** @defgroup IRDA_Request_Parameters IRDA Request Parameters
  305. * @{
  306. */
  307. #define IRDA_AUTOBAUD_REQUEST USART_RQR_ABRRQ /*!< Auto-Baud Rate Request */
  308. #define IRDA_RXDATA_FLUSH_REQUEST USART_RQR_RXFRQ /*!< Receive Data flush Request */
  309. #define IRDA_TXDATA_FLUSH_REQUEST USART_RQR_TXFRQ /*!< Transmit data flush Request */
  310. /**
  311. * @}
  312. */
  313. /** @defgroup IRDA_Flags IRDA Flags
  314. * Elements values convention: 0xXXXX
  315. * - 0xXXXX : Flag mask in the ISR register
  316. * @{
  317. */
  318. #define IRDA_FLAG_REACK USART_ISR_REACK /*!< IRDA receive enable acknowledge flag */
  319. #define IRDA_FLAG_TEACK USART_ISR_TEACK /*!< IRDA transmit enable acknowledge flag */
  320. #define IRDA_FLAG_BUSY USART_ISR_BUSY /*!< IRDA busy flag */
  321. #define IRDA_FLAG_ABRF USART_ISR_ABRF /*!< IRDA auto Baud rate flag */
  322. #define IRDA_FLAG_ABRE USART_ISR_ABRE /*!< IRDA auto Baud rate error */
  323. #if defined(USART_CR1_FIFOEN)
  324. #define IRDA_FLAG_TXE USART_ISR_TXE_TXFNF /*!< IRDA transmit data register empty */
  325. #else
  326. #define IRDA_FLAG_TXE USART_ISR_TXE /*!< IRDA transmit data register empty */
  327. #endif
  328. #define IRDA_FLAG_TC USART_ISR_TC /*!< IRDA transmission complete */
  329. #if defined(USART_CR1_FIFOEN)
  330. #define IRDA_FLAG_RXNE USART_ISR_RXNE_RXFNE /*!< IRDA read data register not empty */
  331. #else
  332. #define IRDA_FLAG_RXNE USART_ISR_RXNE /*!< IRDA read data register not empty */
  333. #endif
  334. #define IRDA_FLAG_ORE USART_ISR_ORE /*!< IRDA overrun error */
  335. #define IRDA_FLAG_NE USART_ISR_NE /*!< IRDA noise error */
  336. #define IRDA_FLAG_FE USART_ISR_FE /*!< IRDA frame error */
  337. #define IRDA_FLAG_PE USART_ISR_PE /*!< IRDA parity error */
  338. /**
  339. * @}
  340. */
  341. /** @defgroup IRDA_Interrupt_definition IRDA Interrupts Definition
  342. * Elements values convention: 0000ZZZZ0XXYYYYYb
  343. * - YYYYY : Interrupt source position in the XX register (5bits)
  344. * - XX : Interrupt source register (2bits)
  345. * - 01: CR1 register
  346. * - 10: CR2 register
  347. * - 11: CR3 register
  348. * - ZZZZ : Flag position in the ISR register(4bits)
  349. * @{
  350. */
  351. #define IRDA_IT_PE 0x0028U /*!< IRDA Parity error interruption */
  352. #define IRDA_IT_TXE 0x0727U /*!< IRDA Transmit data register empty interruption */
  353. #define IRDA_IT_TC 0x0626U /*!< IRDA Transmission complete interruption */
  354. #define IRDA_IT_RXNE 0x0525U /*!< IRDA Read data register not empty interruption */
  355. #define IRDA_IT_IDLE 0x0424U /*!< IRDA Idle interruption */
  356. /* Elements values convention: 000000000XXYYYYYb
  357. - YYYYY : Interrupt source position in the XX register (5bits)
  358. - XX : Interrupt source register (2bits)
  359. - 01: CR1 register
  360. - 10: CR2 register
  361. - 11: CR3 register */
  362. #define IRDA_IT_ERR 0x0060U /*!< IRDA Error interruption */
  363. /* Elements values convention: 0000ZZZZ00000000b
  364. - ZZZZ : Flag position in the ISR register(4bits) */
  365. #define IRDA_IT_ORE 0x0300U /*!< IRDA Overrun error interruption */
  366. #define IRDA_IT_NE 0x0200U /*!< IRDA Noise error interruption */
  367. #define IRDA_IT_FE 0x0100U /*!< IRDA Frame error interruption */
  368. /**
  369. * @}
  370. */
  371. /** @defgroup IRDA_IT_CLEAR_Flags IRDA Interruption Clear Flags
  372. * @{
  373. */
  374. #define IRDA_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
  375. #define IRDA_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
  376. #define IRDA_CLEAR_NEF USART_ICR_NECF /*!< Noise detected Clear Flag */
  377. #define IRDA_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
  378. #define IRDA_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
  379. #define IRDA_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
  380. /**
  381. * @}
  382. */
  383. /** @defgroup IRDA_Interruption_Mask IRDA interruptions flags mask
  384. * @{
  385. */
  386. #define IRDA_IT_MASK 0x001FU /*!< IRDA Interruptions flags mask */
  387. /**
  388. * @}
  389. */
  390. /**
  391. * @}
  392. */
  393. /* Exported macros -----------------------------------------------------------*/
  394. /** @defgroup IRDA_Exported_Macros IRDA Exported Macros
  395. * @{
  396. */
  397. /** @brief Reset IRDA handle state.
  398. * @param __HANDLE__ IRDA handle.
  399. * @retval None
  400. */
  401. #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__) do{ \
  402. (__HANDLE__)->gState = HAL_IRDA_STATE_RESET; \
  403. (__HANDLE__)->RxState = HAL_IRDA_STATE_RESET; \
  404. } while(0)
  405. /** @brief Flush the IRDA DR register.
  406. * @param __HANDLE__ specifies the IRDA Handle.
  407. * @retval None
  408. */
  409. #define __HAL_IRDA_FLUSH_DRREGISTER(__HANDLE__) \
  410. do{ \
  411. SET_BIT((__HANDLE__)->Instance->RQR, IRDA_RXDATA_FLUSH_REQUEST); \
  412. SET_BIT((__HANDLE__)->Instance->RQR, IRDA_TXDATA_FLUSH_REQUEST); \
  413. } while(0)
  414. /** @brief Clear the specified IRDA pending flag.
  415. * @param __HANDLE__ specifies the IRDA Handle.
  416. * @param __FLAG__ specifies the flag to check.
  417. * This parameter can be any combination of the following values:
  418. * @arg @ref IRDA_CLEAR_PEF
  419. * @arg @ref IRDA_CLEAR_FEF
  420. * @arg @ref IRDA_CLEAR_NEF
  421. * @arg @ref IRDA_CLEAR_OREF
  422. * @arg @ref IRDA_CLEAR_TCF
  423. * @arg @ref IRDA_CLEAR_IDLEF
  424. * @retval None
  425. */
  426. #define __HAL_IRDA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
  427. /** @brief Clear the IRDA PE pending flag.
  428. * @param __HANDLE__ specifies the IRDA Handle.
  429. * @retval None
  430. */
  431. #define __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_PEF)
  432. /** @brief Clear the IRDA FE pending flag.
  433. * @param __HANDLE__ specifies the IRDA Handle.
  434. * @retval None
  435. */
  436. #define __HAL_IRDA_CLEAR_FEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_FEF)
  437. /** @brief Clear the IRDA NE pending flag.
  438. * @param __HANDLE__ specifies the IRDA Handle.
  439. * @retval None
  440. */
  441. #define __HAL_IRDA_CLEAR_NEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_NEF)
  442. /** @brief Clear the IRDA ORE pending flag.
  443. * @param __HANDLE__ specifies the IRDA Handle.
  444. * @retval None
  445. */
  446. #define __HAL_IRDA_CLEAR_OREFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_OREF)
  447. /** @brief Clear the IRDA IDLE pending flag.
  448. * @param __HANDLE__ specifies the IRDA Handle.
  449. * @retval None
  450. */
  451. #define __HAL_IRDA_CLEAR_IDLEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_IDLEF)
  452. /** @brief Check whether the specified IRDA flag is set or not.
  453. * @param __HANDLE__ specifies the IRDA Handle.
  454. * @param __FLAG__ specifies the flag to check.
  455. * This parameter can be one of the following values:
  456. * @arg @ref IRDA_FLAG_REACK Receive enable acknowledge flag
  457. * @arg @ref IRDA_FLAG_TEACK Transmit enable acknowledge flag
  458. * @arg @ref IRDA_FLAG_BUSY Busy flag
  459. * @arg @ref IRDA_FLAG_ABRF Auto Baud rate detection flag
  460. * @arg @ref IRDA_FLAG_ABRE Auto Baud rate detection error flag
  461. * @arg @ref IRDA_FLAG_TXE Transmit data register empty flag
  462. * @arg @ref IRDA_FLAG_TC Transmission Complete flag
  463. * @arg @ref IRDA_FLAG_RXNE Receive data register not empty flag
  464. * @arg @ref IRDA_FLAG_ORE OverRun Error flag
  465. * @arg @ref IRDA_FLAG_NE Noise Error flag
  466. * @arg @ref IRDA_FLAG_FE Framing Error flag
  467. * @arg @ref IRDA_FLAG_PE Parity Error flag
  468. * @retval The new state of __FLAG__ (TRUE or FALSE).
  469. */
  470. #define __HAL_IRDA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
  471. /** @brief Enable the specified IRDA interrupt.
  472. * @param __HANDLE__ specifies the IRDA Handle.
  473. * @param __INTERRUPT__ specifies the IRDA interrupt source to enable.
  474. * This parameter can be one of the following values:
  475. * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt
  476. * @arg @ref IRDA_IT_TC Transmission complete interrupt
  477. * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
  478. * @arg @ref IRDA_IT_IDLE Idle line detection interrupt
  479. * @arg @ref IRDA_IT_PE Parity Error interrupt
  480. * @arg @ref IRDA_IT_ERR Error interrupt(Frame error, noise error, overrun error)
  481. * @retval None
  482. */
  483. #define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
  484. ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
  485. ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))))
  486. /** @brief Disable the specified IRDA interrupt.
  487. * @param __HANDLE__ specifies the IRDA Handle.
  488. * @param __INTERRUPT__ specifies the IRDA interrupt source to disable.
  489. * This parameter can be one of the following values:
  490. * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt
  491. * @arg @ref IRDA_IT_TC Transmission complete interrupt
  492. * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
  493. * @arg @ref IRDA_IT_IDLE Idle line detection interrupt
  494. * @arg @ref IRDA_IT_PE Parity Error interrupt
  495. * @arg @ref IRDA_IT_ERR Error interrupt(Frame error, noise error, overrun error)
  496. * @retval None
  497. */
  498. #define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
  499. ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
  500. ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))))
  501. /** @brief Check whether the specified IRDA interrupt has occurred or not.
  502. * @param __HANDLE__ specifies the IRDA Handle.
  503. * @param __INTERRUPT__ specifies the IRDA interrupt source to check.
  504. * This parameter can be one of the following values:
  505. * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt
  506. * @arg @ref IRDA_IT_TC Transmission complete interrupt
  507. * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
  508. * @arg @ref IRDA_IT_IDLE Idle line detection interrupt
  509. * @arg @ref IRDA_IT_ORE OverRun Error interrupt
  510. * @arg @ref IRDA_IT_NE Noise Error interrupt
  511. * @arg @ref IRDA_IT_FE Framing Error interrupt
  512. * @arg @ref IRDA_IT_PE Parity Error interrupt
  513. * @retval The new state of __IT__ (SET or RESET).
  514. */
  515. #define __HAL_IRDA_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR & (0x01U << ((__INTERRUPT__)>> 0x08U))) != RESET) ? SET : RESET)
  516. /** @brief Check whether the specified IRDA interrupt source is enabled or not.
  517. * @param __HANDLE__ specifies the IRDA Handle.
  518. * @param __INTERRUPT__ specifies the IRDA interrupt source to check.
  519. * This parameter can be one of the following values:
  520. * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt
  521. * @arg @ref IRDA_IT_TC Transmission complete interrupt
  522. * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt
  523. * @arg @ref IRDA_IT_IDLE Idle line detection interrupt
  524. * @arg @ref IRDA_IT_ERR Framing, overrun or noise error interrupt
  525. * @arg @ref IRDA_IT_PE Parity Error interrupt
  526. * @retval The new state of __IT__ (SET or RESET).
  527. */
  528. #define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 0x05U) == 0x01U)? (__HANDLE__)->Instance->CR1 : \
  529. (((((uint8_t)(__INTERRUPT__)) >> 0x05U) == 0x02U)? (__HANDLE__)->Instance->CR2 : \
  530. (__HANDLE__)->Instance->CR3)) & (0x01U << (((uint16_t)(__INTERRUPT__)) & IRDA_IT_MASK))) != RESET) ? SET : RESET)
  531. /** @brief Clear the specified IRDA ISR flag, in setting the proper ICR register flag.
  532. * @param __HANDLE__ specifies the IRDA Handle.
  533. * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
  534. * to clear the corresponding interrupt
  535. * This parameter can be one of the following values:
  536. * @arg @ref IRDA_CLEAR_PEF Parity Error Clear Flag
  537. * @arg @ref IRDA_CLEAR_FEF Framing Error Clear Flag
  538. * @arg @ref IRDA_CLEAR_NEF Noise detected Clear Flag
  539. * @arg @ref IRDA_CLEAR_OREF OverRun Error Clear Flag
  540. * @arg @ref IRDA_CLEAR_TCF Transmission Complete Clear Flag
  541. * @retval None
  542. */
  543. #define __HAL_IRDA_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
  544. /** @brief Set a specific IRDA request flag.
  545. * @param __HANDLE__ specifies the IRDA Handle.
  546. * @param __REQ__ specifies the request flag to set
  547. * This parameter can be one of the following values:
  548. * @arg @ref IRDA_AUTOBAUD_REQUEST Auto-Baud Rate Request
  549. * @arg @ref IRDA_RXDATA_FLUSH_REQUEST Receive Data flush Request
  550. * @arg @ref IRDA_TXDATA_FLUSH_REQUEST Transmit data flush Request
  551. *
  552. * @retval None
  553. */
  554. #define __HAL_IRDA_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
  555. /** @brief Enable the IRDA one bit sample method.
  556. * @param __HANDLE__ specifies the IRDA Handle.
  557. * @retval None
  558. */
  559. #define __HAL_IRDA_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
  560. /** @brief Disable the IRDA one bit sample method.
  561. * @param __HANDLE__ specifies the IRDA Handle.
  562. * @retval None
  563. */
  564. #define __HAL_IRDA_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT))
  565. /** @brief Enable UART/USART associated to IRDA Handle.
  566. * @param __HANDLE__ specifies the IRDA Handle.
  567. * @retval None
  568. */
  569. #define __HAL_IRDA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
  570. /** @brief Disable UART/USART associated to IRDA Handle.
  571. * @param __HANDLE__ specifies the IRDA Handle.
  572. * @retval None
  573. */
  574. #define __HAL_IRDA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
  575. /**
  576. * @}
  577. */
  578. /* Private macros --------------------------------------------------------*/
  579. /** @defgroup IRDA_Private_Macros IRDA Private Macros
  580. * @{
  581. */
  582. /** @brief Compute the mask to apply to retrieve the received data
  583. * according to the word length and to the parity bits activation.
  584. * @param __HANDLE__ specifies the IRDA Handle.
  585. * @retval None, the mask to apply to the associated UART RDR register is stored in (__HANDLE__)->Mask field.
  586. */
  587. #define IRDA_MASK_COMPUTATION(__HANDLE__) \
  588. do { \
  589. if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
  590. { \
  591. if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
  592. { \
  593. (__HANDLE__)->Mask = 0x01FF ; \
  594. } \
  595. else \
  596. { \
  597. (__HANDLE__)->Mask = 0x00FF ; \
  598. } \
  599. } \
  600. else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
  601. { \
  602. if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
  603. { \
  604. (__HANDLE__)->Mask = 0x00FF ; \
  605. } \
  606. else \
  607. { \
  608. (__HANDLE__)->Mask = 0x007F ; \
  609. } \
  610. } \
  611. else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \
  612. { \
  613. if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
  614. { \
  615. (__HANDLE__)->Mask = 0x007F ; \
  616. } \
  617. else \
  618. { \
  619. (__HANDLE__)->Mask = 0x003F ; \
  620. } \
  621. } \
  622. } while(0)
  623. /** @brief Ensure that IRDA Baud rate is less or equal to maximum value.
  624. * @param __BAUDRATE__ specifies the IRDA Baudrate set by the user.
  625. * @retval True or False
  626. */
  627. #define IS_IRDA_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 115201)
  628. /** @brief Ensure that IRDA prescaler value is strictly larger than 0.
  629. * @param __PRESCALER__ specifies the IRDA prescaler value set by the user.
  630. * @retval True or False
  631. */
  632. #define IS_IRDA_PRESCALER(__PRESCALER__) ((__PRESCALER__) > 0)
  633. /**
  634. * @brief Ensure that IRDA frame length is valid.
  635. * @param __LENGTH__ IRDA frame length.
  636. * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
  637. */
  638. #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \
  639. ((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
  640. ((__LENGTH__) == IRDA_WORDLENGTH_9B))
  641. /**
  642. * @brief Ensure that IRDA frame parity is valid.
  643. * @param __PARITY__ IRDA frame parity.
  644. * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid)
  645. */
  646. #define IS_IRDA_PARITY(__PARITY__) (((__PARITY__) == IRDA_PARITY_NONE) || \
  647. ((__PARITY__) == IRDA_PARITY_EVEN) || \
  648. ((__PARITY__) == IRDA_PARITY_ODD))
  649. /**
  650. * @brief Ensure that IRDA communication mode is valid.
  651. * @param __MODE__ IRDA communication mode.
  652. * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
  653. */
  654. #define IS_IRDA_TX_RX_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(IRDA_MODE_TX_RX)))) == (uint32_t)0x00) && ((__MODE__) != (uint32_t)0x00))
  655. /**
  656. * @brief Ensure that IRDA power mode is valid.
  657. * @param __MODE__ IRDA power mode.
  658. * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
  659. */
  660. #define IS_IRDA_POWERMODE(__MODE__) (((__MODE__) == IRDA_POWERMODE_LOWPOWER) || \
  661. ((__MODE__) == IRDA_POWERMODE_NORMAL))
  662. #if defined(USART_PRESC_PRESCALER)
  663. /**
  664. * @brief Ensure that IRDA clock Prescaler is valid.
  665. * @param __CLOCKPRESCALER__ IRDA clock Prescaler value.
  666. * @retval SET (__CLOCKPRESCALER__ is valid) or RESET (__CLOCKPRESCALER__ is invalid)
  667. */
  668. #define IS_IRDA_CLOCKPRESCALER(__CLOCKPRESCALER__) (((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV1) || \
  669. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV2) || \
  670. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV4) || \
  671. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV6) || \
  672. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV8) || \
  673. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV10) || \
  674. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV12) || \
  675. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV16) || \
  676. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV32) || \
  677. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV64) || \
  678. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV128) || \
  679. ((__CLOCKPRESCALER__) == IRDA_PRESCALER_DIV256))
  680. #endif
  681. /**
  682. * @brief Ensure that IRDA state is valid.
  683. * @param __STATE__ IRDA state mode.
  684. * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid)
  685. */
  686. #define IS_IRDA_STATE(__STATE__) (((__STATE__) == IRDA_STATE_DISABLE) || \
  687. ((__STATE__) == IRDA_STATE_ENABLE))
  688. /**
  689. * @brief Ensure that IRDA associated UART/USART mode is valid.
  690. * @param __MODE__: IRDA associated UART/USART mode.
  691. * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
  692. */
  693. #define IS_IRDA_MODE(__MODE__) (((__MODE__) == IRDA_MODE_DISABLE) || \
  694. ((__MODE__) == IRDA_MODE_ENABLE))
  695. /**
  696. * @brief Ensure that IRDA sampling rate is valid.
  697. * @param __ONEBIT__ IRDA sampling rate.
  698. * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid)
  699. */
  700. #define IS_IRDA_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == IRDA_ONE_BIT_SAMPLE_DISABLE) || \
  701. ((__ONEBIT__) == IRDA_ONE_BIT_SAMPLE_ENABLE))
  702. /**
  703. * @brief Ensure that IRDA DMA TX mode is valid.
  704. * @param __DMATX__ IRDA DMA TX mode.
  705. * @retval SET (__DMATX__ is valid) or RESET (__DMATX__ is invalid)
  706. */
  707. #define IS_IRDA_DMA_TX(__DMATX__) (((__DMATX__) == IRDA_DMA_TX_DISABLE) || \
  708. ((__DMATX__) == IRDA_DMA_TX_ENABLE))
  709. /**
  710. * @brief Ensure that IRDA DMA RX mode is valid.
  711. * @param __DMARX__ IRDA DMA RX mode.
  712. * @retval SET (__DMARX__ is valid) or RESET (__DMARX__ is invalid)
  713. */
  714. #define IS_IRDA_DMA_RX(__DMARX__) (((__DMARX__) == IRDA_DMA_RX_DISABLE) || \
  715. ((__DMARX__) == IRDA_DMA_RX_ENABLE))
  716. /**
  717. * @brief Ensure that IRDA request is valid.
  718. * @param __PARAM__ IRDA request.
  719. * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid)
  720. */
  721. #define IS_IRDA_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == IRDA_AUTOBAUD_REQUEST) || \
  722. ((__PARAM__) == IRDA_RXDATA_FLUSH_REQUEST) || \
  723. ((__PARAM__) == IRDA_TXDATA_FLUSH_REQUEST))
  724. /**
  725. * @}
  726. */
  727. /* Include IRDA HAL Extended module */
  728. #include "stm32l4xx_hal_irda_ex.h"
  729. /* Exported functions --------------------------------------------------------*/
  730. /** @addtogroup IRDA_Exported_Functions IRDA Exported Functions
  731. * @{
  732. */
  733. /** @addtogroup IRDA_Exported_Functions_Group1 Initialization and de-initialization functions
  734. * @{
  735. */
  736. /* Initialization and de-initialization functions ****************************/
  737. HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda);
  738. HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda);
  739. void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda);
  740. void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda);
  741. /**
  742. * @}
  743. */
  744. /** @addtogroup IRDA_Exported_Functions_Group2 IO operation functions
  745. * @{
  746. */
  747. /* IO operation functions *****************************************************/
  748. HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout);
  749. HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout);
  750. HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
  751. HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
  752. HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
  753. HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size);
  754. HAL_StatusTypeDef HAL_IRDA_DMAPause(IRDA_HandleTypeDef *hirda);
  755. HAL_StatusTypeDef HAL_IRDA_DMAResume(IRDA_HandleTypeDef *hirda);
  756. HAL_StatusTypeDef HAL_IRDA_DMAStop(IRDA_HandleTypeDef *hirda);
  757. /* Transfer Abort functions */
  758. HAL_StatusTypeDef HAL_IRDA_Abort(IRDA_HandleTypeDef *hirda);
  759. HAL_StatusTypeDef HAL_IRDA_AbortTransmit(IRDA_HandleTypeDef *hirda);
  760. HAL_StatusTypeDef HAL_IRDA_AbortReceive(IRDA_HandleTypeDef *hirda);
  761. HAL_StatusTypeDef HAL_IRDA_Abort_IT(IRDA_HandleTypeDef *hirda);
  762. HAL_StatusTypeDef HAL_IRDA_AbortTransmit_IT(IRDA_HandleTypeDef *hirda);
  763. HAL_StatusTypeDef HAL_IRDA_AbortReceive_IT(IRDA_HandleTypeDef *hirda);
  764. void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda);
  765. void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda);
  766. void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda);
  767. void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda);
  768. void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda);
  769. void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda);
  770. void HAL_IRDA_AbortCpltCallback (IRDA_HandleTypeDef *hirda);
  771. void HAL_IRDA_AbortTransmitCpltCallback (IRDA_HandleTypeDef *hirda);
  772. void HAL_IRDA_AbortReceiveCpltCallback (IRDA_HandleTypeDef *hirda);
  773. /**
  774. * @}
  775. */
  776. /* Peripheral Control functions ************************************************/
  777. /** @addtogroup IRDA_Exported_Functions_Group4 Peripheral State and Error functions
  778. * @{
  779. */
  780. /* Peripheral State and Error functions ***************************************/
  781. HAL_IRDA_StateTypeDef HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda);
  782. uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda);
  783. /**
  784. * @}
  785. */
  786. /**
  787. * @}
  788. */
  789. /**
  790. * @}
  791. */
  792. /**
  793. * @}
  794. */
  795. #ifdef __cplusplus
  796. }
  797. #endif
  798. #endif /* __STM32L4xx_HAL_IRDA_H */
  799. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/