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