Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
108:34e6b704fe68
.

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_ex.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
Kojto 108:34e6b704fe68 5 * @version V1.3.0
Kojto 108:34e6b704fe68 6 * @date 26-June-2015
bogdanm 85:024bf7f99721 7 * @brief Header file of IRDA HAL Extension module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
Kojto 108:34e6b704fe68 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
Kojto 108:34e6b704fe68 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_IRDA_EX_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_IRDA_EX_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
Kojto 93:e188a91d3eaa 46 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 47
bogdanm 85:024bf7f99721 48 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 49 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 50
bogdanm 85:024bf7f99721 51 /** @addtogroup STM32F0xx_HAL_Driver
bogdanm 85:024bf7f99721 52 * @{
bogdanm 85:024bf7f99721 53 */
bogdanm 85:024bf7f99721 54
Kojto 108:34e6b704fe68 55 /** @addtogroup IRDAEx IRDAEx
bogdanm 85:024bf7f99721 56 * @{
Kojto 108:34e6b704fe68 57 */
bogdanm 85:024bf7f99721 58
bogdanm 85:024bf7f99721 59 /* Exported types ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 60 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 61 /** @defgroup IRDAEx_Exported_Constants IRDAEx Exported Constants
bogdanm 85:024bf7f99721 62 * @{
bogdanm 85:024bf7f99721 63 */
bogdanm 85:024bf7f99721 64
bogdanm 85:024bf7f99721 65 /** @defgroup IRDAEx_Word_Length IRDA Word Length
bogdanm 85:024bf7f99721 66 * @{
bogdanm 85:024bf7f99721 67 */
bogdanm 85:024bf7f99721 68 #if defined (STM32F042x6) || defined (STM32F048xx) || \
bogdanm 92:4fc01daae5a5 69 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
bogdanm 92:4fc01daae5a5 70 defined (STM32F091xC) || defined (STM32F098xx)
Kojto 108:34e6b704fe68 71 #define IRDA_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) /*!< 7-bit long frame */
Kojto 108:34e6b704fe68 72 #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000) /*!< 8-bit long frame */
Kojto 108:34e6b704fe68 73 #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< 9-bit long frame */
bogdanm 85:024bf7f99721 74 #else
Kojto 108:34e6b704fe68 75 #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000) /*!< 8-bit long frame */
Kojto 108:34e6b704fe68 76 #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M) /*!< 9-bit long frame */
bogdanm 85:024bf7f99721 77 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
bogdanm 92:4fc01daae5a5 78 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
bogdanm 92:4fc01daae5a5 79 defined (STM32F091xC) || defined (STM32F098xx)*/
bogdanm 85:024bf7f99721 80 /**
bogdanm 85:024bf7f99721 81 * @}
bogdanm 85:024bf7f99721 82 */
Kojto 108:34e6b704fe68 83
bogdanm 85:024bf7f99721 84 /**
bogdanm 85:024bf7f99721 85 * @}
bogdanm 85:024bf7f99721 86 */
bogdanm 85:024bf7f99721 87
bogdanm 85:024bf7f99721 88 /* Exported macros -----------------------------------------------------------*/
Kojto 108:34e6b704fe68 89 /* Exported functions --------------------------------------------------------*/
bogdanm 85:024bf7f99721 90
Kojto 108:34e6b704fe68 91 /* Private macros ------------------------------------------------------------*/
Kojto 108:34e6b704fe68 92
Kojto 108:34e6b704fe68 93 /** @defgroup IRDAEx_Private_Macros IRDAEx Private Macros
bogdanm 85:024bf7f99721 94 * @{
bogdanm 85:024bf7f99721 95 */
Kojto 108:34e6b704fe68 96
Kojto 108:34e6b704fe68 97 /** @brief Report the IRDA clock source.
Kojto 108:34e6b704fe68 98 * @param __HANDLE__: specifies the IRDA Handle.
Kojto 108:34e6b704fe68 99 * @param __CLOCKSOURCE__: output variable.
bogdanm 92:4fc01daae5a5 100 * @retval IRDA clocking source, written in __CLOCKSOURCE__.
bogdanm 92:4fc01daae5a5 101 */
bogdanm 92:4fc01daae5a5 102
Kojto 93:e188a91d3eaa 103 #if defined(STM32F031x6) || defined(STM32F038xx)
Kojto 108:34e6b704fe68 104 #define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 92:4fc01daae5a5 105 do { \
bogdanm 92:4fc01daae5a5 106 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 92:4fc01daae5a5 107 { \
bogdanm 92:4fc01daae5a5 108 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 109 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 110 break; \
bogdanm 92:4fc01daae5a5 111 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 112 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 113 break; \
bogdanm 92:4fc01daae5a5 114 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 115 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 116 break; \
bogdanm 92:4fc01daae5a5 117 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 118 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 119 break; \
bogdanm 92:4fc01daae5a5 120 default: \
bogdanm 92:4fc01daae5a5 121 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 122 break; \
bogdanm 92:4fc01daae5a5 123 } \
bogdanm 92:4fc01daae5a5 124 } while(0)
Kojto 93:e188a91d3eaa 125 #elif defined (STM32F042x6) || defined (STM32F048xx) || \
bogdanm 92:4fc01daae5a5 126 defined (STM32F051x8) || defined (STM32F058xx)
Kojto 108:34e6b704fe68 127 #define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 92:4fc01daae5a5 128 do { \
bogdanm 92:4fc01daae5a5 129 if((__HANDLE__)->Instance == USART1) \
bogdanm 92:4fc01daae5a5 130 { \
bogdanm 92:4fc01daae5a5 131 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 92:4fc01daae5a5 132 { \
bogdanm 92:4fc01daae5a5 133 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 134 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 135 break; \
bogdanm 92:4fc01daae5a5 136 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 137 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 138 break; \
bogdanm 92:4fc01daae5a5 139 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 140 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 141 break; \
bogdanm 92:4fc01daae5a5 142 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 143 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 144 break; \
bogdanm 92:4fc01daae5a5 145 default: \
bogdanm 92:4fc01daae5a5 146 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 147 break; \
bogdanm 92:4fc01daae5a5 148 } \
bogdanm 92:4fc01daae5a5 149 } \
bogdanm 92:4fc01daae5a5 150 else if((__HANDLE__)->Instance == USART2) \
bogdanm 92:4fc01daae5a5 151 { \
bogdanm 92:4fc01daae5a5 152 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 153 } \
bogdanm 92:4fc01daae5a5 154 else \
bogdanm 92:4fc01daae5a5 155 { \
bogdanm 92:4fc01daae5a5 156 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 157 } \
bogdanm 92:4fc01daae5a5 158 } while(0)
bogdanm 92:4fc01daae5a5 159 #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
Kojto 108:34e6b704fe68 160 #define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 92:4fc01daae5a5 161 do { \
bogdanm 92:4fc01daae5a5 162 if((__HANDLE__)->Instance == USART1) \
bogdanm 92:4fc01daae5a5 163 { \
bogdanm 92:4fc01daae5a5 164 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 92:4fc01daae5a5 165 { \
bogdanm 92:4fc01daae5a5 166 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 167 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 168 break; \
bogdanm 92:4fc01daae5a5 169 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 170 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 171 break; \
bogdanm 92:4fc01daae5a5 172 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 173 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 174 break; \
bogdanm 92:4fc01daae5a5 175 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 176 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 177 break; \
bogdanm 92:4fc01daae5a5 178 default: \
bogdanm 92:4fc01daae5a5 179 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 180 break; \
bogdanm 92:4fc01daae5a5 181 } \
bogdanm 92:4fc01daae5a5 182 } \
bogdanm 92:4fc01daae5a5 183 else if((__HANDLE__)->Instance == USART2) \
bogdanm 92:4fc01daae5a5 184 { \
bogdanm 92:4fc01daae5a5 185 switch(__HAL_RCC_GET_USART2_SOURCE()) \
bogdanm 92:4fc01daae5a5 186 { \
bogdanm 92:4fc01daae5a5 187 case RCC_USART2CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 188 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 189 break; \
bogdanm 92:4fc01daae5a5 190 case RCC_USART2CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 191 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 192 break; \
bogdanm 92:4fc01daae5a5 193 case RCC_USART2CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 194 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 195 break; \
bogdanm 92:4fc01daae5a5 196 case RCC_USART2CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 197 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 198 break; \
bogdanm 92:4fc01daae5a5 199 default: \
bogdanm 92:4fc01daae5a5 200 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 201 break; \
bogdanm 92:4fc01daae5a5 202 } \
bogdanm 92:4fc01daae5a5 203 } \
bogdanm 92:4fc01daae5a5 204 else if((__HANDLE__)->Instance == USART3) \
bogdanm 92:4fc01daae5a5 205 { \
bogdanm 92:4fc01daae5a5 206 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 207 } \
bogdanm 92:4fc01daae5a5 208 else if((__HANDLE__)->Instance == USART4) \
bogdanm 92:4fc01daae5a5 209 { \
bogdanm 92:4fc01daae5a5 210 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 211 } \
bogdanm 92:4fc01daae5a5 212 else \
bogdanm 92:4fc01daae5a5 213 { \
bogdanm 92:4fc01daae5a5 214 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 215 } \
bogdanm 92:4fc01daae5a5 216 } while(0)
bogdanm 92:4fc01daae5a5 217 #elif defined(STM32F091xC) || defined(STM32F098xx)
Kojto 108:34e6b704fe68 218 #define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 92:4fc01daae5a5 219 do { \
bogdanm 92:4fc01daae5a5 220 if((__HANDLE__)->Instance == USART1) \
bogdanm 92:4fc01daae5a5 221 { \
bogdanm 92:4fc01daae5a5 222 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 92:4fc01daae5a5 223 { \
bogdanm 92:4fc01daae5a5 224 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 225 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 226 break; \
bogdanm 92:4fc01daae5a5 227 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 228 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 229 break; \
bogdanm 92:4fc01daae5a5 230 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 231 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 232 break; \
bogdanm 92:4fc01daae5a5 233 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 234 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 235 break; \
bogdanm 92:4fc01daae5a5 236 default: \
bogdanm 92:4fc01daae5a5 237 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 238 break; \
bogdanm 92:4fc01daae5a5 239 } \
bogdanm 92:4fc01daae5a5 240 } \
bogdanm 92:4fc01daae5a5 241 else if((__HANDLE__)->Instance == USART2) \
bogdanm 92:4fc01daae5a5 242 { \
bogdanm 92:4fc01daae5a5 243 switch(__HAL_RCC_GET_USART2_SOURCE()) \
bogdanm 92:4fc01daae5a5 244 { \
bogdanm 92:4fc01daae5a5 245 case RCC_USART2CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 246 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 247 break; \
bogdanm 92:4fc01daae5a5 248 case RCC_USART2CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 249 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 250 break; \
bogdanm 92:4fc01daae5a5 251 case RCC_USART2CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 252 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 253 break; \
bogdanm 92:4fc01daae5a5 254 case RCC_USART2CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 255 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 256 break; \
bogdanm 92:4fc01daae5a5 257 default: \
bogdanm 92:4fc01daae5a5 258 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 259 break; \
bogdanm 92:4fc01daae5a5 260 } \
bogdanm 92:4fc01daae5a5 261 } \
bogdanm 92:4fc01daae5a5 262 else if((__HANDLE__)->Instance == USART3) \
bogdanm 92:4fc01daae5a5 263 { \
bogdanm 92:4fc01daae5a5 264 switch(__HAL_RCC_GET_USART3_SOURCE()) \
bogdanm 92:4fc01daae5a5 265 { \
bogdanm 92:4fc01daae5a5 266 case RCC_USART3CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 267 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 268 break; \
bogdanm 92:4fc01daae5a5 269 case RCC_USART3CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 270 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 271 break; \
bogdanm 92:4fc01daae5a5 272 case RCC_USART3CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 273 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 274 break; \
bogdanm 92:4fc01daae5a5 275 case RCC_USART3CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 276 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 277 break; \
bogdanm 92:4fc01daae5a5 278 default: \
bogdanm 92:4fc01daae5a5 279 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 280 break; \
bogdanm 92:4fc01daae5a5 281 } \
bogdanm 92:4fc01daae5a5 282 } \
bogdanm 92:4fc01daae5a5 283 else if((__HANDLE__)->Instance == USART4) \
bogdanm 92:4fc01daae5a5 284 { \
bogdanm 92:4fc01daae5a5 285 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 286 } \
bogdanm 92:4fc01daae5a5 287 else if((__HANDLE__)->Instance == USART5) \
bogdanm 92:4fc01daae5a5 288 { \
bogdanm 92:4fc01daae5a5 289 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 290 } \
bogdanm 92:4fc01daae5a5 291 else if((__HANDLE__)->Instance == USART6) \
bogdanm 92:4fc01daae5a5 292 { \
bogdanm 92:4fc01daae5a5 293 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 294 } \
bogdanm 92:4fc01daae5a5 295 else if((__HANDLE__)->Instance == USART7) \
bogdanm 92:4fc01daae5a5 296 { \
bogdanm 92:4fc01daae5a5 297 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 298 } \
bogdanm 92:4fc01daae5a5 299 else if((__HANDLE__)->Instance == USART8) \
bogdanm 92:4fc01daae5a5 300 { \
bogdanm 92:4fc01daae5a5 301 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 302 } \
bogdanm 92:4fc01daae5a5 303 else \
bogdanm 92:4fc01daae5a5 304 { \
bogdanm 92:4fc01daae5a5 305 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 306 } \
bogdanm 92:4fc01daae5a5 307 } while(0)
Kojto 108:34e6b704fe68 308
Kojto 93:e188a91d3eaa 309 #endif /* defined(STM32F031x6) || defined(STM32F038xx) */
Kojto 108:34e6b704fe68 310
Kojto 108:34e6b704fe68 311
Kojto 108:34e6b704fe68 312 /** @brief Compute the mask to apply to retrieve the received data
bogdanm 85:024bf7f99721 313 * according to the word length and to the parity bits activation.
Kojto 108:34e6b704fe68 314 * @note If PCE = 1, the parity bit is not included in the data extracted
Kojto 108:34e6b704fe68 315 * by the reception API().
Kojto 108:34e6b704fe68 316 * This masking operation is not carried out in the case of
Kojto 108:34e6b704fe68 317 * DMA transfers.
bogdanm 85:024bf7f99721 318 * @param __HANDLE__: specifies the IRDA Handle
Kojto 108:34e6b704fe68 319 * @retval None, the mask to apply to IRDA RDR register is stored in (__HANDLE__)->Mask field.
bogdanm 85:024bf7f99721 320 */
bogdanm 85:024bf7f99721 321 #if defined (STM32F042x6) || defined (STM32F048xx) || \
bogdanm 92:4fc01daae5a5 322 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
bogdanm 92:4fc01daae5a5 323 defined (STM32F091xC) || defined (STM32F098xx)
Kojto 108:34e6b704fe68 324 #define IRDA_MASK_COMPUTATION(__HANDLE__) \
bogdanm 85:024bf7f99721 325 do { \
bogdanm 85:024bf7f99721 326 if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
bogdanm 85:024bf7f99721 327 { \
bogdanm 85:024bf7f99721 328 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 85:024bf7f99721 329 { \
bogdanm 85:024bf7f99721 330 (__HANDLE__)->Mask = 0x01FF ; \
bogdanm 85:024bf7f99721 331 } \
bogdanm 85:024bf7f99721 332 else \
bogdanm 85:024bf7f99721 333 { \
bogdanm 85:024bf7f99721 334 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 335 } \
bogdanm 85:024bf7f99721 336 } \
bogdanm 85:024bf7f99721 337 else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
bogdanm 85:024bf7f99721 338 { \
bogdanm 85:024bf7f99721 339 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 85:024bf7f99721 340 { \
bogdanm 85:024bf7f99721 341 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 342 } \
bogdanm 85:024bf7f99721 343 else \
bogdanm 85:024bf7f99721 344 { \
bogdanm 85:024bf7f99721 345 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 85:024bf7f99721 346 } \
bogdanm 85:024bf7f99721 347 } \
bogdanm 85:024bf7f99721 348 else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \
bogdanm 85:024bf7f99721 349 { \
bogdanm 85:024bf7f99721 350 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 85:024bf7f99721 351 { \
bogdanm 85:024bf7f99721 352 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 85:024bf7f99721 353 } \
bogdanm 85:024bf7f99721 354 else \
bogdanm 85:024bf7f99721 355 { \
bogdanm 85:024bf7f99721 356 (__HANDLE__)->Mask = 0x003F ; \
bogdanm 85:024bf7f99721 357 } \
bogdanm 85:024bf7f99721 358 } \
bogdanm 85:024bf7f99721 359 } while(0)
bogdanm 85:024bf7f99721 360 #else
Kojto 108:34e6b704fe68 361 #define IRDA_MASK_COMPUTATION(__HANDLE__) \
bogdanm 85:024bf7f99721 362 do { \
bogdanm 85:024bf7f99721 363 if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
bogdanm 85:024bf7f99721 364 { \
bogdanm 85:024bf7f99721 365 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 85:024bf7f99721 366 { \
bogdanm 85:024bf7f99721 367 (__HANDLE__)->Mask = 0x01FF ; \
bogdanm 85:024bf7f99721 368 } \
bogdanm 85:024bf7f99721 369 else \
bogdanm 85:024bf7f99721 370 { \
bogdanm 85:024bf7f99721 371 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 372 } \
bogdanm 85:024bf7f99721 373 } \
bogdanm 85:024bf7f99721 374 else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
bogdanm 85:024bf7f99721 375 { \
bogdanm 85:024bf7f99721 376 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 85:024bf7f99721 377 { \
bogdanm 85:024bf7f99721 378 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 379 } \
bogdanm 85:024bf7f99721 380 else \
bogdanm 85:024bf7f99721 381 { \
bogdanm 85:024bf7f99721 382 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 85:024bf7f99721 383 } \
bogdanm 85:024bf7f99721 384 } \
bogdanm 85:024bf7f99721 385 } while(0)
bogdanm 85:024bf7f99721 386 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
bogdanm 92:4fc01daae5a5 387 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
bogdanm 92:4fc01daae5a5 388 defined (STM32F091xC) || defined(STM32F098xx) */
Kojto 108:34e6b704fe68 389
Kojto 108:34e6b704fe68 390 /**
Kojto 108:34e6b704fe68 391 * @brief Ensure that IRDA frame length is valid.
Kojto 108:34e6b704fe68 392 * @param __LENGTH__: IRDA frame length.
Kojto 108:34e6b704fe68 393 * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
Kojto 108:34e6b704fe68 394 */
Kojto 108:34e6b704fe68 395 #if defined (STM32F042x6) || defined (STM32F048xx) || \
Kojto 108:34e6b704fe68 396 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
Kojto 108:34e6b704fe68 397 defined (STM32F091xC) || defined (STM32F098xx)
Kojto 108:34e6b704fe68 398 #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \
Kojto 108:34e6b704fe68 399 ((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
Kojto 108:34e6b704fe68 400 ((__LENGTH__) == IRDA_WORDLENGTH_9B))
Kojto 108:34e6b704fe68 401 #else
Kojto 108:34e6b704fe68 402 #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
Kojto 108:34e6b704fe68 403 ((__LENGTH__) == IRDA_WORDLENGTH_9B))
Kojto 108:34e6b704fe68 404 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
Kojto 108:34e6b704fe68 405 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
Kojto 108:34e6b704fe68 406 defined (STM32F091xC) || defined (STM32F098xx)*/
Kojto 108:34e6b704fe68 407
bogdanm 85:024bf7f99721 408 /**
bogdanm 85:024bf7f99721 409 * @}
bogdanm 85:024bf7f99721 410 */
Kojto 108:34e6b704fe68 411
bogdanm 85:024bf7f99721 412 /* Exported functions --------------------------------------------------------*/
bogdanm 85:024bf7f99721 413
bogdanm 85:024bf7f99721 414 /**
bogdanm 85:024bf7f99721 415 * @}
Kojto 108:34e6b704fe68 416 */
bogdanm 85:024bf7f99721 417
bogdanm 85:024bf7f99721 418 /**
bogdanm 85:024bf7f99721 419 * @}
Kojto 108:34e6b704fe68 420 */
bogdanm 85:024bf7f99721 421
Kojto 93:e188a91d3eaa 422 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 423
bogdanm 85:024bf7f99721 424 #ifdef __cplusplus
bogdanm 85:024bf7f99721 425 }
bogdanm 85:024bf7f99721 426 #endif
bogdanm 85:024bf7f99721 427
bogdanm 85:024bf7f99721 428 #endif /* __STM32F0xx_HAL_IRDA_EX_H */
bogdanm 85:024bf7f99721 429
bogdanm 85:024bf7f99721 430 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 431