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