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_L432KC/stm32l4xx_hal_irda.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
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 |
Kojto | 122:f9eeca106725 | 5 | * @version V1.5.1 |
Kojto | 122:f9eeca106725 | 6 | * @date 31-May-2016 |
Kojto | 122:f9eeca106725 | 7 | * @brief Header file of IRDA HAL module. |
Kojto | 122:f9eeca106725 | 8 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 9 | * @attention |
Kojto | 122:f9eeca106725 | 10 | * |
Kojto | 122:f9eeca106725 | 11 | * <h2><center>© COPYRIGHT(c) 2016 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 */ |
Kojto | 122:f9eeca106725 | 162 | HAL_IRDA_ERROR_DMA = 0x10 /*!< DMA transfer error */ |
Kojto | 122:f9eeca106725 | 163 | }HAL_IRDA_ErrorTypeDef; |
Kojto | 122:f9eeca106725 | 164 | |
Kojto | 122:f9eeca106725 | 165 | /** |
Kojto | 122:f9eeca106725 | 166 | * @brief IRDA clock sources definition |
Kojto | 122:f9eeca106725 | 167 | */ |
Kojto | 122:f9eeca106725 | 168 | typedef enum |
Kojto | 122:f9eeca106725 | 169 | { |
Kojto | 122:f9eeca106725 | 170 | IRDA_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
Kojto | 122:f9eeca106725 | 171 | IRDA_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */ |
Kojto | 122:f9eeca106725 | 172 | IRDA_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
Kojto | 122:f9eeca106725 | 173 | IRDA_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
Kojto | 122:f9eeca106725 | 174 | IRDA_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */ |
Kojto | 122:f9eeca106725 | 175 | IRDA_CLOCKSOURCE_UNDEFINED = 0x10 /*!< Undefined clock source */ |
Kojto | 122:f9eeca106725 | 176 | }IRDA_ClockSourceTypeDef; |
Kojto | 122:f9eeca106725 | 177 | |
Kojto | 122:f9eeca106725 | 178 | /** |
Kojto | 122:f9eeca106725 | 179 | * @brief IRDA handle Structure definition |
Kojto | 122:f9eeca106725 | 180 | */ |
Kojto | 122:f9eeca106725 | 181 | typedef struct |
Kojto | 122:f9eeca106725 | 182 | { |
Kojto | 122:f9eeca106725 | 183 | USART_TypeDef *Instance; /*!< USART registers base address */ |
Kojto | 122:f9eeca106725 | 184 | |
Kojto | 122:f9eeca106725 | 185 | IRDA_InitTypeDef Init; /*!< IRDA communication parameters */ |
Kojto | 122:f9eeca106725 | 186 | |
Kojto | 122:f9eeca106725 | 187 | uint8_t *pTxBuffPtr; /*!< Pointer to IRDA Tx transfer Buffer */ |
Kojto | 122:f9eeca106725 | 188 | |
Kojto | 122:f9eeca106725 | 189 | uint16_t TxXferSize; /*!< IRDA Tx Transfer size */ |
Kojto | 122:f9eeca106725 | 190 | |
Kojto | 122:f9eeca106725 | 191 | uint16_t TxXferCount; /* !<IRDA Tx Transfer Counter */ |
Kojto | 122:f9eeca106725 | 192 | |
Kojto | 122:f9eeca106725 | 193 | uint8_t *pRxBuffPtr; /*!< Pointer to IRDA Rx transfer Buffer */ |
Kojto | 122:f9eeca106725 | 194 | |
Kojto | 122:f9eeca106725 | 195 | uint16_t RxXferSize; /*!< IRDA Rx Transfer size */ |
Kojto | 122:f9eeca106725 | 196 | |
Kojto | 122:f9eeca106725 | 197 | uint16_t RxXferCount; /*!< IRDA Rx Transfer Counter */ |
Kojto | 122:f9eeca106725 | 198 | |
Kojto | 122:f9eeca106725 | 199 | uint16_t Mask; /*!< USART RX RDR register mask */ |
Kojto | 122:f9eeca106725 | 200 | |
Kojto | 122:f9eeca106725 | 201 | DMA_HandleTypeDef *hdmatx; /*!< IRDA Tx DMA Handle parameters */ |
Kojto | 122:f9eeca106725 | 202 | |
Kojto | 122:f9eeca106725 | 203 | DMA_HandleTypeDef *hdmarx; /*!< IRDA Rx DMA Handle parameters */ |
Kojto | 122:f9eeca106725 | 204 | |
Kojto | 122:f9eeca106725 | 205 | HAL_LockTypeDef Lock; /*!< Locking object */ |
Kojto | 122:f9eeca106725 | 206 | |
Kojto | 122:f9eeca106725 | 207 | __IO HAL_IRDA_StateTypeDef gState; /*!< IRDA state information related to global Handle management |
Kojto | 122:f9eeca106725 | 208 | and also related to Tx operations. |
Kojto | 122:f9eeca106725 | 209 | This parameter can be a value of @ref HAL_IRDA_StateTypeDef */ |
Kojto | 122:f9eeca106725 | 210 | |
Kojto | 122:f9eeca106725 | 211 | __IO HAL_IRDA_StateTypeDef RxState; /*!< IRDA state information related to Rx operations. |
Kojto | 122:f9eeca106725 | 212 | This parameter can be a value of @ref HAL_IRDA_StateTypeDef */ |
Kojto | 122:f9eeca106725 | 213 | |
Kojto | 122:f9eeca106725 | 214 | uint32_t ErrorCode; /*!< IRDA Error code */ |
Kojto | 122:f9eeca106725 | 215 | |
Kojto | 122:f9eeca106725 | 216 | }IRDA_HandleTypeDef; |
Kojto | 122:f9eeca106725 | 217 | |
Kojto | 122:f9eeca106725 | 218 | /** |
Kojto | 122:f9eeca106725 | 219 | * @brief IRDA Configuration enumeration values definition |
Kojto | 122:f9eeca106725 | 220 | */ |
Kojto | 122:f9eeca106725 | 221 | typedef enum |
Kojto | 122:f9eeca106725 | 222 | { |
Kojto | 122:f9eeca106725 | 223 | IRDA_BAUDRATE = 0x00, /*!< IRDA Baud rate */ |
Kojto | 122:f9eeca106725 | 224 | IRDA_PARITY = 0x01, /*!< IRDA frame parity */ |
Kojto | 122:f9eeca106725 | 225 | IRDA_WORDLENGTH = 0x02, /*!< IRDA frame length */ |
Kojto | 122:f9eeca106725 | 226 | IRDA_MODE = 0x03, /*!< IRDA communication mode */ |
Kojto | 122:f9eeca106725 | 227 | IRDA_PRESCALER = 0x04, /*!< IRDA prescaling */ |
Kojto | 122:f9eeca106725 | 228 | IRDA_POWERMODE = 0x05 /*!< IRDA power mode */ |
Kojto | 122:f9eeca106725 | 229 | }IRDA_ControlTypeDef; |
Kojto | 122:f9eeca106725 | 230 | |
Kojto | 122:f9eeca106725 | 231 | /** |
Kojto | 122:f9eeca106725 | 232 | * @} |
Kojto | 122:f9eeca106725 | 233 | */ |
Kojto | 122:f9eeca106725 | 234 | |
Kojto | 122:f9eeca106725 | 235 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 236 | /** @defgroup IRDA_Exported_Constants IRDA Exported Constants |
Kojto | 122:f9eeca106725 | 237 | * @{ |
Kojto | 122:f9eeca106725 | 238 | */ |
Kojto | 122:f9eeca106725 | 239 | |
Kojto | 122:f9eeca106725 | 240 | /** @defgroup IRDA_Word_Length IRDA Word Length |
Kojto | 122:f9eeca106725 | 241 | * @{ |
Kojto | 122:f9eeca106725 | 242 | */ |
Kojto | 122:f9eeca106725 | 243 | #define IRDA_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) /*!< 7-bit long frame */ |
Kojto | 122:f9eeca106725 | 244 | #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000) /*!< 8-bit long frame */ |
Kojto | 122:f9eeca106725 | 245 | #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< 9-bit long frame */ |
Kojto | 122:f9eeca106725 | 246 | /** |
Kojto | 122:f9eeca106725 | 247 | * @} |
Kojto | 122:f9eeca106725 | 248 | */ |
Kojto | 122:f9eeca106725 | 249 | |
Kojto | 122:f9eeca106725 | 250 | /** @defgroup IRDA_Parity IRDA Parity |
Kojto | 122:f9eeca106725 | 251 | * @{ |
Kojto | 122:f9eeca106725 | 252 | */ |
Kojto | 122:f9eeca106725 | 253 | #define IRDA_PARITY_NONE ((uint32_t)0x00000000) /*!< No parity */ |
Kojto | 122:f9eeca106725 | 254 | #define IRDA_PARITY_EVEN ((uint32_t)USART_CR1_PCE) /*!< Even parity */ |
Kojto | 122:f9eeca106725 | 255 | #define IRDA_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) /*!< Odd parity */ |
Kojto | 122:f9eeca106725 | 256 | /** |
Kojto | 122:f9eeca106725 | 257 | * @} |
Kojto | 122:f9eeca106725 | 258 | */ |
Kojto | 122:f9eeca106725 | 259 | |
Kojto | 122:f9eeca106725 | 260 | /** @defgroup IRDA_Transfer_Mode IRDA Transfer Mode |
Kojto | 122:f9eeca106725 | 261 | * @{ |
Kojto | 122:f9eeca106725 | 262 | */ |
Kojto | 122:f9eeca106725 | 263 | #define IRDA_MODE_RX ((uint32_t)USART_CR1_RE) /*!< RX mode */ |
Kojto | 122:f9eeca106725 | 264 | #define IRDA_MODE_TX ((uint32_t)USART_CR1_TE) /*!< TX mode */ |
Kojto | 122:f9eeca106725 | 265 | #define IRDA_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) /*!< RX and TX mode */ |
Kojto | 122:f9eeca106725 | 266 | /** |
Kojto | 122:f9eeca106725 | 267 | * @} |
Kojto | 122:f9eeca106725 | 268 | */ |
Kojto | 122:f9eeca106725 | 269 | |
Kojto | 122:f9eeca106725 | 270 | /** @defgroup IRDA_Low_Power IRDA Low Power |
Kojto | 122:f9eeca106725 | 271 | * @{ |
Kojto | 122:f9eeca106725 | 272 | */ |
Kojto | 122:f9eeca106725 | 273 | #define IRDA_POWERMODE_NORMAL ((uint32_t)0x00000000) /*!< IRDA normal power mode */ |
Kojto | 122:f9eeca106725 | 274 | #define IRDA_POWERMODE_LOWPOWER ((uint32_t)USART_CR3_IRLP) /*!< IRDA low power mode */ |
Kojto | 122:f9eeca106725 | 275 | /** |
Kojto | 122:f9eeca106725 | 276 | * @} |
Kojto | 122:f9eeca106725 | 277 | */ |
Kojto | 122:f9eeca106725 | 278 | |
Kojto | 122:f9eeca106725 | 279 | /** @defgroup IRDA_State IRDA State |
Kojto | 122:f9eeca106725 | 280 | * @{ |
Kojto | 122:f9eeca106725 | 281 | */ |
Kojto | 122:f9eeca106725 | 282 | #define IRDA_STATE_DISABLE ((uint32_t)0x00000000) /*!< IRDA disabled */ |
Kojto | 122:f9eeca106725 | 283 | #define IRDA_STATE_ENABLE ((uint32_t)USART_CR1_UE) /*!< IRDA enabled */ |
Kojto | 122:f9eeca106725 | 284 | /** |
Kojto | 122:f9eeca106725 | 285 | * @} |
Kojto | 122:f9eeca106725 | 286 | */ |
Kojto | 122:f9eeca106725 | 287 | |
Kojto | 122:f9eeca106725 | 288 | /** @defgroup IRDA_Mode IRDA Mode |
Kojto | 122:f9eeca106725 | 289 | * @{ |
Kojto | 122:f9eeca106725 | 290 | */ |
Kojto | 122:f9eeca106725 | 291 | #define IRDA_MODE_DISABLE ((uint32_t)0x00000000) /*!< Associated UART disabled in IRDA mode */ |
Kojto | 122:f9eeca106725 | 292 | #define IRDA_MODE_ENABLE ((uint32_t)USART_CR3_IREN) /*!< Associated UART enabled in IRDA mode */ |
Kojto | 122:f9eeca106725 | 293 | /** |
Kojto | 122:f9eeca106725 | 294 | * @} |
Kojto | 122:f9eeca106725 | 295 | */ |
Kojto | 122:f9eeca106725 | 296 | |
Kojto | 122:f9eeca106725 | 297 | /** @defgroup IRDA_One_Bit IRDA One Bit Sampling |
Kojto | 122:f9eeca106725 | 298 | * @{ |
Kojto | 122:f9eeca106725 | 299 | */ |
Kojto | 122:f9eeca106725 | 300 | #define IRDA_ONE_BIT_SAMPLE_DISABLE ((uint32_t)0x00000000) /*!< One-bit sampling disabled */ |
Kojto | 122:f9eeca106725 | 301 | #define IRDA_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT) /*!< One-bit sampling enabled */ |
Kojto | 122:f9eeca106725 | 302 | /** |
Kojto | 122:f9eeca106725 | 303 | * @} |
Kojto | 122:f9eeca106725 | 304 | */ |
Kojto | 122:f9eeca106725 | 305 | |
Kojto | 122:f9eeca106725 | 306 | /** @defgroup IRDA_DMA_Tx IRDA DMA Tx |
Kojto | 122:f9eeca106725 | 307 | * @{ |
Kojto | 122:f9eeca106725 | 308 | */ |
Kojto | 122:f9eeca106725 | 309 | #define IRDA_DMA_TX_DISABLE ((uint32_t)0x00000000) /*!< IRDA DMA TX disabled */ |
Kojto | 122:f9eeca106725 | 310 | #define IRDA_DMA_TX_ENABLE ((uint32_t)USART_CR3_DMAT) /*!< IRDA DMA TX enabled */ |
Kojto | 122:f9eeca106725 | 311 | /** |
Kojto | 122:f9eeca106725 | 312 | * @} |
Kojto | 122:f9eeca106725 | 313 | */ |
Kojto | 122:f9eeca106725 | 314 | |
Kojto | 122:f9eeca106725 | 315 | /** @defgroup IRDA_DMA_Rx IRDA DMA Rx |
Kojto | 122:f9eeca106725 | 316 | * @{ |
Kojto | 122:f9eeca106725 | 317 | */ |
Kojto | 122:f9eeca106725 | 318 | #define IRDA_DMA_RX_DISABLE ((uint32_t)0x00000000) /*!< IRDA DMA RX disabled */ |
Kojto | 122:f9eeca106725 | 319 | #define IRDA_DMA_RX_ENABLE ((uint32_t)USART_CR3_DMAR) /*!< IRDA DMA RX enabled */ |
Kojto | 122:f9eeca106725 | 320 | /** |
Kojto | 122:f9eeca106725 | 321 | * @} |
Kojto | 122:f9eeca106725 | 322 | */ |
Kojto | 122:f9eeca106725 | 323 | |
Kojto | 122:f9eeca106725 | 324 | /** @defgroup IRDA_Request_Parameters IRDA Request Parameters |
Kojto | 122:f9eeca106725 | 325 | * @{ |
Kojto | 122:f9eeca106725 | 326 | */ |
Kojto | 122:f9eeca106725 | 327 | #define IRDA_AUTOBAUD_REQUEST ((uint16_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */ |
Kojto | 122:f9eeca106725 | 328 | #define IRDA_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
Kojto | 122:f9eeca106725 | 329 | #define IRDA_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
Kojto | 122:f9eeca106725 | 330 | /** |
Kojto | 122:f9eeca106725 | 331 | * @} |
Kojto | 122:f9eeca106725 | 332 | */ |
Kojto | 122:f9eeca106725 | 333 | |
Kojto | 122:f9eeca106725 | 334 | /** @defgroup IRDA_Flags IRDA Flags |
Kojto | 122:f9eeca106725 | 335 | * Elements values convention: 0xXXXX |
Kojto | 122:f9eeca106725 | 336 | * - 0xXXXX : Flag mask in the ISR register |
Kojto | 122:f9eeca106725 | 337 | * @{ |
Kojto | 122:f9eeca106725 | 338 | */ |
Kojto | 122:f9eeca106725 | 339 | #define IRDA_FLAG_REACK ((uint32_t)0x00400000) /*!< IRDA Receive enable acknowledge flag */ |
Kojto | 122:f9eeca106725 | 340 | #define IRDA_FLAG_TEACK ((uint32_t)0x00200000) /*!< IRDA Transmit enable acknowledge flag */ |
Kojto | 122:f9eeca106725 | 341 | #define IRDA_FLAG_BUSY ((uint32_t)0x00010000) /*!< IRDA Busy flag */ |
Kojto | 122:f9eeca106725 | 342 | #define IRDA_FLAG_ABRF ((uint32_t)0x00008000) /*!< IRDA Auto baud rate flag */ |
Kojto | 122:f9eeca106725 | 343 | #define IRDA_FLAG_ABRE ((uint32_t)0x00004000) /*!< IRDA Auto baud rate error */ |
Kojto | 122:f9eeca106725 | 344 | #define IRDA_FLAG_TXE ((uint32_t)0x00000080) /*!< IRDA Transmit data register empty */ |
Kojto | 122:f9eeca106725 | 345 | #define IRDA_FLAG_TC ((uint32_t)0x00000040) /*!< IRDA Transmission complete */ |
Kojto | 122:f9eeca106725 | 346 | #define IRDA_FLAG_RXNE ((uint32_t)0x00000020) /*!< IRDA Read data register not empty */ |
Kojto | 122:f9eeca106725 | 347 | #define IRDA_FLAG_ORE ((uint32_t)0x00000008) /*!< IRDA Overrun error */ |
Kojto | 122:f9eeca106725 | 348 | #define IRDA_FLAG_NE ((uint32_t)0x00000004) /*!< IRDA Noise error */ |
Kojto | 122:f9eeca106725 | 349 | #define IRDA_FLAG_FE ((uint32_t)0x00000002) /*!< IRDA Noise error */ |
Kojto | 122:f9eeca106725 | 350 | #define IRDA_FLAG_PE ((uint32_t)0x00000001) /*!< IRDA Parity error */ |
Kojto | 122:f9eeca106725 | 351 | /** |
Kojto | 122:f9eeca106725 | 352 | * @} |
Kojto | 122:f9eeca106725 | 353 | */ |
Kojto | 122:f9eeca106725 | 354 | |
Kojto | 122:f9eeca106725 | 355 | /** @defgroup IRDA_Interrupt_definition IRDA Interrupts Definition |
Kojto | 122:f9eeca106725 | 356 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
Kojto | 122:f9eeca106725 | 357 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 122:f9eeca106725 | 358 | * - XX : Interrupt source register (2bits) |
Kojto | 122:f9eeca106725 | 359 | * - 01: CR1 register |
Kojto | 122:f9eeca106725 | 360 | * - 10: CR2 register |
Kojto | 122:f9eeca106725 | 361 | * - 11: CR3 register |
Kojto | 122:f9eeca106725 | 362 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 122:f9eeca106725 | 363 | * @{ |
Kojto | 122:f9eeca106725 | 364 | */ |
Kojto | 122:f9eeca106725 | 365 | #define IRDA_IT_PE ((uint16_t)0x0028) /*!< IRDA Parity error interruption */ |
Kojto | 122:f9eeca106725 | 366 | #define IRDA_IT_TXE ((uint16_t)0x0727) /*!< IRDA Transmit data register empty interruption */ |
Kojto | 122:f9eeca106725 | 367 | #define IRDA_IT_TC ((uint16_t)0x0626) /*!< IRDA Transmission complete interruption */ |
Kojto | 122:f9eeca106725 | 368 | #define IRDA_IT_RXNE ((uint16_t)0x0525) /*!< IRDA Read data register not empty interruption */ |
Kojto | 122:f9eeca106725 | 369 | #define IRDA_IT_IDLE ((uint16_t)0x0424) /*!< IRDA Idle interruption */ |
Kojto | 122:f9eeca106725 | 370 | |
Kojto | 122:f9eeca106725 | 371 | /* Elements values convention: 000000000XXYYYYYb |
Kojto | 122:f9eeca106725 | 372 | - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 122:f9eeca106725 | 373 | - XX : Interrupt source register (2bits) |
Kojto | 122:f9eeca106725 | 374 | - 01: CR1 register |
Kojto | 122:f9eeca106725 | 375 | - 10: CR2 register |
Kojto | 122:f9eeca106725 | 376 | - 11: CR3 register */ |
Kojto | 122:f9eeca106725 | 377 | #define IRDA_IT_ERR ((uint16_t)0x0060) /*!< IRDA Error interruption */ |
Kojto | 122:f9eeca106725 | 378 | |
Kojto | 122:f9eeca106725 | 379 | /* Elements values convention: 0000ZZZZ00000000b |
Kojto | 122:f9eeca106725 | 380 | - ZZZZ : Flag position in the ISR register(4bits) */ |
Kojto | 122:f9eeca106725 | 381 | #define IRDA_IT_ORE ((uint16_t)0x0300) /*!< IRDA Overrun error interruption */ |
Kojto | 122:f9eeca106725 | 382 | #define IRDA_IT_NE ((uint16_t)0x0200) /*!< IRDA Noise error interruption */ |
Kojto | 122:f9eeca106725 | 383 | #define IRDA_IT_FE ((uint16_t)0x0100) /*!< IRDA Frame error interruption */ |
Kojto | 122:f9eeca106725 | 384 | /** |
Kojto | 122:f9eeca106725 | 385 | * @} |
Kojto | 122:f9eeca106725 | 386 | */ |
Kojto | 122:f9eeca106725 | 387 | |
Kojto | 122:f9eeca106725 | 388 | /** @defgroup IRDA_IT_CLEAR_Flags IRDA Interruption Clear Flags |
Kojto | 122:f9eeca106725 | 389 | * @{ |
Kojto | 122:f9eeca106725 | 390 | */ |
Kojto | 122:f9eeca106725 | 391 | #define IRDA_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
Kojto | 122:f9eeca106725 | 392 | #define IRDA_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
Kojto | 122:f9eeca106725 | 393 | #define IRDA_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
Kojto | 122:f9eeca106725 | 394 | #define IRDA_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
Kojto | 122:f9eeca106725 | 395 | #define IRDA_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
Kojto | 122:f9eeca106725 | 396 | #define IRDA_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
Kojto | 122:f9eeca106725 | 397 | /** |
Kojto | 122:f9eeca106725 | 398 | * @} |
Kojto | 122:f9eeca106725 | 399 | */ |
Kojto | 122:f9eeca106725 | 400 | |
Kojto | 122:f9eeca106725 | 401 | /** @defgroup IRDA_Interruption_Mask IRDA interruptions flags mask |
Kojto | 122:f9eeca106725 | 402 | * @{ |
Kojto | 122:f9eeca106725 | 403 | */ |
Kojto | 122:f9eeca106725 | 404 | #define IRDA_IT_MASK ((uint16_t)0x001F) /*!< IRDA Interruptions flags mask */ |
Kojto | 122:f9eeca106725 | 405 | /** |
Kojto | 122:f9eeca106725 | 406 | * @} |
Kojto | 122:f9eeca106725 | 407 | */ |
Kojto | 122:f9eeca106725 | 408 | |
Kojto | 122:f9eeca106725 | 409 | /** |
Kojto | 122:f9eeca106725 | 410 | * @} |
Kojto | 122:f9eeca106725 | 411 | */ |
Kojto | 122:f9eeca106725 | 412 | |
Kojto | 122:f9eeca106725 | 413 | |
Kojto | 122:f9eeca106725 | 414 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 415 | /** @defgroup IRDA_Exported_Macros IRDA Exported Macros |
Kojto | 122:f9eeca106725 | 416 | * @{ |
Kojto | 122:f9eeca106725 | 417 | */ |
Kojto | 122:f9eeca106725 | 418 | |
Kojto | 122:f9eeca106725 | 419 | /** @brief Reset IRDA handle state. |
Kojto | 122:f9eeca106725 | 420 | * @param __HANDLE__: IRDA handle. |
Kojto | 122:f9eeca106725 | 421 | * @retval None |
Kojto | 122:f9eeca106725 | 422 | */ |
Kojto | 122:f9eeca106725 | 423 | #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
Kojto | 122:f9eeca106725 | 424 | (__HANDLE__)->gState = HAL_IRDA_STATE_RESET; \ |
Kojto | 122:f9eeca106725 | 425 | (__HANDLE__)->RxState = HAL_IRDA_STATE_RESET; \ |
Kojto | 122:f9eeca106725 | 426 | } while(0) |
Kojto | 122:f9eeca106725 | 427 | |
Kojto | 122:f9eeca106725 | 428 | /** @brief Flush the IRDA DR register. |
Kojto | 122:f9eeca106725 | 429 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 430 | * @retval None |
Kojto | 122:f9eeca106725 | 431 | */ |
Kojto | 122:f9eeca106725 | 432 | #define __HAL_IRDA_FLUSH_DRREGISTER(__HANDLE__) \ |
Kojto | 122:f9eeca106725 | 433 | do{ \ |
Kojto | 122:f9eeca106725 | 434 | SET_BIT((__HANDLE__)->Instance->RQR, IRDA_RXDATA_FLUSH_REQUEST); \ |
Kojto | 122:f9eeca106725 | 435 | SET_BIT((__HANDLE__)->Instance->RQR, IRDA_TXDATA_FLUSH_REQUEST); \ |
Kojto | 122:f9eeca106725 | 436 | } while(0) |
Kojto | 122:f9eeca106725 | 437 | |
Kojto | 122:f9eeca106725 | 438 | /** @brief Clear the specified IRDA pending flag. |
Kojto | 122:f9eeca106725 | 439 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 440 | * @param __FLAG__: specifies the flag to check. |
Kojto | 122:f9eeca106725 | 441 | * This parameter can be any combination of the following values: |
Kojto | 122:f9eeca106725 | 442 | * @arg @ref IRDA_CLEAR_PEF |
Kojto | 122:f9eeca106725 | 443 | * @arg @ref IRDA_CLEAR_FEF |
Kojto | 122:f9eeca106725 | 444 | * @arg @ref IRDA_CLEAR_NEF |
Kojto | 122:f9eeca106725 | 445 | * @arg @ref IRDA_CLEAR_OREF |
Kojto | 122:f9eeca106725 | 446 | * @arg @ref IRDA_CLEAR_TCF |
Kojto | 122:f9eeca106725 | 447 | * @arg @ref IRDA_CLEAR_IDLEF |
Kojto | 122:f9eeca106725 | 448 | * @retval None |
Kojto | 122:f9eeca106725 | 449 | */ |
Kojto | 122:f9eeca106725 | 450 | #define __HAL_IRDA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
Kojto | 122:f9eeca106725 | 451 | |
Kojto | 122:f9eeca106725 | 452 | /** @brief Clear the IRDA PE pending flag. |
Kojto | 122:f9eeca106725 | 453 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 454 | * @retval None |
Kojto | 122:f9eeca106725 | 455 | */ |
Kojto | 122:f9eeca106725 | 456 | #define __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_PEF) |
Kojto | 122:f9eeca106725 | 457 | |
Kojto | 122:f9eeca106725 | 458 | |
Kojto | 122:f9eeca106725 | 459 | /** @brief Clear the IRDA FE pending flag. |
Kojto | 122:f9eeca106725 | 460 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 461 | * @retval None |
Kojto | 122:f9eeca106725 | 462 | */ |
Kojto | 122:f9eeca106725 | 463 | #define __HAL_IRDA_CLEAR_FEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_FEF) |
Kojto | 122:f9eeca106725 | 464 | |
Kojto | 122:f9eeca106725 | 465 | /** @brief Clear the IRDA NE pending flag. |
Kojto | 122:f9eeca106725 | 466 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 467 | * @retval None |
Kojto | 122:f9eeca106725 | 468 | */ |
Kojto | 122:f9eeca106725 | 469 | #define __HAL_IRDA_CLEAR_NEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_NEF) |
Kojto | 122:f9eeca106725 | 470 | |
Kojto | 122:f9eeca106725 | 471 | /** @brief Clear the IRDA ORE pending flag. |
Kojto | 122:f9eeca106725 | 472 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 473 | * @retval None |
Kojto | 122:f9eeca106725 | 474 | */ |
Kojto | 122:f9eeca106725 | 475 | #define __HAL_IRDA_CLEAR_OREFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_OREF) |
Kojto | 122:f9eeca106725 | 476 | |
Kojto | 122:f9eeca106725 | 477 | /** @brief Clear the IRDA IDLE pending flag. |
Kojto | 122:f9eeca106725 | 478 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 479 | * @retval None |
Kojto | 122:f9eeca106725 | 480 | */ |
Kojto | 122:f9eeca106725 | 481 | #define __HAL_IRDA_CLEAR_IDLEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_FLAG((__HANDLE__), IRDA_CLEAR_IDLEF) |
Kojto | 122:f9eeca106725 | 482 | |
Kojto | 122:f9eeca106725 | 483 | /** @brief Check whether the specified IRDA flag is set or not. |
Kojto | 122:f9eeca106725 | 484 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 485 | * @param __FLAG__: specifies the flag to check. |
Kojto | 122:f9eeca106725 | 486 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 487 | * @arg @ref IRDA_FLAG_REACK Receive enable acknowledge flag |
Kojto | 122:f9eeca106725 | 488 | * @arg @ref IRDA_FLAG_TEACK Transmit enable acknowledge flag |
Kojto | 122:f9eeca106725 | 489 | * @arg @ref IRDA_FLAG_BUSY Busy flag |
Kojto | 122:f9eeca106725 | 490 | * @arg @ref IRDA_FLAG_ABRF Auto Baud rate detection flag |
Kojto | 122:f9eeca106725 | 491 | * @arg @ref IRDA_FLAG_ABRE Auto Baud rate detection error flag |
Kojto | 122:f9eeca106725 | 492 | * @arg @ref IRDA_FLAG_TXE Transmit data register empty flag |
Kojto | 122:f9eeca106725 | 493 | * @arg @ref IRDA_FLAG_TC Transmission Complete flag |
Kojto | 122:f9eeca106725 | 494 | * @arg @ref IRDA_FLAG_RXNE Receive data register not empty flag |
Kojto | 122:f9eeca106725 | 495 | * @arg @ref IRDA_FLAG_ORE OverRun Error flag |
Kojto | 122:f9eeca106725 | 496 | * @arg @ref IRDA_FLAG_NE Noise Error flag |
Kojto | 122:f9eeca106725 | 497 | * @arg @ref IRDA_FLAG_FE Framing Error flag |
Kojto | 122:f9eeca106725 | 498 | * @arg @ref IRDA_FLAG_PE Parity Error flag |
Kojto | 122:f9eeca106725 | 499 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 500 | */ |
Kojto | 122:f9eeca106725 | 501 | #define __HAL_IRDA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
Kojto | 122:f9eeca106725 | 502 | |
Kojto | 122:f9eeca106725 | 503 | |
Kojto | 122:f9eeca106725 | 504 | /** @brief Enable the specified IRDA interrupt. |
Kojto | 122:f9eeca106725 | 505 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 506 | * @param __INTERRUPT__: specifies the IRDA interrupt source to enable. |
Kojto | 122:f9eeca106725 | 507 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 508 | * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt |
Kojto | 122:f9eeca106725 | 509 | * @arg @ref IRDA_IT_TC Transmission complete interrupt |
Kojto | 122:f9eeca106725 | 510 | * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt |
Kojto | 122:f9eeca106725 | 511 | * @arg @ref IRDA_IT_IDLE Idle line detection interrupt |
Kojto | 122:f9eeca106725 | 512 | * @arg @ref IRDA_IT_PE Parity Error interrupt |
Kojto | 122:f9eeca106725 | 513 | * @arg @ref IRDA_IT_ERR Error interrupt(Frame error, noise error, overrun error) |
Kojto | 122:f9eeca106725 | 514 | * @retval None |
Kojto | 122:f9eeca106725 | 515 | */ |
Kojto | 122:f9eeca106725 | 516 | #define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 122:f9eeca106725 | 517 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 122:f9eeca106725 | 518 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & IRDA_IT_MASK)))) |
Kojto | 122:f9eeca106725 | 519 | |
Kojto | 122:f9eeca106725 | 520 | /** @brief Disable the specified IRDA interrupt. |
Kojto | 122:f9eeca106725 | 521 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 522 | * @param __INTERRUPT__: specifies the IRDA interrupt source to disable. |
Kojto | 122:f9eeca106725 | 523 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 524 | * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt |
Kojto | 122:f9eeca106725 | 525 | * @arg @ref IRDA_IT_TC Transmission complete interrupt |
Kojto | 122:f9eeca106725 | 526 | * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt |
Kojto | 122:f9eeca106725 | 527 | * @arg @ref IRDA_IT_IDLE Idle line detection interrupt |
Kojto | 122:f9eeca106725 | 528 | * @arg @ref IRDA_IT_PE Parity Error interrupt |
Kojto | 122:f9eeca106725 | 529 | * @arg @ref IRDA_IT_ERR Error interrupt(Frame error, noise error, overrun error) |
Kojto | 122:f9eeca106725 | 530 | * @retval None |
Kojto | 122:f9eeca106725 | 531 | */ |
Kojto | 122:f9eeca106725 | 532 | #define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 122:f9eeca106725 | 533 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \ |
Kojto | 122:f9eeca106725 | 534 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & IRDA_IT_MASK)))) |
Kojto | 122:f9eeca106725 | 535 | |
Kojto | 122:f9eeca106725 | 536 | |
Kojto | 122:f9eeca106725 | 537 | /** @brief Check whether the specified IRDA interrupt has occurred or not. |
Kojto | 122:f9eeca106725 | 538 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 539 | * @param __IT__: specifies the IRDA interrupt source to check. |
Kojto | 122:f9eeca106725 | 540 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 541 | * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt |
Kojto | 122:f9eeca106725 | 542 | * @arg @ref IRDA_IT_TC Transmission complete interrupt |
Kojto | 122:f9eeca106725 | 543 | * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt |
Kojto | 122:f9eeca106725 | 544 | * @arg @ref IRDA_IT_IDLE Idle line detection interrupt |
Kojto | 122:f9eeca106725 | 545 | * @arg @ref IRDA_IT_ORE OverRun Error interrupt |
Kojto | 122:f9eeca106725 | 546 | * @arg @ref IRDA_IT_NE Noise Error interrupt |
Kojto | 122:f9eeca106725 | 547 | * @arg @ref IRDA_IT_FE Framing Error interrupt |
Kojto | 122:f9eeca106725 | 548 | * @arg @ref IRDA_IT_PE Parity Error interrupt |
Kojto | 122:f9eeca106725 | 549 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 550 | */ |
Kojto | 122:f9eeca106725 | 551 | #define __HAL_IRDA_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1U << ((__IT__)>> 0x08))) |
Kojto | 122:f9eeca106725 | 552 | |
Kojto | 122:f9eeca106725 | 553 | /** @brief Check whether the specified IRDA interrupt source is enabled or not. |
Kojto | 122:f9eeca106725 | 554 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 555 | * @param __IT__: specifies the IRDA interrupt source to check. |
Kojto | 122:f9eeca106725 | 556 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 557 | * @arg @ref IRDA_IT_TXE Transmit Data Register empty interrupt |
Kojto | 122:f9eeca106725 | 558 | * @arg @ref IRDA_IT_TC Transmission complete interrupt |
Kojto | 122:f9eeca106725 | 559 | * @arg @ref IRDA_IT_RXNE Receive Data register not empty interrupt |
Kojto | 122:f9eeca106725 | 560 | * @arg @ref IRDA_IT_IDLE Idle line detection interrupt |
Kojto | 122:f9eeca106725 | 561 | * @arg @ref IRDA_IT_ERR Framing, overrun or noise error interrupt |
Kojto | 122:f9eeca106725 | 562 | * @arg @ref IRDA_IT_PE Parity Error interrupt |
Kojto | 122:f9eeca106725 | 563 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 564 | */ |
Kojto | 122:f9eeca106725 | 565 | #define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2)? \ |
Kojto | 122:f9eeca106725 | 566 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & IRDA_IT_MASK))) |
Kojto | 122:f9eeca106725 | 567 | |
Kojto | 122:f9eeca106725 | 568 | |
Kojto | 122:f9eeca106725 | 569 | /** @brief Clear the specified IRDA ISR flag, in setting the proper ICR register flag. |
Kojto | 122:f9eeca106725 | 570 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 571 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
Kojto | 122:f9eeca106725 | 572 | * to clear the corresponding interrupt |
Kojto | 122:f9eeca106725 | 573 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 574 | * @arg @ref IRDA_CLEAR_PEF Parity Error Clear Flag |
Kojto | 122:f9eeca106725 | 575 | * @arg @ref IRDA_CLEAR_FEF Framing Error Clear Flag |
Kojto | 122:f9eeca106725 | 576 | * @arg @ref IRDA_CLEAR_NEF Noise detected Clear Flag |
Kojto | 122:f9eeca106725 | 577 | * @arg @ref IRDA_CLEAR_OREF OverRun Error Clear Flag |
Kojto | 122:f9eeca106725 | 578 | * @arg @ref IRDA_CLEAR_TCF Transmission Complete Clear Flag |
Kojto | 122:f9eeca106725 | 579 | * @retval None |
Kojto | 122:f9eeca106725 | 580 | */ |
Kojto | 122:f9eeca106725 | 581 | #define __HAL_IRDA_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
Kojto | 122:f9eeca106725 | 582 | |
Kojto | 122:f9eeca106725 | 583 | |
Kojto | 122:f9eeca106725 | 584 | /** @brief Set a specific IRDA request flag. |
Kojto | 122:f9eeca106725 | 585 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 586 | * @param __REQ__: specifies the request flag to set |
Kojto | 122:f9eeca106725 | 587 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 588 | * @arg @ref IRDA_AUTOBAUD_REQUEST Auto-Baud Rate Request |
Kojto | 122:f9eeca106725 | 589 | * @arg @ref IRDA_RXDATA_FLUSH_REQUEST Receive Data flush Request |
Kojto | 122:f9eeca106725 | 590 | * @arg @ref IRDA_TXDATA_FLUSH_REQUEST Transmit data flush Request |
Kojto | 122:f9eeca106725 | 591 | * |
Kojto | 122:f9eeca106725 | 592 | * @retval None |
Kojto | 122:f9eeca106725 | 593 | */ |
Kojto | 122:f9eeca106725 | 594 | #define __HAL_IRDA_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) |
Kojto | 122:f9eeca106725 | 595 | |
Kojto | 122:f9eeca106725 | 596 | /** @brief Enable the IRDA one bit sample method. |
Kojto | 122:f9eeca106725 | 597 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 598 | * @retval None |
Kojto | 122:f9eeca106725 | 599 | */ |
Kojto | 122:f9eeca106725 | 600 | #define __HAL_IRDA_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) |
Kojto | 122:f9eeca106725 | 601 | |
Kojto | 122:f9eeca106725 | 602 | /** @brief Disable the IRDA one bit sample method. |
Kojto | 122:f9eeca106725 | 603 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 604 | * @retval None |
Kojto | 122:f9eeca106725 | 605 | */ |
Kojto | 122:f9eeca106725 | 606 | #define __HAL_IRDA_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT)) |
Kojto | 122:f9eeca106725 | 607 | |
Kojto | 122:f9eeca106725 | 608 | /** @brief Enable UART/USART associated to IRDA Handle. |
Kojto | 122:f9eeca106725 | 609 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 610 | * @retval None |
Kojto | 122:f9eeca106725 | 611 | */ |
Kojto | 122:f9eeca106725 | 612 | #define __HAL_IRDA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 122:f9eeca106725 | 613 | |
Kojto | 122:f9eeca106725 | 614 | /** @brief Disable UART/USART associated to IRDA Handle. |
Kojto | 122:f9eeca106725 | 615 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 616 | * @retval None |
Kojto | 122:f9eeca106725 | 617 | */ |
Kojto | 122:f9eeca106725 | 618 | #define __HAL_IRDA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 122:f9eeca106725 | 619 | |
Kojto | 122:f9eeca106725 | 620 | /** |
Kojto | 122:f9eeca106725 | 621 | * @} |
Kojto | 122:f9eeca106725 | 622 | */ |
Kojto | 122:f9eeca106725 | 623 | |
Kojto | 122:f9eeca106725 | 624 | /* Private macros --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 625 | /** @defgroup IRDA_Private_Macros IRDA Private Macros |
Kojto | 122:f9eeca106725 | 626 | * @{ |
Kojto | 122:f9eeca106725 | 627 | */ |
Kojto | 122:f9eeca106725 | 628 | |
Kojto | 122:f9eeca106725 | 629 | /** @brief Compute the mask to apply to retrieve the received data |
Kojto | 122:f9eeca106725 | 630 | * according to the word length and to the parity bits activation. |
Kojto | 122:f9eeca106725 | 631 | * @param __HANDLE__: specifies the IRDA Handle. |
Kojto | 122:f9eeca106725 | 632 | * @retval None, the mask to apply to the associated UART RDR register is stored in (__HANDLE__)->Mask field. |
Kojto | 122:f9eeca106725 | 633 | */ |
Kojto | 122:f9eeca106725 | 634 | #define IRDA_MASK_COMPUTATION(__HANDLE__) \ |
Kojto | 122:f9eeca106725 | 635 | do { \ |
Kojto | 122:f9eeca106725 | 636 | if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \ |
Kojto | 122:f9eeca106725 | 637 | { \ |
Kojto | 122:f9eeca106725 | 638 | if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ |
Kojto | 122:f9eeca106725 | 639 | { \ |
Kojto | 122:f9eeca106725 | 640 | (__HANDLE__)->Mask = 0x01FF ; \ |
Kojto | 122:f9eeca106725 | 641 | } \ |
Kojto | 122:f9eeca106725 | 642 | else \ |
Kojto | 122:f9eeca106725 | 643 | { \ |
Kojto | 122:f9eeca106725 | 644 | (__HANDLE__)->Mask = 0x00FF ; \ |
Kojto | 122:f9eeca106725 | 645 | } \ |
Kojto | 122:f9eeca106725 | 646 | } \ |
Kojto | 122:f9eeca106725 | 647 | else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \ |
Kojto | 122:f9eeca106725 | 648 | { \ |
Kojto | 122:f9eeca106725 | 649 | if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ |
Kojto | 122:f9eeca106725 | 650 | { \ |
Kojto | 122:f9eeca106725 | 651 | (__HANDLE__)->Mask = 0x00FF ; \ |
Kojto | 122:f9eeca106725 | 652 | } \ |
Kojto | 122:f9eeca106725 | 653 | else \ |
Kojto | 122:f9eeca106725 | 654 | { \ |
Kojto | 122:f9eeca106725 | 655 | (__HANDLE__)->Mask = 0x007F ; \ |
Kojto | 122:f9eeca106725 | 656 | } \ |
Kojto | 122:f9eeca106725 | 657 | } \ |
Kojto | 122:f9eeca106725 | 658 | else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \ |
Kojto | 122:f9eeca106725 | 659 | { \ |
Kojto | 122:f9eeca106725 | 660 | if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ |
Kojto | 122:f9eeca106725 | 661 | { \ |
Kojto | 122:f9eeca106725 | 662 | (__HANDLE__)->Mask = 0x007F ; \ |
Kojto | 122:f9eeca106725 | 663 | } \ |
Kojto | 122:f9eeca106725 | 664 | else \ |
Kojto | 122:f9eeca106725 | 665 | { \ |
Kojto | 122:f9eeca106725 | 666 | (__HANDLE__)->Mask = 0x003F ; \ |
Kojto | 122:f9eeca106725 | 667 | } \ |
Kojto | 122:f9eeca106725 | 668 | } \ |
Kojto | 122:f9eeca106725 | 669 | } while(0) |
Kojto | 122:f9eeca106725 | 670 | |
Kojto | 122:f9eeca106725 | 671 | /** @brief Ensure that IRDA Baud rate is less or equal to maximum value. |
Kojto | 122:f9eeca106725 | 672 | * @param __BAUDRATE__: specifies the IRDA Baudrate set by the user. |
Kojto | 122:f9eeca106725 | 673 | * @retval True or False |
Kojto | 122:f9eeca106725 | 674 | */ |
Kojto | 122:f9eeca106725 | 675 | #define IS_IRDA_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 115201) |
Kojto | 122:f9eeca106725 | 676 | |
Kojto | 122:f9eeca106725 | 677 | /** @brief Ensure that IRDA prescaler value is strictly larger than 0. |
Kojto | 122:f9eeca106725 | 678 | * @param __PRESCALER__: specifies the IRDA prescaler value set by the user. |
Kojto | 122:f9eeca106725 | 679 | * @retval True or False |
Kojto | 122:f9eeca106725 | 680 | */ |
Kojto | 122:f9eeca106725 | 681 | #define IS_IRDA_PRESCALER(__PRESCALER__) ((__PRESCALER__) > 0) |
Kojto | 122:f9eeca106725 | 682 | |
Kojto | 122:f9eeca106725 | 683 | /** |
Kojto | 122:f9eeca106725 | 684 | * @brief Ensure that IRDA frame length is valid. |
Kojto | 122:f9eeca106725 | 685 | * @param __LENGTH__: IRDA frame length. |
Kojto | 122:f9eeca106725 | 686 | * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid) |
Kojto | 122:f9eeca106725 | 687 | */ |
Kojto | 122:f9eeca106725 | 688 | #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \ |
Kojto | 122:f9eeca106725 | 689 | ((__LENGTH__) == IRDA_WORDLENGTH_8B) || \ |
Kojto | 122:f9eeca106725 | 690 | ((__LENGTH__) == IRDA_WORDLENGTH_9B)) |
Kojto | 122:f9eeca106725 | 691 | |
Kojto | 122:f9eeca106725 | 692 | /** |
Kojto | 122:f9eeca106725 | 693 | * @brief Ensure that IRDA frame parity is valid. |
Kojto | 122:f9eeca106725 | 694 | * @param __PARITY__: IRDA frame parity. |
Kojto | 122:f9eeca106725 | 695 | * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid) |
Kojto | 122:f9eeca106725 | 696 | */ |
Kojto | 122:f9eeca106725 | 697 | #define IS_IRDA_PARITY(__PARITY__) (((__PARITY__) == IRDA_PARITY_NONE) || \ |
Kojto | 122:f9eeca106725 | 698 | ((__PARITY__) == IRDA_PARITY_EVEN) || \ |
Kojto | 122:f9eeca106725 | 699 | ((__PARITY__) == IRDA_PARITY_ODD)) |
Kojto | 122:f9eeca106725 | 700 | |
Kojto | 122:f9eeca106725 | 701 | /** |
Kojto | 122:f9eeca106725 | 702 | * @brief Ensure that IRDA communication mode is valid. |
Kojto | 122:f9eeca106725 | 703 | * @param __MODE__: IRDA communication mode. |
Kojto | 122:f9eeca106725 | 704 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
Kojto | 122:f9eeca106725 | 705 | */ |
Kojto | 122:f9eeca106725 | 706 | #define IS_IRDA_TX_RX_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(IRDA_MODE_TX_RX)))) == (uint32_t)0x00) && ((__MODE__) != (uint32_t)0x00)) |
Kojto | 122:f9eeca106725 | 707 | |
Kojto | 122:f9eeca106725 | 708 | /** |
Kojto | 122:f9eeca106725 | 709 | * @brief Ensure that IRDA power mode is valid. |
Kojto | 122:f9eeca106725 | 710 | * @param __MODE__: IRDA power mode. |
Kojto | 122:f9eeca106725 | 711 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
Kojto | 122:f9eeca106725 | 712 | */ |
Kojto | 122:f9eeca106725 | 713 | #define IS_IRDA_POWERMODE(__MODE__) (((__MODE__) == IRDA_POWERMODE_LOWPOWER) || \ |
Kojto | 122:f9eeca106725 | 714 | ((__MODE__) == IRDA_POWERMODE_NORMAL)) |
Kojto | 122:f9eeca106725 | 715 | |
Kojto | 122:f9eeca106725 | 716 | /** |
Kojto | 122:f9eeca106725 | 717 | * @brief Ensure that IRDA state is valid. |
Kojto | 122:f9eeca106725 | 718 | * @param __STATE__: IRDA state mode. |
Kojto | 122:f9eeca106725 | 719 | * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) |
Kojto | 122:f9eeca106725 | 720 | */ |
Kojto | 122:f9eeca106725 | 721 | #define IS_IRDA_STATE(__STATE__) (((__STATE__) == IRDA_STATE_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 722 | ((__STATE__) == IRDA_STATE_ENABLE)) |
Kojto | 122:f9eeca106725 | 723 | |
Kojto | 122:f9eeca106725 | 724 | /** |
Kojto | 122:f9eeca106725 | 725 | * @brief Ensure that IRDA associated UART/USART mode is valid. |
Kojto | 122:f9eeca106725 | 726 | * @param __MODE__: IRDA associated UART/USART mode. |
Kojto | 122:f9eeca106725 | 727 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
Kojto | 122:f9eeca106725 | 728 | */ |
Kojto | 122:f9eeca106725 | 729 | #define IS_IRDA_MODE(__MODE__) (((__MODE__) == IRDA_MODE_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 730 | ((__MODE__) == IRDA_MODE_ENABLE)) |
Kojto | 122:f9eeca106725 | 731 | |
Kojto | 122:f9eeca106725 | 732 | /** |
Kojto | 122:f9eeca106725 | 733 | * @brief Ensure that IRDA sampling rate is valid. |
Kojto | 122:f9eeca106725 | 734 | * @param __ONEBIT__: IRDA sampling rate. |
Kojto | 122:f9eeca106725 | 735 | * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid) |
Kojto | 122:f9eeca106725 | 736 | */ |
Kojto | 122:f9eeca106725 | 737 | #define IS_IRDA_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == IRDA_ONE_BIT_SAMPLE_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 738 | ((__ONEBIT__) == IRDA_ONE_BIT_SAMPLE_ENABLE)) |
Kojto | 122:f9eeca106725 | 739 | |
Kojto | 122:f9eeca106725 | 740 | /** |
Kojto | 122:f9eeca106725 | 741 | * @brief Ensure that IRDA DMA TX mode is valid. |
Kojto | 122:f9eeca106725 | 742 | * @param __DMATX__: IRDA DMA TX mode. |
Kojto | 122:f9eeca106725 | 743 | * @retval SET (__DMATX__ is valid) or RESET (__DMATX__ is invalid) |
Kojto | 122:f9eeca106725 | 744 | */ |
Kojto | 122:f9eeca106725 | 745 | #define IS_IRDA_DMA_TX(__DMATX__) (((__DMATX__) == IRDA_DMA_TX_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 746 | ((__DMATX__) == IRDA_DMA_TX_ENABLE)) |
Kojto | 122:f9eeca106725 | 747 | |
Kojto | 122:f9eeca106725 | 748 | /** |
Kojto | 122:f9eeca106725 | 749 | * @brief Ensure that IRDA DMA RX mode is valid. |
Kojto | 122:f9eeca106725 | 750 | * @param __DMARX__: IRDA DMA RX mode. |
Kojto | 122:f9eeca106725 | 751 | * @retval SET (__DMARX__ is valid) or RESET (__DMARX__ is invalid) |
Kojto | 122:f9eeca106725 | 752 | */ |
Kojto | 122:f9eeca106725 | 753 | #define IS_IRDA_DMA_RX(__DMARX__) (((__DMARX__) == IRDA_DMA_RX_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 754 | ((__DMARX__) == IRDA_DMA_RX_ENABLE)) |
Kojto | 122:f9eeca106725 | 755 | |
Kojto | 122:f9eeca106725 | 756 | /** |
Kojto | 122:f9eeca106725 | 757 | * @brief Ensure that IRDA request is valid. |
Kojto | 122:f9eeca106725 | 758 | * @param __PARAM__: IRDA request. |
Kojto | 122:f9eeca106725 | 759 | * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid) |
Kojto | 122:f9eeca106725 | 760 | */ |
Kojto | 122:f9eeca106725 | 761 | #define IS_IRDA_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == IRDA_AUTOBAUD_REQUEST) || \ |
Kojto | 122:f9eeca106725 | 762 | ((__PARAM__) == IRDA_RXDATA_FLUSH_REQUEST) || \ |
Kojto | 122:f9eeca106725 | 763 | ((__PARAM__) == IRDA_TXDATA_FLUSH_REQUEST)) |
Kojto | 122:f9eeca106725 | 764 | /** |
Kojto | 122:f9eeca106725 | 765 | * @} |
Kojto | 122:f9eeca106725 | 766 | */ |
Kojto | 122:f9eeca106725 | 767 | |
Kojto | 122:f9eeca106725 | 768 | /* Include IRDA HAL Extended module */ |
Kojto | 122:f9eeca106725 | 769 | #include "stm32l4xx_hal_irda_ex.h" |
Kojto | 122:f9eeca106725 | 770 | |
Kojto | 122:f9eeca106725 | 771 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 772 | /** @addtogroup IRDA_Exported_Functions IRDA Exported Functions |
Kojto | 122:f9eeca106725 | 773 | * @{ |
Kojto | 122:f9eeca106725 | 774 | */ |
Kojto | 122:f9eeca106725 | 775 | |
Kojto | 122:f9eeca106725 | 776 | /** @addtogroup IRDA_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 122:f9eeca106725 | 777 | * @{ |
Kojto | 122:f9eeca106725 | 778 | */ |
Kojto | 122:f9eeca106725 | 779 | |
Kojto | 122:f9eeca106725 | 780 | /* Initialization and de-initialization functions ****************************/ |
Kojto | 122:f9eeca106725 | 781 | HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 782 | HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 783 | void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 784 | void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 785 | |
Kojto | 122:f9eeca106725 | 786 | /** |
Kojto | 122:f9eeca106725 | 787 | * @} |
Kojto | 122:f9eeca106725 | 788 | */ |
Kojto | 122:f9eeca106725 | 789 | |
Kojto | 122:f9eeca106725 | 790 | /** @addtogroup IRDA_Exported_Functions_Group2 IO operation functions |
Kojto | 122:f9eeca106725 | 791 | * @{ |
Kojto | 122:f9eeca106725 | 792 | */ |
Kojto | 122:f9eeca106725 | 793 | |
Kojto | 122:f9eeca106725 | 794 | /* IO operation functions *****************************************************/ |
Kojto | 122:f9eeca106725 | 795 | HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 796 | HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 797 | HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 798 | HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 799 | HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 800 | HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 801 | HAL_StatusTypeDef HAL_IRDA_DMAPause(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 802 | HAL_StatusTypeDef HAL_IRDA_DMAResume(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 803 | HAL_StatusTypeDef HAL_IRDA_DMAStop(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 804 | void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 805 | void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 806 | void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 807 | void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 808 | void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 809 | void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 810 | |
Kojto | 122:f9eeca106725 | 811 | /** |
Kojto | 122:f9eeca106725 | 812 | * @} |
Kojto | 122:f9eeca106725 | 813 | */ |
Kojto | 122:f9eeca106725 | 814 | |
Kojto | 122:f9eeca106725 | 815 | /* Peripheral Control functions ************************************************/ |
Kojto | 122:f9eeca106725 | 816 | |
Kojto | 122:f9eeca106725 | 817 | /** @addtogroup IRDA_Exported_Functions_Group4 Peripheral State and Error functions |
Kojto | 122:f9eeca106725 | 818 | * @{ |
Kojto | 122:f9eeca106725 | 819 | */ |
Kojto | 122:f9eeca106725 | 820 | |
Kojto | 122:f9eeca106725 | 821 | /* Peripheral State and Error functions ***************************************/ |
Kojto | 122:f9eeca106725 | 822 | HAL_IRDA_StateTypeDef HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 823 | uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda); |
Kojto | 122:f9eeca106725 | 824 | |
Kojto | 122:f9eeca106725 | 825 | /** |
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 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 842 | } |
Kojto | 122:f9eeca106725 | 843 | #endif |
Kojto | 122:f9eeca106725 | 844 | |
Kojto | 122:f9eeca106725 | 845 | #endif /* __STM32L4xx_HAL_IRDA_H */ |
Kojto | 122:f9eeca106725 | 846 | |
Kojto | 122:f9eeca106725 | 847 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |