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