meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Parent:
90:cb3d968589d8
Child:
108:34e6b704fe68
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

Who changed what in which revision?

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