mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L053R8/stm32l0xx_hal_irda_ex.h@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 181:a4cbdfbbd2f4
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 181:a4cbdfbbd2f4 | 1 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 2 | ****************************************************************************** |
mbed_official | 181:a4cbdfbbd2f4 | 3 | * @file stm32l0xx_hal_irda_ex.h |
mbed_official | 181:a4cbdfbbd2f4 | 4 | * @author MCD Application Team |
mbed_official | 181:a4cbdfbbd2f4 | 5 | * @version V1.0.0 |
mbed_official | 181:a4cbdfbbd2f4 | 6 | * @date 22-April-2014 |
mbed_official | 181:a4cbdfbbd2f4 | 7 | * @brief Header file of IRDA HAL Extension module. |
mbed_official | 181:a4cbdfbbd2f4 | 8 | ****************************************************************************** |
mbed_official | 181:a4cbdfbbd2f4 | 9 | * @attention |
mbed_official | 181:a4cbdfbbd2f4 | 10 | * |
mbed_official | 181:a4cbdfbbd2f4 | 11 | * <h2><center>© COPYRIGHT(c) 2013 STMicroelectronics</center></h2> |
mbed_official | 181:a4cbdfbbd2f4 | 12 | * |
mbed_official | 181:a4cbdfbbd2f4 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 181:a4cbdfbbd2f4 | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 181:a4cbdfbbd2f4 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 181:a4cbdfbbd2f4 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 181:a4cbdfbbd2f4 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 181:a4cbdfbbd2f4 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 181:a4cbdfbbd2f4 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 181:a4cbdfbbd2f4 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 181:a4cbdfbbd2f4 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 181:a4cbdfbbd2f4 | 22 | * without specific prior written permission. |
mbed_official | 181:a4cbdfbbd2f4 | 23 | * |
mbed_official | 181:a4cbdfbbd2f4 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 181:a4cbdfbbd2f4 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 181:a4cbdfbbd2f4 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 181:a4cbdfbbd2f4 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 181:a4cbdfbbd2f4 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 181:a4cbdfbbd2f4 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 181:a4cbdfbbd2f4 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 181:a4cbdfbbd2f4 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 181:a4cbdfbbd2f4 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 181:a4cbdfbbd2f4 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 181:a4cbdfbbd2f4 | 34 | * |
mbed_official | 181:a4cbdfbbd2f4 | 35 | ****************************************************************************** |
mbed_official | 181:a4cbdfbbd2f4 | 36 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 37 | |
mbed_official | 181:a4cbdfbbd2f4 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 39 | #ifndef __STM32L0xx_HAL_IRDA_EX_H |
mbed_official | 181:a4cbdfbbd2f4 | 40 | #define __STM32L0xx_HAL_IRDA_EX_H |
mbed_official | 181:a4cbdfbbd2f4 | 41 | |
mbed_official | 181:a4cbdfbbd2f4 | 42 | #ifdef __cplusplus |
mbed_official | 181:a4cbdfbbd2f4 | 43 | extern "C" { |
mbed_official | 181:a4cbdfbbd2f4 | 44 | #endif |
mbed_official | 181:a4cbdfbbd2f4 | 45 | |
mbed_official | 181:a4cbdfbbd2f4 | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 47 | #include "stm32l0xx_hal_def.h" |
mbed_official | 181:a4cbdfbbd2f4 | 48 | |
mbed_official | 181:a4cbdfbbd2f4 | 49 | /** @addtogroup STM32L0xx_HAL_Driver |
mbed_official | 181:a4cbdfbbd2f4 | 50 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 51 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 52 | |
mbed_official | 181:a4cbdfbbd2f4 | 53 | /** @addtogroup IRDAEx |
mbed_official | 181:a4cbdfbbd2f4 | 54 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 55 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 56 | |
mbed_official | 181:a4cbdfbbd2f4 | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 58 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 59 | /** @defgroup IRDAEx_Extended_Exported_Constants |
mbed_official | 181:a4cbdfbbd2f4 | 60 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 61 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 62 | |
mbed_official | 181:a4cbdfbbd2f4 | 63 | /** @defgroup IRDAEx_Word_Length IRDA Word Length |
mbed_official | 181:a4cbdfbbd2f4 | 64 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 65 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 66 | #define IRDA_WORDLENGTH_7B ((uint32_t)USART_CR1_M_1) |
mbed_official | 181:a4cbdfbbd2f4 | 67 | #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000) |
mbed_official | 181:a4cbdfbbd2f4 | 68 | #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M_0) |
mbed_official | 181:a4cbdfbbd2f4 | 69 | #define IS_IRDA_WORD_LENGTH(LENGTH) (((LENGTH) == IRDA_WORDLENGTH_7B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 70 | ((LENGTH) == IRDA_WORDLENGTH_8B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 71 | ((LENGTH) == IRDA_WORDLENGTH_9B)) |
mbed_official | 181:a4cbdfbbd2f4 | 72 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 73 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 74 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 75 | |
mbed_official | 181:a4cbdfbbd2f4 | 76 | |
mbed_official | 181:a4cbdfbbd2f4 | 77 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 78 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 79 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 80 | |
mbed_official | 181:a4cbdfbbd2f4 | 81 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 82 | |
mbed_official | 181:a4cbdfbbd2f4 | 83 | /** @defgroup IRDAEx_Extended_Exported_Macros |
mbed_official | 181:a4cbdfbbd2f4 | 84 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 85 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 86 | /** @brief Reports the IRDA clock source. |
mbed_official | 181:a4cbdfbbd2f4 | 87 | * @param __HANDLE__: specifies the UART Handle |
mbed_official | 181:a4cbdfbbd2f4 | 88 | * @param __CLOCKSOURCE__ : output variable |
mbed_official | 181:a4cbdfbbd2f4 | 89 | * @retval IRDA clocking source, written in __CLOCKSOURCE__. |
mbed_official | 181:a4cbdfbbd2f4 | 90 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 91 | #define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
mbed_official | 181:a4cbdfbbd2f4 | 92 | do { \ |
mbed_official | 181:a4cbdfbbd2f4 | 93 | if((__HANDLE__)->Instance == USART1) \ |
mbed_official | 181:a4cbdfbbd2f4 | 94 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 95 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
mbed_official | 181:a4cbdfbbd2f4 | 96 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 97 | case RCC_USART1CLKSOURCE_PCLK2: \ |
mbed_official | 181:a4cbdfbbd2f4 | 98 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK2; \ |
mbed_official | 181:a4cbdfbbd2f4 | 99 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 100 | case RCC_USART1CLKSOURCE_HSI: \ |
mbed_official | 181:a4cbdfbbd2f4 | 101 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
mbed_official | 181:a4cbdfbbd2f4 | 102 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 103 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
mbed_official | 181:a4cbdfbbd2f4 | 104 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 181:a4cbdfbbd2f4 | 105 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 106 | case RCC_USART1CLKSOURCE_LSE: \ |
mbed_official | 181:a4cbdfbbd2f4 | 107 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
mbed_official | 181:a4cbdfbbd2f4 | 108 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 109 | default: \ |
mbed_official | 181:a4cbdfbbd2f4 | 110 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 111 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 112 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 113 | else if((__HANDLE__)->Instance == USART2) \ |
mbed_official | 181:a4cbdfbbd2f4 | 114 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 115 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
mbed_official | 181:a4cbdfbbd2f4 | 116 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 117 | case RCC_USART2CLKSOURCE_PCLK1: \ |
mbed_official | 181:a4cbdfbbd2f4 | 118 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
mbed_official | 181:a4cbdfbbd2f4 | 119 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 120 | case RCC_USART2CLKSOURCE_HSI: \ |
mbed_official | 181:a4cbdfbbd2f4 | 121 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
mbed_official | 181:a4cbdfbbd2f4 | 122 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 123 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
mbed_official | 181:a4cbdfbbd2f4 | 124 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 181:a4cbdfbbd2f4 | 125 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 126 | case RCC_USART2CLKSOURCE_LSE: \ |
mbed_official | 181:a4cbdfbbd2f4 | 127 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
mbed_official | 181:a4cbdfbbd2f4 | 128 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 129 | default: \ |
mbed_official | 181:a4cbdfbbd2f4 | 130 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 131 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 132 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 133 | else if((__HANDLE__)->Instance == LPUART1) \ |
mbed_official | 181:a4cbdfbbd2f4 | 134 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 135 | switch(__HAL_RCC_GET_LPUART1_SOURCE()) \ |
mbed_official | 181:a4cbdfbbd2f4 | 136 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 137 | case RCC_LPUART1CLKSOURCE_PCLK1: \ |
mbed_official | 181:a4cbdfbbd2f4 | 138 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \ |
mbed_official | 181:a4cbdfbbd2f4 | 139 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 140 | case RCC_LPUART1CLKSOURCE_HSI: \ |
mbed_official | 181:a4cbdfbbd2f4 | 141 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \ |
mbed_official | 181:a4cbdfbbd2f4 | 142 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 143 | case RCC_LPUART1CLKSOURCE_SYSCLK: \ |
mbed_official | 181:a4cbdfbbd2f4 | 144 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 181:a4cbdfbbd2f4 | 145 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 146 | case RCC_LPUART1CLKSOURCE_LSE: \ |
mbed_official | 181:a4cbdfbbd2f4 | 147 | (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ |
mbed_official | 181:a4cbdfbbd2f4 | 148 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 149 | default: \ |
mbed_official | 181:a4cbdfbbd2f4 | 150 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 151 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 152 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 153 | } while(0) |
mbed_official | 181:a4cbdfbbd2f4 | 154 | |
mbed_official | 181:a4cbdfbbd2f4 | 155 | /** @brief Reports the mask to apply to retrieve the received data |
mbed_official | 181:a4cbdfbbd2f4 | 156 | * according to the word length and to the parity bits activation. |
mbed_official | 181:a4cbdfbbd2f4 | 157 | * @param __HANDLE__: specifies the IRDA Handle |
mbed_official | 181:a4cbdfbbd2f4 | 158 | * @retval mask to apply to USART RDR register value. |
mbed_official | 181:a4cbdfbbd2f4 | 159 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 160 | #define __HAL_IRDA_MASK_COMPUTATION(__HANDLE__) \ |
mbed_official | 181:a4cbdfbbd2f4 | 161 | do { \ |
mbed_official | 181:a4cbdfbbd2f4 | 162 | if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \ |
mbed_official | 181:a4cbdfbbd2f4 | 163 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 164 | if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ |
mbed_official | 181:a4cbdfbbd2f4 | 165 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 166 | (__HANDLE__)->Mask = 0x01FF ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 167 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 168 | else \ |
mbed_official | 181:a4cbdfbbd2f4 | 169 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 170 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 171 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 172 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 173 | else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \ |
mbed_official | 181:a4cbdfbbd2f4 | 174 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 175 | if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ |
mbed_official | 181:a4cbdfbbd2f4 | 176 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 177 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 178 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 179 | else \ |
mbed_official | 181:a4cbdfbbd2f4 | 180 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 181 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 182 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 183 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 184 | else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \ |
mbed_official | 181:a4cbdfbbd2f4 | 185 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 186 | if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ |
mbed_official | 181:a4cbdfbbd2f4 | 187 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 188 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 189 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 190 | else \ |
mbed_official | 181:a4cbdfbbd2f4 | 191 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 192 | (__HANDLE__)->Mask = 0x003F ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 193 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 194 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 195 | } while(0) |
mbed_official | 181:a4cbdfbbd2f4 | 196 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 197 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 198 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 199 | |
mbed_official | 181:a4cbdfbbd2f4 | 200 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 201 | /* Initialization/de-initialization methods **********************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 202 | /* IO operation methods *******************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 203 | /* Peripheral Control methods ************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 204 | /* Peripheral State methods **************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 205 | |
mbed_official | 181:a4cbdfbbd2f4 | 206 | |
mbed_official | 181:a4cbdfbbd2f4 | 207 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 208 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 209 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 210 | |
mbed_official | 181:a4cbdfbbd2f4 | 211 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 212 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 213 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 214 | |
mbed_official | 181:a4cbdfbbd2f4 | 215 | #ifdef __cplusplus |
mbed_official | 181:a4cbdfbbd2f4 | 216 | } |
mbed_official | 181:a4cbdfbbd2f4 | 217 | #endif |
mbed_official | 181:a4cbdfbbd2f4 | 218 | |
mbed_official | 181:a4cbdfbbd2f4 | 219 | #endif /* __STM32L0xx_HAL_IRDA_EX_H */ |
mbed_official | 181:a4cbdfbbd2f4 | 220 | |
mbed_official | 181:a4cbdfbbd2f4 | 221 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |