my fork
Fork of mbed by
TARGET_NUCLEO_F302R8/stm32f3xx_hal_irda.h@90:cb3d968589d8, 2014-10-28 (annotated)
- Committer:
- Kojto
- Date:
- Tue Oct 28 16:40:41 2014 +0000
- Revision:
- 90:cb3d968589d8
Release 90 of the mbed library
Changes:
- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 90:cb3d968589d8 | 1 | /** |
Kojto | 90:cb3d968589d8 | 2 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 3 | * @file stm32f3xx_hal_irda.h |
Kojto | 90:cb3d968589d8 | 4 | * @author MCD Application Team |
Kojto | 90:cb3d968589d8 | 5 | * @version V1.1.0 |
Kojto | 90:cb3d968589d8 | 6 | * @date 12-Sept-2014 |
Kojto | 90:cb3d968589d8 | 7 | * @brief Header file of IRDA HAL module. |
Kojto | 90:cb3d968589d8 | 8 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 9 | * @attention |
Kojto | 90:cb3d968589d8 | 10 | * |
Kojto | 90:cb3d968589d8 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 90:cb3d968589d8 | 12 | * |
Kojto | 90:cb3d968589d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 90:cb3d968589d8 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 90:cb3d968589d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 90:cb3d968589d8 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 90:cb3d968589d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 90:cb3d968589d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 90:cb3d968589d8 | 19 | * and/or other materials provided with the distribution. |
Kojto | 90:cb3d968589d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 90:cb3d968589d8 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 90:cb3d968589d8 | 22 | * without specific prior written permission. |
Kojto | 90:cb3d968589d8 | 23 | * |
Kojto | 90:cb3d968589d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 90:cb3d968589d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 90:cb3d968589d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 90:cb3d968589d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 90:cb3d968589d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 90:cb3d968589d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 90:cb3d968589d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 90:cb3d968589d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 90:cb3d968589d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 90:cb3d968589d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 90:cb3d968589d8 | 34 | * |
Kojto | 90:cb3d968589d8 | 35 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 36 | */ |
Kojto | 90:cb3d968589d8 | 37 | |
Kojto | 90:cb3d968589d8 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 39 | #ifndef __STM32F3xx_HAL_IRDA_H |
Kojto | 90:cb3d968589d8 | 40 | #define __STM32F3xx_HAL_IRDA_H |
Kojto | 90:cb3d968589d8 | 41 | |
Kojto | 90:cb3d968589d8 | 42 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 43 | extern "C" { |
Kojto | 90:cb3d968589d8 | 44 | #endif |
Kojto | 90:cb3d968589d8 | 45 | |
Kojto | 90:cb3d968589d8 | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 47 | #include "stm32f3xx_hal_def.h" |
Kojto | 90:cb3d968589d8 | 48 | |
Kojto | 90:cb3d968589d8 | 49 | /** @addtogroup STM32F3xx_HAL_Driver |
Kojto | 90:cb3d968589d8 | 50 | * @{ |
Kojto | 90:cb3d968589d8 | 51 | */ |
Kojto | 90:cb3d968589d8 | 52 | |
Kojto | 90:cb3d968589d8 | 53 | /** @addtogroup IRDA IRDA HAL module driver |
Kojto | 90:cb3d968589d8 | 54 | * @{ |
Kojto | 90:cb3d968589d8 | 55 | */ |
Kojto | 90:cb3d968589d8 | 56 | |
Kojto | 90:cb3d968589d8 | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 58 | /** @defgroup IRDA_Exported_Types IRDA Exported Types |
Kojto | 90:cb3d968589d8 | 59 | * @{ |
Kojto | 90:cb3d968589d8 | 60 | */ |
Kojto | 90:cb3d968589d8 | 61 | |
Kojto | 90:cb3d968589d8 | 62 | /** |
Kojto | 90:cb3d968589d8 | 63 | * @brief IRDA Init Structure definition |
Kojto | 90:cb3d968589d8 | 64 | */ |
Kojto | 90:cb3d968589d8 | 65 | typedef struct |
Kojto | 90:cb3d968589d8 | 66 | { |
Kojto | 90:cb3d968589d8 | 67 | uint32_t BaudRate; /*!< This member configures the IRDA communication baud rate. |
Kojto | 90:cb3d968589d8 | 68 | The baud rate register is computed using the following formula: |
Kojto | 90:cb3d968589d8 | 69 | Baud Rate Register = ((PCLKx) / ((hirda->Init.BaudRate))) */ |
Kojto | 90:cb3d968589d8 | 70 | |
Kojto | 90:cb3d968589d8 | 71 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
Kojto | 90:cb3d968589d8 | 72 | This parameter can be a value of @ref IRDAEx_Word_Length */ |
Kojto | 90:cb3d968589d8 | 73 | |
Kojto | 90:cb3d968589d8 | 74 | uint16_t Parity; /*!< Specifies the parity mode. |
Kojto | 90:cb3d968589d8 | 75 | This parameter can be a value of @ref IRDA_Parity |
Kojto | 90:cb3d968589d8 | 76 | @note When parity is enabled, the computed parity is inserted |
Kojto | 90:cb3d968589d8 | 77 | at the MSB position of the transmitted data (9th bit when |
Kojto | 90:cb3d968589d8 | 78 | the word length is set to 9 data bits; 8th bit when the |
Kojto | 90:cb3d968589d8 | 79 | word length is set to 8 data bits). */ |
Kojto | 90:cb3d968589d8 | 80 | |
Kojto | 90:cb3d968589d8 | 81 | uint16_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
Kojto | 90:cb3d968589d8 | 82 | This parameter can be a value of @ref IRDA_Mode */ |
Kojto | 90:cb3d968589d8 | 83 | |
Kojto | 90:cb3d968589d8 | 84 | uint8_t Prescaler; /*!< Specifies the Prescaler value for dividing the UART/USART source clock |
Kojto | 90:cb3d968589d8 | 85 | to achieve low-power frequency. |
Kojto | 90:cb3d968589d8 | 86 | @note Prescaler value 0 is forbidden */ |
Kojto | 90:cb3d968589d8 | 87 | |
Kojto | 90:cb3d968589d8 | 88 | uint16_t PowerMode; /*!< Specifies the IRDA power mode. |
Kojto | 90:cb3d968589d8 | 89 | This parameter can be a value of @ref IRDA_Low_Power */ |
Kojto | 90:cb3d968589d8 | 90 | }IRDA_InitTypeDef; |
Kojto | 90:cb3d968589d8 | 91 | |
Kojto | 90:cb3d968589d8 | 92 | /** |
Kojto | 90:cb3d968589d8 | 93 | * @brief HAL IRDA State structures definition |
Kojto | 90:cb3d968589d8 | 94 | */ |
Kojto | 90:cb3d968589d8 | 95 | typedef enum |
Kojto | 90:cb3d968589d8 | 96 | { |
Kojto | 90:cb3d968589d8 | 97 | HAL_IRDA_STATE_RESET = 0x00, /*!< Peripheral is not initialized */ |
Kojto | 90:cb3d968589d8 | 98 | HAL_IRDA_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 90:cb3d968589d8 | 99 | HAL_IRDA_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 90:cb3d968589d8 | 100 | HAL_IRDA_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 90:cb3d968589d8 | 101 | HAL_IRDA_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 90:cb3d968589d8 | 102 | HAL_IRDA_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */ |
Kojto | 90:cb3d968589d8 | 103 | HAL_IRDA_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 90:cb3d968589d8 | 104 | HAL_IRDA_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 90:cb3d968589d8 | 105 | }HAL_IRDA_StateTypeDef; |
Kojto | 90:cb3d968589d8 | 106 | |
Kojto | 90:cb3d968589d8 | 107 | /** |
Kojto | 90:cb3d968589d8 | 108 | * @brief HAL IRDA Error Code structure definition |
Kojto | 90:cb3d968589d8 | 109 | */ |
Kojto | 90:cb3d968589d8 | 110 | typedef enum |
Kojto | 90:cb3d968589d8 | 111 | { |
Kojto | 90:cb3d968589d8 | 112 | HAL_IRDA_ERROR_NONE = 0x00, /*!< No error */ |
Kojto | 90:cb3d968589d8 | 113 | HAL_IRDA_ERROR_PE = 0x01, /*!< Parity error */ |
Kojto | 90:cb3d968589d8 | 114 | HAL_IRDA_ERROR_NE = 0x02, /*!< Noise error */ |
Kojto | 90:cb3d968589d8 | 115 | HAL_IRDA_ERROR_FE = 0x04, /*!< frame error */ |
Kojto | 90:cb3d968589d8 | 116 | HAL_IRDA_ERROR_ORE = 0x08, /*!< Overrun error */ |
Kojto | 90:cb3d968589d8 | 117 | HAL_IRDA_ERROR_DMA = 0x10 /*!< DMA transfer error */ |
Kojto | 90:cb3d968589d8 | 118 | }HAL_IRDA_ErrorTypeDef; |
Kojto | 90:cb3d968589d8 | 119 | |
Kojto | 90:cb3d968589d8 | 120 | /** |
Kojto | 90:cb3d968589d8 | 121 | * @brief IRDA clock sources definition |
Kojto | 90:cb3d968589d8 | 122 | */ |
Kojto | 90:cb3d968589d8 | 123 | typedef enum |
Kojto | 90:cb3d968589d8 | 124 | { |
Kojto | 90:cb3d968589d8 | 125 | IRDA_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
Kojto | 90:cb3d968589d8 | 126 | IRDA_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */ |
Kojto | 90:cb3d968589d8 | 127 | IRDA_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
Kojto | 90:cb3d968589d8 | 128 | IRDA_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
Kojto | 90:cb3d968589d8 | 129 | IRDA_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */ |
Kojto | 90:cb3d968589d8 | 130 | IRDA_CLOCKSOURCE_UNDEFINED = 0x10 /*!< Undefined clock source */ |
Kojto | 90:cb3d968589d8 | 131 | }IRDA_ClockSourceTypeDef; |
Kojto | 90:cb3d968589d8 | 132 | |
Kojto | 90:cb3d968589d8 | 133 | /** |
Kojto | 90:cb3d968589d8 | 134 | * @brief IRDA handle Structure definition |
Kojto | 90:cb3d968589d8 | 135 | */ |
Kojto | 90:cb3d968589d8 | 136 | typedef struct |
Kojto | 90:cb3d968589d8 | 137 | { |
Kojto | 90:cb3d968589d8 | 138 | USART_TypeDef *Instance; /* USART registers base address */ |
Kojto | 90:cb3d968589d8 | 139 | |
Kojto | 90:cb3d968589d8 | 140 | IRDA_InitTypeDef Init; /* IRDA communication parameters */ |
Kojto | 90:cb3d968589d8 | 141 | |
Kojto | 90:cb3d968589d8 | 142 | uint8_t *pTxBuffPtr; /* Pointer to IRDA Tx transfer Buffer */ |
Kojto | 90:cb3d968589d8 | 143 | |
Kojto | 90:cb3d968589d8 | 144 | uint16_t TxXferSize; /* IRDA Tx Transfer size */ |
Kojto | 90:cb3d968589d8 | 145 | |
Kojto | 90:cb3d968589d8 | 146 | uint16_t TxXferCount; /* IRDA Tx Transfer Counter */ |
Kojto | 90:cb3d968589d8 | 147 | |
Kojto | 90:cb3d968589d8 | 148 | uint8_t *pRxBuffPtr; /* Pointer to IRDA Rx transfer Buffer */ |
Kojto | 90:cb3d968589d8 | 149 | |
Kojto | 90:cb3d968589d8 | 150 | uint16_t RxXferSize; /* IRDA Rx Transfer size */ |
Kojto | 90:cb3d968589d8 | 151 | |
Kojto | 90:cb3d968589d8 | 152 | uint16_t RxXferCount; /* IRDA Rx Transfer Counter */ |
Kojto | 90:cb3d968589d8 | 153 | |
Kojto | 90:cb3d968589d8 | 154 | uint16_t Mask; /* USART RX RDR register mask */ |
Kojto | 90:cb3d968589d8 | 155 | |
Kojto | 90:cb3d968589d8 | 156 | DMA_HandleTypeDef *hdmatx; /* IRDA Tx DMA Handle parameters */ |
Kojto | 90:cb3d968589d8 | 157 | |
Kojto | 90:cb3d968589d8 | 158 | DMA_HandleTypeDef *hdmarx; /* IRDA Rx DMA Handle parameters */ |
Kojto | 90:cb3d968589d8 | 159 | |
Kojto | 90:cb3d968589d8 | 160 | HAL_LockTypeDef Lock; /* Locking object */ |
Kojto | 90:cb3d968589d8 | 161 | |
Kojto | 90:cb3d968589d8 | 162 | HAL_IRDA_StateTypeDef State; /* IRDA communication state */ |
Kojto | 90:cb3d968589d8 | 163 | |
Kojto | 90:cb3d968589d8 | 164 | HAL_IRDA_ErrorTypeDef ErrorCode; /* IRDA Error code */ |
Kojto | 90:cb3d968589d8 | 165 | |
Kojto | 90:cb3d968589d8 | 166 | }IRDA_HandleTypeDef; |
Kojto | 90:cb3d968589d8 | 167 | |
Kojto | 90:cb3d968589d8 | 168 | /** |
Kojto | 90:cb3d968589d8 | 169 | * @brief IRDA Configuration enumeration values definition |
Kojto | 90:cb3d968589d8 | 170 | */ |
Kojto | 90:cb3d968589d8 | 171 | typedef enum |
Kojto | 90:cb3d968589d8 | 172 | { |
Kojto | 90:cb3d968589d8 | 173 | IRDA_BAUDRATE = 0x00, |
Kojto | 90:cb3d968589d8 | 174 | IRDA_PARITY = 0x01, |
Kojto | 90:cb3d968589d8 | 175 | IRDA_WORDLENGTH = 0x02, |
Kojto | 90:cb3d968589d8 | 176 | IRDA_MODE = 0x03, |
Kojto | 90:cb3d968589d8 | 177 | IRDA_PRESCALER = 0x04, |
Kojto | 90:cb3d968589d8 | 178 | IRDA_POWERMODE = 0x05 |
Kojto | 90:cb3d968589d8 | 179 | }IRDA_ControlTypeDef; |
Kojto | 90:cb3d968589d8 | 180 | |
Kojto | 90:cb3d968589d8 | 181 | /** |
Kojto | 90:cb3d968589d8 | 182 | * @} |
Kojto | 90:cb3d968589d8 | 183 | */ |
Kojto | 90:cb3d968589d8 | 184 | |
Kojto | 90:cb3d968589d8 | 185 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 186 | /** @defgroup IRDA_Exported_Constants IRDA Exported Constants |
Kojto | 90:cb3d968589d8 | 187 | * @{ |
Kojto | 90:cb3d968589d8 | 188 | */ |
Kojto | 90:cb3d968589d8 | 189 | |
Kojto | 90:cb3d968589d8 | 190 | /** @defgroup IRDA_Parity IRDA Parity |
Kojto | 90:cb3d968589d8 | 191 | * @{ |
Kojto | 90:cb3d968589d8 | 192 | */ |
Kojto | 90:cb3d968589d8 | 193 | #define IRDA_PARITY_NONE ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 194 | #define IRDA_PARITY_EVEN ((uint16_t)USART_CR1_PCE) |
Kojto | 90:cb3d968589d8 | 195 | #define IRDA_PARITY_ODD ((uint16_t)(USART_CR1_PCE | USART_CR1_PS)) |
Kojto | 90:cb3d968589d8 | 196 | #define IS_IRDA_PARITY(PARITY) (((PARITY) == IRDA_PARITY_NONE) || \ |
Kojto | 90:cb3d968589d8 | 197 | ((PARITY) == IRDA_PARITY_EVEN) || \ |
Kojto | 90:cb3d968589d8 | 198 | ((PARITY) == IRDA_PARITY_ODD)) |
Kojto | 90:cb3d968589d8 | 199 | /** |
Kojto | 90:cb3d968589d8 | 200 | * @} |
Kojto | 90:cb3d968589d8 | 201 | */ |
Kojto | 90:cb3d968589d8 | 202 | |
Kojto | 90:cb3d968589d8 | 203 | |
Kojto | 90:cb3d968589d8 | 204 | /** @defgroup IRDA_Transfer_Mode IRDA Transfer Mode |
Kojto | 90:cb3d968589d8 | 205 | * @{ |
Kojto | 90:cb3d968589d8 | 206 | */ |
Kojto | 90:cb3d968589d8 | 207 | #define IRDA_MODE_RX ((uint16_t)USART_CR1_RE) |
Kojto | 90:cb3d968589d8 | 208 | #define IRDA_MODE_TX ((uint16_t)USART_CR1_TE) |
Kojto | 90:cb3d968589d8 | 209 | #define IRDA_MODE_TX_RX ((uint16_t)(USART_CR1_TE |USART_CR1_RE)) |
Kojto | 90:cb3d968589d8 | 210 | #define IS_IRDA_TX_RX_MODE(MODE) ((((MODE) & (~((uint16_t)(IRDA_MODE_TX_RX)))) == (uint16_t)0x00) && ((MODE) != (uint16_t)0x00)) |
Kojto | 90:cb3d968589d8 | 211 | /** |
Kojto | 90:cb3d968589d8 | 212 | * @} |
Kojto | 90:cb3d968589d8 | 213 | */ |
Kojto | 90:cb3d968589d8 | 214 | |
Kojto | 90:cb3d968589d8 | 215 | /** @defgroup IRDA_Low_Power IRDA Low Power |
Kojto | 90:cb3d968589d8 | 216 | * @{ |
Kojto | 90:cb3d968589d8 | 217 | */ |
Kojto | 90:cb3d968589d8 | 218 | #define IRDA_POWERMODE_NORMAL ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 219 | #define IRDA_POWERMODE_LOWPOWER ((uint16_t)USART_CR3_IRLP) |
Kojto | 90:cb3d968589d8 | 220 | #define IS_IRDA_POWERMODE(MODE) (((MODE) == IRDA_POWERMODE_LOWPOWER) || \ |
Kojto | 90:cb3d968589d8 | 221 | ((MODE) == IRDA_POWERMODE_NORMAL)) |
Kojto | 90:cb3d968589d8 | 222 | /** |
Kojto | 90:cb3d968589d8 | 223 | * @} |
Kojto | 90:cb3d968589d8 | 224 | */ |
Kojto | 90:cb3d968589d8 | 225 | |
Kojto | 90:cb3d968589d8 | 226 | /** @defgroup IRDA_State IRDA State |
Kojto | 90:cb3d968589d8 | 227 | * @{ |
Kojto | 90:cb3d968589d8 | 228 | */ |
Kojto | 90:cb3d968589d8 | 229 | #define IRDA_STATE_DISABLE ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 230 | #define IRDA_STATE_ENABLE ((uint16_t)USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 231 | #define IS_IRDA_STATE(STATE) (((STATE) == IRDA_STATE_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 232 | ((STATE) == IRDA_STATE_ENABLE)) |
Kojto | 90:cb3d968589d8 | 233 | /** |
Kojto | 90:cb3d968589d8 | 234 | * @} |
Kojto | 90:cb3d968589d8 | 235 | */ |
Kojto | 90:cb3d968589d8 | 236 | |
Kojto | 90:cb3d968589d8 | 237 | /** @defgroup IRDA_Mode IRDA Mode |
Kojto | 90:cb3d968589d8 | 238 | * @{ |
Kojto | 90:cb3d968589d8 | 239 | */ |
Kojto | 90:cb3d968589d8 | 240 | #define IRDA_MODE_DISABLE ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 241 | #define IRDA_MODE_ENABLE ((uint16_t)USART_CR3_IREN) |
Kojto | 90:cb3d968589d8 | 242 | #define IS_IRDA_MODE(STATE) (((STATE) == IRDA_MODE_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 243 | ((STATE) == IRDA_MODE_ENABLE)) |
Kojto | 90:cb3d968589d8 | 244 | /** |
Kojto | 90:cb3d968589d8 | 245 | * @} |
Kojto | 90:cb3d968589d8 | 246 | */ |
Kojto | 90:cb3d968589d8 | 247 | |
Kojto | 90:cb3d968589d8 | 248 | /** @defgroup IRDA_One_Bit IRDA One Bit Sampling |
Kojto | 90:cb3d968589d8 | 249 | * @{ |
Kojto | 90:cb3d968589d8 | 250 | */ |
Kojto | 90:cb3d968589d8 | 251 | #define IRDA_ONE_BIT_SAMPLE_DISABLED ((uint16_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 252 | #define IRDA_ONE_BIT_SAMPLE_ENABLED ((uint16_t)USART_CR3_ONEBIT) |
Kojto | 90:cb3d968589d8 | 253 | #define IS_IRDA_ONEBIT_SAMPLE(ONEBIT) (((ONEBIT) == IRDA_ONE_BIT_SAMPLE_DISABLED) || \ |
Kojto | 90:cb3d968589d8 | 254 | ((ONEBIT) == IRDA_ONE_BIT_SAMPLE_ENABLED)) |
Kojto | 90:cb3d968589d8 | 255 | /** |
Kojto | 90:cb3d968589d8 | 256 | * @} |
Kojto | 90:cb3d968589d8 | 257 | */ |
Kojto | 90:cb3d968589d8 | 258 | |
Kojto | 90:cb3d968589d8 | 259 | /** @defgroup IRDA_DMA_Tx IRDA DMA Tx |
Kojto | 90:cb3d968589d8 | 260 | * @{ |
Kojto | 90:cb3d968589d8 | 261 | */ |
Kojto | 90:cb3d968589d8 | 262 | #define IRDA_DMA_TX_DISABLE ((uint16_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 263 | #define IRDA_DMA_TX_ENABLE ((uint16_t)USART_CR3_DMAT) |
Kojto | 90:cb3d968589d8 | 264 | #define IS_IRDA_DMA_TX(DMATX) (((DMATX) == IRDA_DMA_TX_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 265 | ((DMATX) == IRDA_DMA_TX_ENABLE)) |
Kojto | 90:cb3d968589d8 | 266 | /** |
Kojto | 90:cb3d968589d8 | 267 | * @} |
Kojto | 90:cb3d968589d8 | 268 | */ |
Kojto | 90:cb3d968589d8 | 269 | |
Kojto | 90:cb3d968589d8 | 270 | /** @defgroup IRDA_DMA_Rx IRDA DMA Rx |
Kojto | 90:cb3d968589d8 | 271 | * @{ |
Kojto | 90:cb3d968589d8 | 272 | */ |
Kojto | 90:cb3d968589d8 | 273 | #define IRDA_DMA_RX_DISABLE ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 274 | #define IRDA_DMA_RX_ENABLE ((uint16_t)USART_CR3_DMAR) |
Kojto | 90:cb3d968589d8 | 275 | #define IS_IRDA_DMA_RX(DMARX) (((DMARX) == IRDA_DMA_RX_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 276 | ((DMARX) == IRDA_DMA_RX_ENABLE)) |
Kojto | 90:cb3d968589d8 | 277 | /** |
Kojto | 90:cb3d968589d8 | 278 | * @} |
Kojto | 90:cb3d968589d8 | 279 | */ |
Kojto | 90:cb3d968589d8 | 280 | |
Kojto | 90:cb3d968589d8 | 281 | /** @defgroup IRDA_Flags IRDA Flags |
Kojto | 90:cb3d968589d8 | 282 | * Elements values convention: 0xXXXX |
Kojto | 90:cb3d968589d8 | 283 | * - 0xXXXX : Flag mask in the ISR register |
Kojto | 90:cb3d968589d8 | 284 | * @{ |
Kojto | 90:cb3d968589d8 | 285 | */ |
Kojto | 90:cb3d968589d8 | 286 | #define IRDA_FLAG_REACK ((uint32_t)0x00400000) |
Kojto | 90:cb3d968589d8 | 287 | #define IRDA_FLAG_TEACK ((uint32_t)0x00200000) |
Kojto | 90:cb3d968589d8 | 288 | #define IRDA_FLAG_BUSY ((uint32_t)0x00010000) |
Kojto | 90:cb3d968589d8 | 289 | #define IRDA_FLAG_ABRF ((uint32_t)0x00008000) |
Kojto | 90:cb3d968589d8 | 290 | #define IRDA_FLAG_ABRE ((uint32_t)0x00004000) |
Kojto | 90:cb3d968589d8 | 291 | #define IRDA_FLAG_TXE ((uint32_t)0x00000080) |
Kojto | 90:cb3d968589d8 | 292 | #define IRDA_FLAG_TC ((uint32_t)0x00000040) |
Kojto | 90:cb3d968589d8 | 293 | #define IRDA_FLAG_RXNE ((uint32_t)0x00000020) |
Kojto | 90:cb3d968589d8 | 294 | #define IRDA_FLAG_ORE ((uint32_t)0x00000008) |
Kojto | 90:cb3d968589d8 | 295 | #define IRDA_FLAG_NE ((uint32_t)0x00000004) |
Kojto | 90:cb3d968589d8 | 296 | #define IRDA_FLAG_FE ((uint32_t)0x00000002) |
Kojto | 90:cb3d968589d8 | 297 | #define IRDA_FLAG_PE ((uint32_t)0x00000001) |
Kojto | 90:cb3d968589d8 | 298 | /** |
Kojto | 90:cb3d968589d8 | 299 | * @} |
Kojto | 90:cb3d968589d8 | 300 | */ |
Kojto | 90:cb3d968589d8 | 301 | |
Kojto | 90:cb3d968589d8 | 302 | /** @defgroup IRDA_Interrupt_definition IRDA Interrupts Definition |
Kojto | 90:cb3d968589d8 | 303 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
Kojto | 90:cb3d968589d8 | 304 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 90:cb3d968589d8 | 305 | * - XX : Interrupt source register (2bits) |
Kojto | 90:cb3d968589d8 | 306 | * - 01: CR1 register |
Kojto | 90:cb3d968589d8 | 307 | * - 10: CR2 register |
Kojto | 90:cb3d968589d8 | 308 | * - 11: CR3 register |
Kojto | 90:cb3d968589d8 | 309 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 90:cb3d968589d8 | 310 | * @{ |
Kojto | 90:cb3d968589d8 | 311 | */ |
Kojto | 90:cb3d968589d8 | 312 | #define IRDA_IT_PE ((uint16_t)0x0028) |
Kojto | 90:cb3d968589d8 | 313 | #define IRDA_IT_TXE ((uint16_t)0x0727) |
Kojto | 90:cb3d968589d8 | 314 | #define IRDA_IT_TC ((uint16_t)0x0626) |
Kojto | 90:cb3d968589d8 | 315 | #define IRDA_IT_RXNE ((uint16_t)0x0525) |
Kojto | 90:cb3d968589d8 | 316 | #define IRDA_IT_IDLE ((uint16_t)0x0424) |
Kojto | 90:cb3d968589d8 | 317 | |
Kojto | 90:cb3d968589d8 | 318 | |
Kojto | 90:cb3d968589d8 | 319 | |
Kojto | 90:cb3d968589d8 | 320 | /** Elements values convention: 000000000XXYYYYYb |
Kojto | 90:cb3d968589d8 | 321 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 90:cb3d968589d8 | 322 | * - XX : Interrupt source register (2bits) |
Kojto | 90:cb3d968589d8 | 323 | * - 01: CR1 register |
Kojto | 90:cb3d968589d8 | 324 | * - 10: CR2 register |
Kojto | 90:cb3d968589d8 | 325 | * - 11: CR3 register |
Kojto | 90:cb3d968589d8 | 326 | */ |
Kojto | 90:cb3d968589d8 | 327 | #define IRDA_IT_ERR ((uint16_t)0x0060) |
Kojto | 90:cb3d968589d8 | 328 | |
Kojto | 90:cb3d968589d8 | 329 | /** Elements values convention: 0000ZZZZ00000000b |
Kojto | 90:cb3d968589d8 | 330 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 90:cb3d968589d8 | 331 | */ |
Kojto | 90:cb3d968589d8 | 332 | #define IRDA_IT_ORE ((uint16_t)0x0300) |
Kojto | 90:cb3d968589d8 | 333 | #define IRDA_IT_NE ((uint16_t)0x0200) |
Kojto | 90:cb3d968589d8 | 334 | #define IRDA_IT_FE ((uint16_t)0x0100) |
Kojto | 90:cb3d968589d8 | 335 | /** |
Kojto | 90:cb3d968589d8 | 336 | * @} |
Kojto | 90:cb3d968589d8 | 337 | */ |
Kojto | 90:cb3d968589d8 | 338 | |
Kojto | 90:cb3d968589d8 | 339 | /** @defgroup IRDA_IT_CLEAR_Flags IRDA Interruption Clear Flags |
Kojto | 90:cb3d968589d8 | 340 | * @{ |
Kojto | 90:cb3d968589d8 | 341 | */ |
Kojto | 90:cb3d968589d8 | 342 | #define IRDA_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
Kojto | 90:cb3d968589d8 | 343 | #define IRDA_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
Kojto | 90:cb3d968589d8 | 344 | #define IRDA_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
Kojto | 90:cb3d968589d8 | 345 | #define IRDA_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
Kojto | 90:cb3d968589d8 | 346 | #define IRDA_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
Kojto | 90:cb3d968589d8 | 347 | /** |
Kojto | 90:cb3d968589d8 | 348 | * @} |
Kojto | 90:cb3d968589d8 | 349 | */ |
Kojto | 90:cb3d968589d8 | 350 | |
Kojto | 90:cb3d968589d8 | 351 | |
Kojto | 90:cb3d968589d8 | 352 | |
Kojto | 90:cb3d968589d8 | 353 | /** @defgroup IRDA_Request_Parameters IRDA Request Parameters |
Kojto | 90:cb3d968589d8 | 354 | * @{ |
Kojto | 90:cb3d968589d8 | 355 | */ |
Kojto | 90:cb3d968589d8 | 356 | #define IRDA_AUTOBAUD_REQUEST ((uint16_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */ |
Kojto | 90:cb3d968589d8 | 357 | #define IRDA_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
Kojto | 90:cb3d968589d8 | 358 | #define IRDA_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
Kojto | 90:cb3d968589d8 | 359 | #define IS_IRDA_REQUEST_PARAMETER(PARAM) (((PARAM) == IRDA_AUTOBAUD_REQUEST) || \ |
Kojto | 90:cb3d968589d8 | 360 | ((PARAM) == IRDA_SENDBREAK_REQUEST) || \ |
Kojto | 90:cb3d968589d8 | 361 | ((PARAM) == IRDA_MUTE_MODE_REQUEST) || \ |
Kojto | 90:cb3d968589d8 | 362 | ((PARAM) == IRDA_RXDATA_FLUSH_REQUEST) || \ |
Kojto | 90:cb3d968589d8 | 363 | ((PARAM) == IRDA_TXDATA_FLUSH_REQUEST)) |
Kojto | 90:cb3d968589d8 | 364 | /** |
Kojto | 90:cb3d968589d8 | 365 | * @} |
Kojto | 90:cb3d968589d8 | 366 | */ |
Kojto | 90:cb3d968589d8 | 367 | |
Kojto | 90:cb3d968589d8 | 368 | /** @defgroup IRDA_Interruption_Mask IRDA interruptions flag mask |
Kojto | 90:cb3d968589d8 | 369 | * @{ |
Kojto | 90:cb3d968589d8 | 370 | */ |
Kojto | 90:cb3d968589d8 | 371 | #define IRDA_IT_MASK ((uint16_t)0x001F) |
Kojto | 90:cb3d968589d8 | 372 | /** |
Kojto | 90:cb3d968589d8 | 373 | * @} |
Kojto | 90:cb3d968589d8 | 374 | */ |
Kojto | 90:cb3d968589d8 | 375 | |
Kojto | 90:cb3d968589d8 | 376 | /** |
Kojto | 90:cb3d968589d8 | 377 | * @} |
Kojto | 90:cb3d968589d8 | 378 | */ |
Kojto | 90:cb3d968589d8 | 379 | |
Kojto | 90:cb3d968589d8 | 380 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 381 | /** @defgroup IRDA_Exported_Macros IRDA Exported Macros |
Kojto | 90:cb3d968589d8 | 382 | * @{ |
Kojto | 90:cb3d968589d8 | 383 | */ |
Kojto | 90:cb3d968589d8 | 384 | |
Kojto | 90:cb3d968589d8 | 385 | /** @brief Reset IRDA handle state |
Kojto | 90:cb3d968589d8 | 386 | * @param __HANDLE__: IRDA handle. |
Kojto | 90:cb3d968589d8 | 387 | * @retval None |
Kojto | 90:cb3d968589d8 | 388 | */ |
Kojto | 90:cb3d968589d8 | 389 | #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_IRDA_STATE_RESET) |
Kojto | 90:cb3d968589d8 | 390 | |
Kojto | 90:cb3d968589d8 | 391 | /** @brief Checks whether the specified IRDA flag is set or not. |
Kojto | 90:cb3d968589d8 | 392 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 393 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 394 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 395 | * @param __FLAG__: specifies the flag to check. |
Kojto | 90:cb3d968589d8 | 396 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 397 | * @arg IRDA_FLAG_REACK: Receive enable ackowledge flag |
Kojto | 90:cb3d968589d8 | 398 | * @arg IRDA_FLAG_TEACK: Transmit enable ackowledge flag |
Kojto | 90:cb3d968589d8 | 399 | * @arg IRDA_FLAG_BUSY: Busy flag |
Kojto | 90:cb3d968589d8 | 400 | * @arg IRDA_FLAG_ABRF: Auto Baud rate detection flag |
Kojto | 90:cb3d968589d8 | 401 | * @arg IRDA_FLAG_ABRE: Auto Baud rate detection error flag |
Kojto | 90:cb3d968589d8 | 402 | * @arg IRDA_FLAG_TXE: Transmit data register empty flag |
Kojto | 90:cb3d968589d8 | 403 | * @arg IRDA_FLAG_TC: Transmission Complete flag |
Kojto | 90:cb3d968589d8 | 404 | * @arg IRDA_FLAG_RXNE: Receive data register not empty flag |
Kojto | 90:cb3d968589d8 | 405 | * @arg IRDA_FLAG_IDLE: Idle Line detection flag |
Kojto | 90:cb3d968589d8 | 406 | * @arg IRDA_FLAG_ORE: OverRun Error flag |
Kojto | 90:cb3d968589d8 | 407 | * @arg IRDA_FLAG_NE: Noise Error flag |
Kojto | 90:cb3d968589d8 | 408 | * @arg IRDA_FLAG_FE: Framing Error flag |
Kojto | 90:cb3d968589d8 | 409 | * @arg IRDA_FLAG_PE: Parity Error flag |
Kojto | 90:cb3d968589d8 | 410 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 411 | */ |
Kojto | 90:cb3d968589d8 | 412 | #define __HAL_IRDA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
Kojto | 90:cb3d968589d8 | 413 | |
Kojto | 90:cb3d968589d8 | 414 | /** @brief Enables the specified IRDA interrupt. |
Kojto | 90:cb3d968589d8 | 415 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 416 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 417 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 418 | * @param __INTERRUPT__: specifies the IRDA interrupt source to enable. |
Kojto | 90:cb3d968589d8 | 419 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 420 | * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 421 | * @arg IRDA_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 422 | * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 423 | * @arg IRDA_IT_IDLE: Idle line detection interrupt |
Kojto | 90:cb3d968589d8 | 424 | * @arg IRDA_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 425 | * @arg IRDA_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 90:cb3d968589d8 | 426 | * @retval None |
Kojto | 90:cb3d968589d8 | 427 | */ |
Kojto | 90:cb3d968589d8 | 428 | #define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 429 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 430 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK)))) |
Kojto | 90:cb3d968589d8 | 431 | |
Kojto | 90:cb3d968589d8 | 432 | /** @brief Disables the specified IRDA interrupt. |
Kojto | 90:cb3d968589d8 | 433 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 434 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 435 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 436 | * @param __INTERRUPT__: specifies the IRDA interrupt source to disable. |
Kojto | 90:cb3d968589d8 | 437 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 438 | * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 439 | * @arg IRDA_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 440 | * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 441 | * @arg IRDA_IT_IDLE: Idle line detection interrupt |
Kojto | 90:cb3d968589d8 | 442 | * @arg IRDA_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 443 | * @arg IRDA_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 90:cb3d968589d8 | 444 | * @retval None |
Kojto | 90:cb3d968589d8 | 445 | */ |
Kojto | 90:cb3d968589d8 | 446 | #define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 447 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 448 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK)))) |
Kojto | 90:cb3d968589d8 | 449 | |
Kojto | 90:cb3d968589d8 | 450 | |
Kojto | 90:cb3d968589d8 | 451 | /** @brief Checks whether the specified IRDA interrupt has occurred or not. |
Kojto | 90:cb3d968589d8 | 452 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 453 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 454 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 455 | * @param __IT__: specifies the IRDA interrupt source to check. |
Kojto | 90:cb3d968589d8 | 456 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 457 | * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 458 | * @arg IRDA_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 459 | * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 460 | * @arg IRDA_IT_IDLE: Idle line detection interrupt |
Kojto | 90:cb3d968589d8 | 461 | * @arg IRDA_IT_ORE: OverRun Error interrupt |
Kojto | 90:cb3d968589d8 | 462 | * @arg IRDA_IT_NE: Noise Error interrupt |
Kojto | 90:cb3d968589d8 | 463 | * @arg IRDA_IT_FE: Framing Error interrupt |
Kojto | 90:cb3d968589d8 | 464 | * @arg IRDA_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 465 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 466 | */ |
Kojto | 90:cb3d968589d8 | 467 | #define __HAL_IRDA_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1U << ((__IT__)>> 0x08))) |
Kojto | 90:cb3d968589d8 | 468 | |
Kojto | 90:cb3d968589d8 | 469 | /** @brief Checks whether the specified IRDA interrupt source is enabled. |
Kojto | 90:cb3d968589d8 | 470 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 471 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 472 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 473 | * @param __IT__: specifies the IRDA interrupt source to check. |
Kojto | 90:cb3d968589d8 | 474 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 475 | * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 476 | * @arg IRDA_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 477 | * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 478 | * @arg IRDA_IT_IDLE: Idle line detection interrupt |
Kojto | 90:cb3d968589d8 | 479 | * @arg IRDA_IT_ORE: OverRun Error interrupt |
Kojto | 90:cb3d968589d8 | 480 | * @arg IRDA_IT_NE: Noise Error interrupt |
Kojto | 90:cb3d968589d8 | 481 | * @arg IRDA_IT_FE: Framing Error interrupt |
Kojto | 90:cb3d968589d8 | 482 | * @arg IRDA_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 483 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 484 | */ |
Kojto | 90:cb3d968589d8 | 485 | #define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2)? \ |
Kojto | 90:cb3d968589d8 | 486 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & IRDA_IT_MASK))) |
Kojto | 90:cb3d968589d8 | 487 | |
Kojto | 90:cb3d968589d8 | 488 | |
Kojto | 90:cb3d968589d8 | 489 | /** @brief Clears the specified IRDA ISR flag, in setting the proper ICR register flag. |
Kojto | 90:cb3d968589d8 | 490 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 491 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 492 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 493 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
Kojto | 90:cb3d968589d8 | 494 | * to clear the corresponding interrupt |
Kojto | 90:cb3d968589d8 | 495 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 496 | * @arg IRDA_CLEAR_PEF: Parity Error Clear Flag |
Kojto | 90:cb3d968589d8 | 497 | * @arg IRDA_CLEAR_FEF: Framing Error Clear Flag |
Kojto | 90:cb3d968589d8 | 498 | * @arg IRDA_CLEAR_NEF: Noise detected Clear Flag |
Kojto | 90:cb3d968589d8 | 499 | * @arg IRDA_CLEAR_OREF: OverRun Error Clear Flag |
Kojto | 90:cb3d968589d8 | 500 | * @arg IRDA_CLEAR_TCF: Transmission Complete Clear Flag |
Kojto | 90:cb3d968589d8 | 501 | * @retval None |
Kojto | 90:cb3d968589d8 | 502 | */ |
Kojto | 90:cb3d968589d8 | 503 | #define __HAL_IRDA_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
Kojto | 90:cb3d968589d8 | 504 | |
Kojto | 90:cb3d968589d8 | 505 | |
Kojto | 90:cb3d968589d8 | 506 | /** @brief Set a specific IRDA request flag. |
Kojto | 90:cb3d968589d8 | 507 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 508 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 509 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 510 | * @param __REQ__: specifies the request flag to set |
Kojto | 90:cb3d968589d8 | 511 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 512 | * @arg IRDA_AUTOBAUD_REQUEST: Auto-Baud Rate Request |
Kojto | 90:cb3d968589d8 | 513 | * @arg IRDA_RXDATA_FLUSH_REQUEST: Receive Data flush Request |
Kojto | 90:cb3d968589d8 | 514 | * @arg IRDA_TXDATA_FLUSH_REQUEST: Transmit data flush Request |
Kojto | 90:cb3d968589d8 | 515 | * |
Kojto | 90:cb3d968589d8 | 516 | * @retval None |
Kojto | 90:cb3d968589d8 | 517 | */ |
Kojto | 90:cb3d968589d8 | 518 | #define __HAL_IRDA_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) |
Kojto | 90:cb3d968589d8 | 519 | |
Kojto | 90:cb3d968589d8 | 520 | |
Kojto | 90:cb3d968589d8 | 521 | |
Kojto | 90:cb3d968589d8 | 522 | /** @brief Enable UART/USART associated to IRDA Handle |
Kojto | 90:cb3d968589d8 | 523 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 524 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 525 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 526 | * @retval None |
Kojto | 90:cb3d968589d8 | 527 | */ |
Kojto | 90:cb3d968589d8 | 528 | #define __HAL_IRDA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 529 | |
Kojto | 90:cb3d968589d8 | 530 | /** @brief Disable UART/USART associated to IRDA Handle |
Kojto | 90:cb3d968589d8 | 531 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 90:cb3d968589d8 | 532 | * The Handle Instance can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or |
Kojto | 90:cb3d968589d8 | 533 | * UART peripheral |
Kojto | 90:cb3d968589d8 | 534 | * @retval None |
Kojto | 90:cb3d968589d8 | 535 | */ |
Kojto | 90:cb3d968589d8 | 536 | #define __HAL_IRDA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 537 | |
Kojto | 90:cb3d968589d8 | 538 | /** @brief Ensure that IRDA Baud rate is less or equal to maximum value |
Kojto | 90:cb3d968589d8 | 539 | * @param __BAUDRATE__: specifies the IRDA Baudrate set by the user. |
Kojto | 90:cb3d968589d8 | 540 | * @retval True or False |
Kojto | 90:cb3d968589d8 | 541 | */ |
Kojto | 90:cb3d968589d8 | 542 | #define IS_IRDA_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 115201) |
Kojto | 90:cb3d968589d8 | 543 | |
Kojto | 90:cb3d968589d8 | 544 | /** @brief Ensure that IRDA prescaler value is strictly larger than 0 |
Kojto | 90:cb3d968589d8 | 545 | * @param __PRESCALER__: specifies the IRDA prescaler value set by the user. |
Kojto | 90:cb3d968589d8 | 546 | * @retval True or False |
Kojto | 90:cb3d968589d8 | 547 | */ |
Kojto | 90:cb3d968589d8 | 548 | #define IS_IRDA_PRESCALER(__PRESCALER__) ((__PRESCALER__) > 0) |
Kojto | 90:cb3d968589d8 | 549 | |
Kojto | 90:cb3d968589d8 | 550 | /** |
Kojto | 90:cb3d968589d8 | 551 | * @} |
Kojto | 90:cb3d968589d8 | 552 | */ |
Kojto | 90:cb3d968589d8 | 553 | |
Kojto | 90:cb3d968589d8 | 554 | /* Include IRDA HAL Extended module */ |
Kojto | 90:cb3d968589d8 | 555 | #include "stm32f3xx_hal_irda_ex.h" |
Kojto | 90:cb3d968589d8 | 556 | |
Kojto | 90:cb3d968589d8 | 557 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 558 | |
Kojto | 90:cb3d968589d8 | 559 | /** @addtogroup IRDA_Exported_Functions IRDA Exported Functions |
Kojto | 90:cb3d968589d8 | 560 | * @{ |
Kojto | 90:cb3d968589d8 | 561 | */ |
Kojto | 90:cb3d968589d8 | 562 | |
Kojto | 90:cb3d968589d8 | 563 | /** @addtogroup IRDA_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 90:cb3d968589d8 | 564 | * @{ |
Kojto | 90:cb3d968589d8 | 565 | */ |
Kojto | 90:cb3d968589d8 | 566 | |
Kojto | 90:cb3d968589d8 | 567 | /* Initialization and de-initialization functions ****************************/ |
Kojto | 90:cb3d968589d8 | 568 | HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 569 | HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 570 | void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 571 | void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 572 | |
Kojto | 90:cb3d968589d8 | 573 | /** |
Kojto | 90:cb3d968589d8 | 574 | * @} |
Kojto | 90:cb3d968589d8 | 575 | */ |
Kojto | 90:cb3d968589d8 | 576 | |
Kojto | 90:cb3d968589d8 | 577 | /** @addtogroup IRDA_Exported_Functions_Group2 Input and Output operation functions |
Kojto | 90:cb3d968589d8 | 578 | * @{ |
Kojto | 90:cb3d968589d8 | 579 | */ |
Kojto | 90:cb3d968589d8 | 580 | |
Kojto | 90:cb3d968589d8 | 581 | /* IO operation functions *****************************************************/ |
Kojto | 90:cb3d968589d8 | 582 | HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 583 | HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 584 | HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 585 | HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 586 | HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 587 | HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 588 | void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 589 | void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 590 | void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 591 | void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 592 | |
Kojto | 90:cb3d968589d8 | 593 | /** |
Kojto | 90:cb3d968589d8 | 594 | * @} |
Kojto | 90:cb3d968589d8 | 595 | */ |
Kojto | 90:cb3d968589d8 | 596 | |
Kojto | 90:cb3d968589d8 | 597 | /** @addtogroup IRDA_Exported_Functions_Group3 Peripheral State and Errors functions |
Kojto | 90:cb3d968589d8 | 598 | * @{ |
Kojto | 90:cb3d968589d8 | 599 | */ |
Kojto | 90:cb3d968589d8 | 600 | |
Kojto | 90:cb3d968589d8 | 601 | /* Peripheral State and Error functions ***************************************/ |
Kojto | 90:cb3d968589d8 | 602 | HAL_IRDA_StateTypeDef HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 603 | uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda); |
Kojto | 90:cb3d968589d8 | 604 | |
Kojto | 90:cb3d968589d8 | 605 | /** |
Kojto | 90:cb3d968589d8 | 606 | * @} |
Kojto | 90:cb3d968589d8 | 607 | */ |
Kojto | 90:cb3d968589d8 | 608 | |
Kojto | 90:cb3d968589d8 | 609 | /** |
Kojto | 90:cb3d968589d8 | 610 | * @} |
Kojto | 90:cb3d968589d8 | 611 | */ |
Kojto | 90:cb3d968589d8 | 612 | |
Kojto | 90:cb3d968589d8 | 613 | /** |
Kojto | 90:cb3d968589d8 | 614 | * @} |
Kojto | 90:cb3d968589d8 | 615 | */ |
Kojto | 90:cb3d968589d8 | 616 | |
Kojto | 90:cb3d968589d8 | 617 | /** |
Kojto | 90:cb3d968589d8 | 618 | * @} |
Kojto | 90:cb3d968589d8 | 619 | */ |
Kojto | 90:cb3d968589d8 | 620 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 621 | } |
Kojto | 90:cb3d968589d8 | 622 | #endif |
Kojto | 90:cb3d968589d8 | 623 | |
Kojto | 90:cb3d968589d8 | 624 | #endif /* __STM32F3xx_HAL_IRDA_H */ |
Kojto | 90:cb3d968589d8 | 625 | |
Kojto | 90:cb3d968589d8 | 626 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |