The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
93:e188a91d3eaa
12

Who changed what in which revision?

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