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