my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
93:e188a91d3eaa
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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