mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L053R8/stm32l0xx_hal_uart_ex.h@323:9e901b0a5aa1, 2014-09-13 (annotated)
- Committer:
- shaoziyang
- Date:
- Sat Sep 13 14:25:46 2014 +0000
- Revision:
- 323:9e901b0a5aa1
- Parent:
- 181:a4cbdfbbd2f4
test with CLOCK_SETUP = 0
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_uart_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 UART 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) 2014 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_UART_EX_H |
mbed_official | 181:a4cbdfbbd2f4 | 40 | #define __STM32L0xx_HAL_UART_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 UARTEx |
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 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 59 | * @brief UART wake up from stop mode parameters |
mbed_official | 181:a4cbdfbbd2f4 | 60 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 61 | typedef struct |
mbed_official | 181:a4cbdfbbd2f4 | 62 | { |
mbed_official | 181:a4cbdfbbd2f4 | 63 | uint32_t WakeUpEvent; /*!< Specifies which event will activat the Wakeup from Stop mode flag (WUF). |
mbed_official | 181:a4cbdfbbd2f4 | 64 | This parameter can be a value of @ref UARTEx_WakeUp_from_Stop_Selection. |
mbed_official | 181:a4cbdfbbd2f4 | 65 | If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must |
mbed_official | 181:a4cbdfbbd2f4 | 66 | be filled up. */ |
mbed_official | 181:a4cbdfbbd2f4 | 67 | |
mbed_official | 181:a4cbdfbbd2f4 | 68 | uint16_t AddressLength; /*!< Specifies whether the address is 4 or 7-bit long. |
mbed_official | 181:a4cbdfbbd2f4 | 69 | This parameter can be a value of @ref UARTEx_WakeUp_Address_Length */ |
mbed_official | 181:a4cbdfbbd2f4 | 70 | |
mbed_official | 181:a4cbdfbbd2f4 | 71 | uint8_t Address; /*!< UART/USART node address (7-bit long max) */ |
mbed_official | 181:a4cbdfbbd2f4 | 72 | } UART_WakeUpTypeDef; |
mbed_official | 181:a4cbdfbbd2f4 | 73 | |
mbed_official | 181:a4cbdfbbd2f4 | 74 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 75 | /** @defgroup UARTEx_Extended_Exported_Constants |
mbed_official | 181:a4cbdfbbd2f4 | 76 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 77 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 78 | |
mbed_official | 181:a4cbdfbbd2f4 | 79 | /** @defgroup UARTEx_Word_Length UART Word Length |
mbed_official | 181:a4cbdfbbd2f4 | 80 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 81 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 82 | #define UART_WORDLENGTH_7B ((uint32_t)USART_CR1_M_1) |
mbed_official | 181:a4cbdfbbd2f4 | 83 | #define UART_WORDLENGTH_8B ((uint32_t)0x0000) |
mbed_official | 181:a4cbdfbbd2f4 | 84 | #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M_0) |
mbed_official | 181:a4cbdfbbd2f4 | 85 | #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_7B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 86 | ((LENGTH) == UART_WORDLENGTH_8B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 87 | ((LENGTH) == UART_WORDLENGTH_9B)) |
mbed_official | 181:a4cbdfbbd2f4 | 88 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 89 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 90 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 91 | |
mbed_official | 181:a4cbdfbbd2f4 | 92 | /** @defgroup UARTEx_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode |
mbed_official | 181:a4cbdfbbd2f4 | 93 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 94 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 95 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000) |
mbed_official | 181:a4cbdfbbd2f4 | 96 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) |
mbed_official | 181:a4cbdfbbd2f4 | 97 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1) |
mbed_official | 181:a4cbdfbbd2f4 | 98 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME ((uint32_t)USART_CR2_ABRMODE) |
mbed_official | 181:a4cbdfbbd2f4 | 99 | #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 100 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 101 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 102 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME)) |
mbed_official | 181:a4cbdfbbd2f4 | 103 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 104 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 105 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 106 | |
mbed_official | 181:a4cbdfbbd2f4 | 107 | /** @defgroup UARTEx_WakeUp_Address_Length UART WakeUp Address Length |
mbed_official | 181:a4cbdfbbd2f4 | 108 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 109 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 110 | #define UART_ADDRESS_DETECT_4B ((uint32_t)0x00000000) |
mbed_official | 181:a4cbdfbbd2f4 | 111 | #define UART_ADDRESS_DETECT_7B ((uint32_t)USART_CR2_ADDM7) |
mbed_official | 181:a4cbdfbbd2f4 | 112 | #define IS_UART_ADDRESSLENGTH_DETECT(ADDRESS) (((ADDRESS) == UART_ADDRESS_DETECT_4B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 113 | ((ADDRESS) == UART_ADDRESS_DETECT_7B)) |
mbed_official | 181:a4cbdfbbd2f4 | 114 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 115 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 116 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 117 | |
mbed_official | 181:a4cbdfbbd2f4 | 118 | |
mbed_official | 181:a4cbdfbbd2f4 | 119 | /** @defgroup UARTEx_WakeUp_Methods UART WakeUp Methods |
mbed_official | 181:a4cbdfbbd2f4 | 120 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 121 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 122 | #define UART_WAKEUPMETHOD_IDLELINE ((uint32_t)0x00000000) |
mbed_official | 181:a4cbdfbbd2f4 | 123 | #define UART_WAKEUPMETHOD_ADDRESSMARK ((uint32_t)USART_CR1_WAKE) |
mbed_official | 181:a4cbdfbbd2f4 | 124 | #define IS_UART_WAKEUPMETHOD(WAKEUP) (((WAKEUP) == UART_WAKEUPMETHOD_IDLELINE) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 125 | ((WAKEUP) == UART_WAKEUPMETHOD_ADDRESSMARK)) |
mbed_official | 181:a4cbdfbbd2f4 | 126 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 127 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 128 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 129 | |
mbed_official | 181:a4cbdfbbd2f4 | 130 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 131 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 132 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 133 | |
mbed_official | 181:a4cbdfbbd2f4 | 134 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 135 | |
mbed_official | 181:a4cbdfbbd2f4 | 136 | /** @defgroup UARTEx_Extended_Exported_Macros |
mbed_official | 181:a4cbdfbbd2f4 | 137 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 138 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 139 | |
mbed_official | 181:a4cbdfbbd2f4 | 140 | /** @brief Reports the UART clock source. |
mbed_official | 181:a4cbdfbbd2f4 | 141 | * @param __HANDLE__: specifies the UART Handle |
mbed_official | 181:a4cbdfbbd2f4 | 142 | * @param __CLOCKSOURCE__ : output variable |
mbed_official | 181:a4cbdfbbd2f4 | 143 | * @retval UART clocking source, written in __CLOCKSOURCE__. |
mbed_official | 181:a4cbdfbbd2f4 | 144 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 145 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
mbed_official | 181:a4cbdfbbd2f4 | 146 | do { \ |
mbed_official | 181:a4cbdfbbd2f4 | 147 | if((__HANDLE__)->Instance == USART1) \ |
mbed_official | 181:a4cbdfbbd2f4 | 148 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 149 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
mbed_official | 181:a4cbdfbbd2f4 | 150 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 151 | case RCC_USART1CLKSOURCE_PCLK2: \ |
mbed_official | 181:a4cbdfbbd2f4 | 152 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK2; \ |
mbed_official | 181:a4cbdfbbd2f4 | 153 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 154 | case RCC_USART1CLKSOURCE_HSI: \ |
mbed_official | 181:a4cbdfbbd2f4 | 155 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 181:a4cbdfbbd2f4 | 156 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 157 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
mbed_official | 181:a4cbdfbbd2f4 | 158 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 181:a4cbdfbbd2f4 | 159 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 160 | case RCC_USART1CLKSOURCE_LSE: \ |
mbed_official | 181:a4cbdfbbd2f4 | 161 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 181:a4cbdfbbd2f4 | 162 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 163 | default: \ |
mbed_official | 181:a4cbdfbbd2f4 | 164 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 165 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 166 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 167 | else if((__HANDLE__)->Instance == USART2) \ |
mbed_official | 181:a4cbdfbbd2f4 | 168 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 169 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
mbed_official | 181:a4cbdfbbd2f4 | 170 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 171 | case RCC_USART2CLKSOURCE_PCLK1: \ |
mbed_official | 181:a4cbdfbbd2f4 | 172 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 181:a4cbdfbbd2f4 | 173 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 174 | case RCC_USART2CLKSOURCE_HSI: \ |
mbed_official | 181:a4cbdfbbd2f4 | 175 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 181:a4cbdfbbd2f4 | 176 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 177 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
mbed_official | 181:a4cbdfbbd2f4 | 178 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 181:a4cbdfbbd2f4 | 179 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 180 | case RCC_USART2CLKSOURCE_LSE: \ |
mbed_official | 181:a4cbdfbbd2f4 | 181 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 181:a4cbdfbbd2f4 | 182 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 183 | default: \ |
mbed_official | 181:a4cbdfbbd2f4 | 184 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 185 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 186 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 187 | else if((__HANDLE__)->Instance == LPUART1) \ |
mbed_official | 181:a4cbdfbbd2f4 | 188 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 189 | switch(__HAL_RCC_GET_LPUART1_SOURCE()) \ |
mbed_official | 181:a4cbdfbbd2f4 | 190 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 191 | case RCC_LPUART1CLKSOURCE_PCLK1: \ |
mbed_official | 181:a4cbdfbbd2f4 | 192 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 181:a4cbdfbbd2f4 | 193 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 194 | case RCC_LPUART1CLKSOURCE_HSI: \ |
mbed_official | 181:a4cbdfbbd2f4 | 195 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 181:a4cbdfbbd2f4 | 196 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 197 | case RCC_LPUART1CLKSOURCE_SYSCLK: \ |
mbed_official | 181:a4cbdfbbd2f4 | 198 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 181:a4cbdfbbd2f4 | 199 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 200 | case RCC_LPUART1CLKSOURCE_LSE: \ |
mbed_official | 181:a4cbdfbbd2f4 | 201 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 181:a4cbdfbbd2f4 | 202 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 203 | default: \ |
mbed_official | 181:a4cbdfbbd2f4 | 204 | break; \ |
mbed_official | 181:a4cbdfbbd2f4 | 205 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 206 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 207 | } while(0) |
mbed_official | 181:a4cbdfbbd2f4 | 208 | |
mbed_official | 181:a4cbdfbbd2f4 | 209 | /** @brief Reports the UART mask to apply to retrieve the received data |
mbed_official | 181:a4cbdfbbd2f4 | 210 | * according to the word length and to the parity bits activation. |
mbed_official | 181:a4cbdfbbd2f4 | 211 | * If PCE = 1, the parity bit is not included in the data extracted |
mbed_official | 181:a4cbdfbbd2f4 | 212 | * by the reception API(). |
mbed_official | 181:a4cbdfbbd2f4 | 213 | * This masking operation is not carried out in the case of |
mbed_official | 181:a4cbdfbbd2f4 | 214 | * DMA transfers. |
mbed_official | 181:a4cbdfbbd2f4 | 215 | * @param __HANDLE__: specifies the UART Handle |
mbed_official | 181:a4cbdfbbd2f4 | 216 | * @param __MASK__ : output variable |
mbed_official | 181:a4cbdfbbd2f4 | 217 | * @retval mask to apply to UART RDR register value. |
mbed_official | 181:a4cbdfbbd2f4 | 218 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 219 | #define __HAL_UART_MASK_COMPUTATION(__HANDLE__) \ |
mbed_official | 181:a4cbdfbbd2f4 | 220 | do { \ |
mbed_official | 181:a4cbdfbbd2f4 | 221 | if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \ |
mbed_official | 181:a4cbdfbbd2f4 | 222 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 223 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 181:a4cbdfbbd2f4 | 224 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 225 | (__HANDLE__)->Mask = 0x01FF ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 226 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 227 | else \ |
mbed_official | 181:a4cbdfbbd2f4 | 228 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 229 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 230 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 231 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 232 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \ |
mbed_official | 181:a4cbdfbbd2f4 | 233 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 234 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 181:a4cbdfbbd2f4 | 235 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 236 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 237 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 238 | else \ |
mbed_official | 181:a4cbdfbbd2f4 | 239 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 240 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 241 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 242 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 243 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \ |
mbed_official | 181:a4cbdfbbd2f4 | 244 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 245 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 181:a4cbdfbbd2f4 | 246 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 247 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 248 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 249 | else \ |
mbed_official | 181:a4cbdfbbd2f4 | 250 | { \ |
mbed_official | 181:a4cbdfbbd2f4 | 251 | (__HANDLE__)->Mask = 0x003F ; \ |
mbed_official | 181:a4cbdfbbd2f4 | 252 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 253 | } \ |
mbed_official | 181:a4cbdfbbd2f4 | 254 | } while(0) |
mbed_official | 181:a4cbdfbbd2f4 | 255 | |
mbed_official | 181:a4cbdfbbd2f4 | 256 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 257 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 258 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 259 | |
mbed_official | 181:a4cbdfbbd2f4 | 260 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 261 | /* Initialization/de-initialization functions ********************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 262 | HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime, uint32_t DeassertionTime); |
mbed_official | 181:a4cbdfbbd2f4 | 263 | |
mbed_official | 181:a4cbdfbbd2f4 | 264 | /* IO operation functions *****************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 265 | /* Peripheral Control functions **********************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 266 | HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection); |
mbed_official | 181:a4cbdfbbd2f4 | 267 | HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart); |
mbed_official | 181:a4cbdfbbd2f4 | 268 | HAL_StatusTypeDef HAL_UARTEx_EnableClockStopMode(UART_HandleTypeDef *huart); |
mbed_official | 181:a4cbdfbbd2f4 | 269 | HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart); |
mbed_official | 181:a4cbdfbbd2f4 | 270 | HAL_StatusTypeDef HAL_UARTEx_DisableClockStopMode(UART_HandleTypeDef *huart); |
mbed_official | 181:a4cbdfbbd2f4 | 271 | |
mbed_official | 181:a4cbdfbbd2f4 | 272 | /* Peripheral State functions ************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 273 | HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength); |
mbed_official | 181:a4cbdfbbd2f4 | 274 | |
mbed_official | 181:a4cbdfbbd2f4 | 275 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 276 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 277 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 278 | |
mbed_official | 181:a4cbdfbbd2f4 | 279 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 280 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 281 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 282 | |
mbed_official | 181:a4cbdfbbd2f4 | 283 | #ifdef __cplusplus |
mbed_official | 181:a4cbdfbbd2f4 | 284 | } |
mbed_official | 181:a4cbdfbbd2f4 | 285 | #endif |
mbed_official | 181:a4cbdfbbd2f4 | 286 | |
mbed_official | 181:a4cbdfbbd2f4 | 287 | #endif /* __STM32L0xx_HAL_UART_EX_H */ |
mbed_official | 181:a4cbdfbbd2f4 | 288 | |
mbed_official | 181:a4cbdfbbd2f4 | 289 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |