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