/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }
Fork of mbed by
TARGET_NUCLEO_F072RB/stm32f0xx_hal_irda_ex.h@92:4fc01daae5a5, 2014-11-27 (annotated)
- Committer:
- bogdanm
- Date:
- Thu Nov 27 13:33:22 2014 +0000
- Revision:
- 92:4fc01daae5a5
- Parent:
- 85:024bf7f99721
Release 92 of the mbed libray
Main changes:
- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)
Who changed what in which revision?
User | Revision | Line number | New 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 |
bogdanm | 92:4fc01daae5a5 | 5 | * @version V1.1.0 |
bogdanm | 92:4fc01daae5a5 | 6 | * @date 03-Oct-2014 |
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 | * |
bogdanm | 85:024bf7f99721 | 11 | * <h2><center>© COPYRIGHT(c) 2014 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 | * |
bogdanm | 85:024bf7f99721 | 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 | |
bogdanm | 85:024bf7f99721 | 46 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
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 | |
bogdanm | 92:4fc01daae5a5 | 55 | /** @addtogroup IRDAEx IRDAEx Extended HAL module driver |
bogdanm | 85:024bf7f99721 | 56 | * @{ |
bogdanm | 85:024bf7f99721 | 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) |
bogdanm | 85:024bf7f99721 | 71 | #define IRDA_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) |
bogdanm | 85:024bf7f99721 | 72 | #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 73 | #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) |
bogdanm | 85:024bf7f99721 | 74 | #define IS_IRDA_WORD_LENGTH(LENGTH) (((LENGTH) == IRDA_WORDLENGTH_7B) || \ |
bogdanm | 85:024bf7f99721 | 75 | ((LENGTH) == IRDA_WORDLENGTH_8B) || \ |
bogdanm | 85:024bf7f99721 | 76 | ((LENGTH) == IRDA_WORDLENGTH_9B)) |
bogdanm | 85:024bf7f99721 | 77 | #else |
bogdanm | 85:024bf7f99721 | 78 | #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 79 | #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M) |
bogdanm | 85:024bf7f99721 | 80 | #define IS_IRDA_WORD_LENGTH(LENGTH) (((LENGTH) == IRDA_WORDLENGTH_8B) || \ |
bogdanm | 85:024bf7f99721 | 81 | ((LENGTH) == IRDA_WORDLENGTH_9B)) |
bogdanm | 85:024bf7f99721 | 82 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 92:4fc01daae5a5 | 83 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \ |
bogdanm | 92:4fc01daae5a5 | 84 | defined (STM32F091xC) || defined (STM32F098xx)*/ |
bogdanm | 85:024bf7f99721 | 85 | /** |
bogdanm | 85:024bf7f99721 | 86 | * @} |
bogdanm | 85:024bf7f99721 | 87 | */ |
bogdanm | 85:024bf7f99721 | 88 | |
bogdanm | 85:024bf7f99721 | 89 | |
bogdanm | 85:024bf7f99721 | 90 | /** |
bogdanm | 85:024bf7f99721 | 91 | * @} |
bogdanm | 85:024bf7f99721 | 92 | */ |
bogdanm | 85:024bf7f99721 | 93 | |
bogdanm | 85:024bf7f99721 | 94 | /* Exported macros -----------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 95 | |
bogdanm | 92:4fc01daae5a5 | 96 | /** @defgroup IRDAEx_Exported_Macros IRDAEx Exported Macros |
bogdanm | 85:024bf7f99721 | 97 | * @{ |
bogdanm | 85:024bf7f99721 | 98 | */ |
bogdanm | 85:024bf7f99721 | 99 | |
bogdanm | 92:4fc01daae5a5 | 100 | /** @brief Reports the IRDA clock source. |
bogdanm | 92:4fc01daae5a5 | 101 | * @param __HANDLE__: specifies the IRDA Handle |
bogdanm | 92:4fc01daae5a5 | 102 | * @param __CLOCKSOURCE__ : output variable |
bogdanm | 92:4fc01daae5a5 | 103 | * @retval IRDA clocking source, written in __CLOCKSOURCE__. |
bogdanm | 92:4fc01daae5a5 | 104 | */ |
bogdanm | 92:4fc01daae5a5 | 105 | |
bogdanm | 92:4fc01daae5a5 | 106 | #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) |
bogdanm | 92:4fc01daae5a5 | 107 | #define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 92:4fc01daae5a5 | 108 | do { \ |
bogdanm | 92:4fc01daae5a5 | 109 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 110 | { \ |
bogdanm | 92:4fc01daae5a5 | 111 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 112 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 113 | break; \ |
bogdanm | 92:4fc01daae5a5 | 114 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 115 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 116 | break; \ |
bogdanm | 92:4fc01daae5a5 | 117 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 118 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 119 | break; \ |
bogdanm | 92:4fc01daae5a5 | 120 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 121 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 122 | break; \ |
bogdanm | 92:4fc01daae5a5 | 123 | default: \ |
bogdanm | 92:4fc01daae5a5 | 124 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 125 | break; \ |
bogdanm | 92:4fc01daae5a5 | 126 | } \ |
bogdanm | 92:4fc01daae5a5 | 127 | } while(0) |
bogdanm | 92:4fc01daae5a5 | 128 | #elif defined (STM32F030x8) || \ |
bogdanm | 92:4fc01daae5a5 | 129 | defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 92:4fc01daae5a5 | 130 | defined (STM32F051x8) || defined (STM32F058xx) |
bogdanm | 92:4fc01daae5a5 | 131 | #define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 92:4fc01daae5a5 | 132 | do { \ |
bogdanm | 92:4fc01daae5a5 | 133 | if((__HANDLE__)->Instance == USART1) \ |
bogdanm | 92:4fc01daae5a5 | 134 | { \ |
bogdanm | 92:4fc01daae5a5 | 135 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 136 | { \ |
bogdanm | 92:4fc01daae5a5 | 137 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 138 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 139 | break; \ |
bogdanm | 92:4fc01daae5a5 | 140 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 141 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 142 | break; \ |
bogdanm | 92:4fc01daae5a5 | 143 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 144 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 145 | break; \ |
bogdanm | 92:4fc01daae5a5 | 146 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 147 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 148 | break; \ |
bogdanm | 92:4fc01daae5a5 | 149 | default: \ |
bogdanm | 92:4fc01daae5a5 | 150 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 151 | break; \ |
bogdanm | 92:4fc01daae5a5 | 152 | } \ |
bogdanm | 92:4fc01daae5a5 | 153 | } \ |
bogdanm | 92:4fc01daae5a5 | 154 | else if((__HANDLE__)->Instance == USART2) \ |
bogdanm | 92:4fc01daae5a5 | 155 | { \ |
bogdanm | 92:4fc01daae5a5 | 156 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 157 | } \ |
bogdanm | 92:4fc01daae5a5 | 158 | else \ |
bogdanm | 92:4fc01daae5a5 | 159 | { \ |
bogdanm | 92:4fc01daae5a5 | 160 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 161 | } \ |
bogdanm | 92:4fc01daae5a5 | 162 | } while(0) |
bogdanm | 92:4fc01daae5a5 | 163 | #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) |
bogdanm | 92:4fc01daae5a5 | 164 | #define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 92:4fc01daae5a5 | 165 | do { \ |
bogdanm | 92:4fc01daae5a5 | 166 | if((__HANDLE__)->Instance == USART1) \ |
bogdanm | 92:4fc01daae5a5 | 167 | { \ |
bogdanm | 92:4fc01daae5a5 | 168 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 169 | { \ |
bogdanm | 92:4fc01daae5a5 | 170 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 171 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 172 | break; \ |
bogdanm | 92:4fc01daae5a5 | 173 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 174 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 175 | break; \ |
bogdanm | 92:4fc01daae5a5 | 176 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 177 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 178 | break; \ |
bogdanm | 92:4fc01daae5a5 | 179 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 180 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 181 | break; \ |
bogdanm | 92:4fc01daae5a5 | 182 | default: \ |
bogdanm | 92:4fc01daae5a5 | 183 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 184 | break; \ |
bogdanm | 92:4fc01daae5a5 | 185 | } \ |
bogdanm | 92:4fc01daae5a5 | 186 | } \ |
bogdanm | 92:4fc01daae5a5 | 187 | else if((__HANDLE__)->Instance == USART2) \ |
bogdanm | 92:4fc01daae5a5 | 188 | { \ |
bogdanm | 92:4fc01daae5a5 | 189 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 190 | { \ |
bogdanm | 92:4fc01daae5a5 | 191 | case RCC_USART2CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 192 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 193 | break; \ |
bogdanm | 92:4fc01daae5a5 | 194 | case RCC_USART2CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 195 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 196 | break; \ |
bogdanm | 92:4fc01daae5a5 | 197 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 198 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 199 | break; \ |
bogdanm | 92:4fc01daae5a5 | 200 | case RCC_USART2CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 201 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 202 | break; \ |
bogdanm | 92:4fc01daae5a5 | 203 | default: \ |
bogdanm | 92:4fc01daae5a5 | 204 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 205 | break; \ |
bogdanm | 92:4fc01daae5a5 | 206 | } \ |
bogdanm | 92:4fc01daae5a5 | 207 | } \ |
bogdanm | 92:4fc01daae5a5 | 208 | else if((__HANDLE__)->Instance == USART3) \ |
bogdanm | 92:4fc01daae5a5 | 209 | { \ |
bogdanm | 92:4fc01daae5a5 | 210 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 211 | } \ |
bogdanm | 92:4fc01daae5a5 | 212 | else if((__HANDLE__)->Instance == USART4) \ |
bogdanm | 92:4fc01daae5a5 | 213 | { \ |
bogdanm | 92:4fc01daae5a5 | 214 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 215 | } \ |
bogdanm | 92:4fc01daae5a5 | 216 | else \ |
bogdanm | 92:4fc01daae5a5 | 217 | { \ |
bogdanm | 92:4fc01daae5a5 | 218 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 219 | } \ |
bogdanm | 92:4fc01daae5a5 | 220 | } while(0) |
bogdanm | 92:4fc01daae5a5 | 221 | #elif defined(STM32F091xC) || defined(STM32F098xx) |
bogdanm | 92:4fc01daae5a5 | 222 | #define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 92:4fc01daae5a5 | 223 | do { \ |
bogdanm | 92:4fc01daae5a5 | 224 | if((__HANDLE__)->Instance == USART1) \ |
bogdanm | 92:4fc01daae5a5 | 225 | { \ |
bogdanm | 92:4fc01daae5a5 | 226 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 227 | { \ |
bogdanm | 92:4fc01daae5a5 | 228 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 229 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 230 | break; \ |
bogdanm | 92:4fc01daae5a5 | 231 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 232 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 233 | break; \ |
bogdanm | 92:4fc01daae5a5 | 234 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 235 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 236 | break; \ |
bogdanm | 92:4fc01daae5a5 | 237 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 238 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 239 | break; \ |
bogdanm | 92:4fc01daae5a5 | 240 | default: \ |
bogdanm | 92:4fc01daae5a5 | 241 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 242 | break; \ |
bogdanm | 92:4fc01daae5a5 | 243 | } \ |
bogdanm | 92:4fc01daae5a5 | 244 | } \ |
bogdanm | 92:4fc01daae5a5 | 245 | else if((__HANDLE__)->Instance == USART2) \ |
bogdanm | 92:4fc01daae5a5 | 246 | { \ |
bogdanm | 92:4fc01daae5a5 | 247 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 248 | { \ |
bogdanm | 92:4fc01daae5a5 | 249 | case RCC_USART2CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 250 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 251 | break; \ |
bogdanm | 92:4fc01daae5a5 | 252 | case RCC_USART2CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 253 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 254 | break; \ |
bogdanm | 92:4fc01daae5a5 | 255 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 256 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 257 | break; \ |
bogdanm | 92:4fc01daae5a5 | 258 | case RCC_USART2CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 259 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 260 | break; \ |
bogdanm | 92:4fc01daae5a5 | 261 | default: \ |
bogdanm | 92:4fc01daae5a5 | 262 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 263 | break; \ |
bogdanm | 92:4fc01daae5a5 | 264 | } \ |
bogdanm | 92:4fc01daae5a5 | 265 | } \ |
bogdanm | 92:4fc01daae5a5 | 266 | else if((__HANDLE__)->Instance == USART3) \ |
bogdanm | 92:4fc01daae5a5 | 267 | { \ |
bogdanm | 92:4fc01daae5a5 | 268 | switch(__HAL_RCC_GET_USART3_SOURCE()) \ |
bogdanm | 92:4fc01daae5a5 | 269 | { \ |
bogdanm | 92:4fc01daae5a5 | 270 | case RCC_USART3CLKSOURCE_PCLK1: \ |
bogdanm | 92:4fc01daae5a5 | 271 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 272 | break; \ |
bogdanm | 92:4fc01daae5a5 | 273 | case RCC_USART3CLKSOURCE_HSI: \ |
bogdanm | 92:4fc01daae5a5 | 274 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
bogdanm | 92:4fc01daae5a5 | 275 | break; \ |
bogdanm | 92:4fc01daae5a5 | 276 | case RCC_USART3CLKSOURCE_SYSCLK: \ |
bogdanm | 92:4fc01daae5a5 | 277 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 92:4fc01daae5a5 | 278 | break; \ |
bogdanm | 92:4fc01daae5a5 | 279 | case RCC_USART3CLKSOURCE_LSE: \ |
bogdanm | 92:4fc01daae5a5 | 280 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
bogdanm | 92:4fc01daae5a5 | 281 | break; \ |
bogdanm | 92:4fc01daae5a5 | 282 | default: \ |
bogdanm | 92:4fc01daae5a5 | 283 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 284 | break; \ |
bogdanm | 92:4fc01daae5a5 | 285 | } \ |
bogdanm | 92:4fc01daae5a5 | 286 | } \ |
bogdanm | 92:4fc01daae5a5 | 287 | else if((__HANDLE__)->Instance == USART4) \ |
bogdanm | 92:4fc01daae5a5 | 288 | { \ |
bogdanm | 92:4fc01daae5a5 | 289 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 290 | } \ |
bogdanm | 92:4fc01daae5a5 | 291 | else if((__HANDLE__)->Instance == USART5) \ |
bogdanm | 92:4fc01daae5a5 | 292 | { \ |
bogdanm | 92:4fc01daae5a5 | 293 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 294 | } \ |
bogdanm | 92:4fc01daae5a5 | 295 | else if((__HANDLE__)->Instance == USART6) \ |
bogdanm | 92:4fc01daae5a5 | 296 | { \ |
bogdanm | 92:4fc01daae5a5 | 297 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 298 | } \ |
bogdanm | 92:4fc01daae5a5 | 299 | else if((__HANDLE__)->Instance == USART7) \ |
bogdanm | 92:4fc01daae5a5 | 300 | { \ |
bogdanm | 92:4fc01daae5a5 | 301 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 302 | } \ |
bogdanm | 92:4fc01daae5a5 | 303 | else if((__HANDLE__)->Instance == USART8) \ |
bogdanm | 92:4fc01daae5a5 | 304 | { \ |
bogdanm | 92:4fc01daae5a5 | 305 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
bogdanm | 92:4fc01daae5a5 | 306 | } \ |
bogdanm | 92:4fc01daae5a5 | 307 | else \ |
bogdanm | 92:4fc01daae5a5 | 308 | { \ |
bogdanm | 92:4fc01daae5a5 | 309 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 92:4fc01daae5a5 | 310 | } \ |
bogdanm | 92:4fc01daae5a5 | 311 | } while(0) |
bogdanm | 92:4fc01daae5a5 | 312 | |
bogdanm | 92:4fc01daae5a5 | 313 | #endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */ |
bogdanm | 92:4fc01daae5a5 | 314 | |
bogdanm | 92:4fc01daae5a5 | 315 | |
bogdanm | 85:024bf7f99721 | 316 | /** @brief Computes the mask to apply to retrieve the received data |
bogdanm | 85:024bf7f99721 | 317 | * according to the word length and to the parity bits activation. |
bogdanm | 85:024bf7f99721 | 318 | * @param __HANDLE__: specifies the IRDA Handle |
bogdanm | 85:024bf7f99721 | 319 | * @retval none |
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) |
bogdanm | 85:024bf7f99721 | 324 | #define __HAL_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 |
bogdanm | 85:024bf7f99721 | 361 | #define __HAL_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) */ |
bogdanm | 85:024bf7f99721 | 389 | /** |
bogdanm | 85:024bf7f99721 | 390 | * @} |
bogdanm | 85:024bf7f99721 | 391 | */ |
bogdanm | 85:024bf7f99721 | 392 | |
bogdanm | 85:024bf7f99721 | 393 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 394 | /* Initialization and de-initialization functions ****************************/ |
bogdanm | 85:024bf7f99721 | 395 | /* IO operation functions *****************************************************/ |
bogdanm | 85:024bf7f99721 | 396 | /* Peripheral Control functions ***********************************************/ |
bogdanm | 85:024bf7f99721 | 397 | /* Peripheral State and Error functions ***************************************/ |
bogdanm | 85:024bf7f99721 | 398 | |
bogdanm | 85:024bf7f99721 | 399 | /** |
bogdanm | 85:024bf7f99721 | 400 | * @} |
bogdanm | 85:024bf7f99721 | 401 | */ |
bogdanm | 85:024bf7f99721 | 402 | |
bogdanm | 85:024bf7f99721 | 403 | /** |
bogdanm | 85:024bf7f99721 | 404 | * @} |
bogdanm | 85:024bf7f99721 | 405 | */ |
bogdanm | 85:024bf7f99721 | 406 | |
bogdanm | 85:024bf7f99721 | 407 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 408 | |
bogdanm | 85:024bf7f99721 | 409 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 410 | } |
bogdanm | 85:024bf7f99721 | 411 | #endif |
bogdanm | 85:024bf7f99721 | 412 | |
bogdanm | 85:024bf7f99721 | 413 | #endif /* __STM32F0xx_HAL_IRDA_EX_H */ |
bogdanm | 85:024bf7f99721 | 414 | |
bogdanm | 85:024bf7f99721 | 415 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
bogdanm | 92:4fc01daae5a5 | 416 |