mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Nov 03 10:30:07 2014 +0000
Revision:
381:5460fc57b6e4
Synchronized with git revision 02478cd1f27fc7b9643486472635eb515b2bca81

Full URL: https://github.com/mbedmicro/mbed/commit/02478cd1f27fc7b9643486472635eb515b2bca81/

Target: LPC1549 - Fix serial interrupt issues (issue report #616)

Who changed what in which revision?

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