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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Tue Mar 14 16:20:51 2017 +0000
Revision:
138:093f2bd7b9eb
Parent:
135:176b8275d35d
Child:
139:856d2700e60b
Release 138 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3716: fix for issue #3715: correction in startup files for ARM and IAR, alignment of system_stm32f429xx.c files https://github.com/ARMmbed/mbed-os/pull/3716
3741: STM32 remove warning in hal_tick_32b.c file https://github.com/ARMmbed/mbed-os/pull/3741
3780: STM32L4 : Fix GPIO G port compatibility https://github.com/ARMmbed/mbed-os/pull/3780
3831: NCS36510: SPISLAVE enabled (Conflict resolved) https://github.com/ARMmbed/mbed-os/pull/3831
3836: Allow to redefine nRF's PSTORAGE_NUM_OF_PAGES outside of the mbed-os https://github.com/ARMmbed/mbed-os/pull/3836
3840: STM32: gpio SPEED - always set High Speed by default https://github.com/ARMmbed/mbed-os/pull/3840
3844: STM32 GPIO: Typo correction. Update comment (GPIO_IP_WITHOUT_BRR) https://github.com/ARMmbed/mbed-os/pull/3844
3850: STM32: change spi error to debug warning https://github.com/ARMmbed/mbed-os/pull/3850
3860: Define GPIO_IP_WITHOUT_BRR for xDot platform https://github.com/ARMmbed/mbed-os/pull/3860
3880: DISCO_F469NI: allow the use of CAN2 instance when CAN1 is not activated https://github.com/ARMmbed/mbed-os/pull/3880
3795: Fix pwm period calc https://github.com/ARMmbed/mbed-os/pull/3795
3828: STM32 CAN API: correct format and type https://github.com/ARMmbed/mbed-os/pull/3828
3842: TARGET_NRF: corrected spi_init() to properly handle re-initialization https://github.com/ARMmbed/mbed-os/pull/3842
3843: STM32L476xG: set APB2 clock to 80MHz (instead of 40MHz) https://github.com/ARMmbed/mbed-os/pull/3843
3879: NUCLEO_F446ZE: Add missing AnalogIn pins on PF_3, PF_5 and PF_10. https://github.com/ARMmbed/mbed-os/pull/3879
3902: Fix heap and stack size for NUCLEO_F746ZG https://github.com/ARMmbed/mbed-os/pull/3902
3829: can_write(): return error code when no tx mailboxes are available https://github.com/ARMmbed/mbed-os/pull/3829

Who changed what in which revision?

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