version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_NUCLEO_F302R8/stm32f30x_usart.h@82:6473597d706e, 2014-04-07 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Apr 07 18:28:36 2014 +0100
- Revision:
- 82:6473597d706e
Release 82 of the mbed library
Main changes:
- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 82:6473597d706e | 1 | /** |
bogdanm | 82:6473597d706e | 2 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 3 | * @file stm32f30x_usart.h |
bogdanm | 82:6473597d706e | 4 | * @author MCD Application Team |
bogdanm | 82:6473597d706e | 5 | * @version V1.1.0 |
bogdanm | 82:6473597d706e | 6 | * @date 27-February-2014 |
bogdanm | 82:6473597d706e | 7 | * @brief This file contains all the functions prototypes for the USART |
bogdanm | 82:6473597d706e | 8 | * firmware library. |
bogdanm | 82:6473597d706e | 9 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 10 | * @attention |
bogdanm | 82:6473597d706e | 11 | * |
bogdanm | 82:6473597d706e | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 82:6473597d706e | 13 | * |
bogdanm | 82:6473597d706e | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 82:6473597d706e | 15 | * are permitted provided that the following conditions are met: |
bogdanm | 82:6473597d706e | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 82:6473597d706e | 17 | * this list of conditions and the following disclaimer. |
bogdanm | 82:6473597d706e | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 82:6473597d706e | 19 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 82:6473597d706e | 20 | * and/or other materials provided with the distribution. |
bogdanm | 82:6473597d706e | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 82:6473597d706e | 22 | * may be used to endorse or promote products derived from this software |
bogdanm | 82:6473597d706e | 23 | * without specific prior written permission. |
bogdanm | 82:6473597d706e | 24 | * |
bogdanm | 82:6473597d706e | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 82:6473597d706e | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 82:6473597d706e | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 82:6473597d706e | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 82:6473597d706e | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 82:6473597d706e | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 82:6473597d706e | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 82:6473597d706e | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 82:6473597d706e | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 82:6473597d706e | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 82:6473597d706e | 35 | * |
bogdanm | 82:6473597d706e | 36 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 37 | */ |
bogdanm | 82:6473597d706e | 38 | |
bogdanm | 82:6473597d706e | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 82:6473597d706e | 40 | #ifndef __STM32F30x_USART_H |
bogdanm | 82:6473597d706e | 41 | #define __STM32F30x_USART_H |
bogdanm | 82:6473597d706e | 42 | |
bogdanm | 82:6473597d706e | 43 | #ifdef __cplusplus |
bogdanm | 82:6473597d706e | 44 | extern "C" { |
bogdanm | 82:6473597d706e | 45 | #endif |
bogdanm | 82:6473597d706e | 46 | |
bogdanm | 82:6473597d706e | 47 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 48 | #include "stm32f30x.h" |
bogdanm | 82:6473597d706e | 49 | |
bogdanm | 82:6473597d706e | 50 | /** @addtogroup STM32F30x_StdPeriph_Driver |
bogdanm | 82:6473597d706e | 51 | * @{ |
bogdanm | 82:6473597d706e | 52 | */ |
bogdanm | 82:6473597d706e | 53 | |
bogdanm | 82:6473597d706e | 54 | /** @addtogroup USART |
bogdanm | 82:6473597d706e | 55 | * @{ |
bogdanm | 82:6473597d706e | 56 | */ |
bogdanm | 82:6473597d706e | 57 | |
bogdanm | 82:6473597d706e | 58 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 59 | |
bogdanm | 82:6473597d706e | 60 | |
bogdanm | 82:6473597d706e | 61 | |
bogdanm | 82:6473597d706e | 62 | /** |
bogdanm | 82:6473597d706e | 63 | * @brief USART Init Structure definition |
bogdanm | 82:6473597d706e | 64 | */ |
bogdanm | 82:6473597d706e | 65 | |
bogdanm | 82:6473597d706e | 66 | typedef struct |
bogdanm | 82:6473597d706e | 67 | { |
bogdanm | 82:6473597d706e | 68 | uint32_t USART_BaudRate; /*!< This member configures the USART communication baud rate. |
bogdanm | 82:6473597d706e | 69 | The baud rate is computed using the following formula: |
bogdanm | 82:6473597d706e | 70 | - IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate))) |
bogdanm | 82:6473597d706e | 71 | - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 16) + 0.5 */ |
bogdanm | 82:6473597d706e | 72 | |
bogdanm | 82:6473597d706e | 73 | uint32_t USART_WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
bogdanm | 82:6473597d706e | 74 | This parameter can be a value of @ref USART_Word_Length */ |
bogdanm | 82:6473597d706e | 75 | |
bogdanm | 82:6473597d706e | 76 | uint32_t USART_StopBits; /*!< Specifies the number of stop bits transmitted. |
bogdanm | 82:6473597d706e | 77 | This parameter can be a value of @ref USART_Stop_Bits */ |
bogdanm | 82:6473597d706e | 78 | |
bogdanm | 82:6473597d706e | 79 | uint32_t USART_Parity; /*!< Specifies the parity mode. |
bogdanm | 82:6473597d706e | 80 | This parameter can be a value of @ref USART_Parity |
bogdanm | 82:6473597d706e | 81 | @note When parity is enabled, the computed parity is inserted |
bogdanm | 82:6473597d706e | 82 | at the MSB position of the transmitted data (9th bit when |
bogdanm | 82:6473597d706e | 83 | the word length is set to 9 data bits; 8th bit when the |
bogdanm | 82:6473597d706e | 84 | word length is set to 8 data bits). */ |
bogdanm | 82:6473597d706e | 85 | |
bogdanm | 82:6473597d706e | 86 | uint32_t USART_Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled. |
bogdanm | 82:6473597d706e | 87 | This parameter can be a value of @ref USART_Mode */ |
bogdanm | 82:6473597d706e | 88 | |
bogdanm | 82:6473597d706e | 89 | uint32_t USART_HardwareFlowControl; /*!< Specifies wether the hardware flow control mode is enabled |
bogdanm | 82:6473597d706e | 90 | or disabled. |
bogdanm | 82:6473597d706e | 91 | This parameter can be a value of @ref USART_Hardware_Flow_Control*/ |
bogdanm | 82:6473597d706e | 92 | } USART_InitTypeDef; |
bogdanm | 82:6473597d706e | 93 | |
bogdanm | 82:6473597d706e | 94 | /** |
bogdanm | 82:6473597d706e | 95 | * @brief USART Clock Init Structure definition |
bogdanm | 82:6473597d706e | 96 | */ |
bogdanm | 82:6473597d706e | 97 | |
bogdanm | 82:6473597d706e | 98 | typedef struct |
bogdanm | 82:6473597d706e | 99 | { |
bogdanm | 82:6473597d706e | 100 | uint32_t USART_Clock; /*!< Specifies whether the USART clock is enabled or disabled. |
bogdanm | 82:6473597d706e | 101 | This parameter can be a value of @ref USART_Clock */ |
bogdanm | 82:6473597d706e | 102 | |
bogdanm | 82:6473597d706e | 103 | uint32_t USART_CPOL; /*!< Specifies the steady state of the serial clock. |
bogdanm | 82:6473597d706e | 104 | This parameter can be a value of @ref USART_Clock_Polarity */ |
bogdanm | 82:6473597d706e | 105 | |
bogdanm | 82:6473597d706e | 106 | uint32_t USART_CPHA; /*!< Specifies the clock transition on which the bit capture is made. |
bogdanm | 82:6473597d706e | 107 | This parameter can be a value of @ref USART_Clock_Phase */ |
bogdanm | 82:6473597d706e | 108 | |
bogdanm | 82:6473597d706e | 109 | uint32_t USART_LastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
bogdanm | 82:6473597d706e | 110 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
bogdanm | 82:6473597d706e | 111 | This parameter can be a value of @ref USART_Last_Bit */ |
bogdanm | 82:6473597d706e | 112 | } USART_ClockInitTypeDef; |
bogdanm | 82:6473597d706e | 113 | |
bogdanm | 82:6473597d706e | 114 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 115 | |
bogdanm | 82:6473597d706e | 116 | /** @defgroup USART_Exported_Constants |
bogdanm | 82:6473597d706e | 117 | * @{ |
bogdanm | 82:6473597d706e | 118 | */ |
bogdanm | 82:6473597d706e | 119 | |
bogdanm | 82:6473597d706e | 120 | #define IS_USART_ALL_PERIPH(PERIPH) (((PERIPH) == USART1) || \ |
bogdanm | 82:6473597d706e | 121 | ((PERIPH) == USART2) || \ |
bogdanm | 82:6473597d706e | 122 | ((PERIPH) == USART3) || \ |
bogdanm | 82:6473597d706e | 123 | ((PERIPH) == UART4) || \ |
bogdanm | 82:6473597d706e | 124 | ((PERIPH) == UART5)) |
bogdanm | 82:6473597d706e | 125 | |
bogdanm | 82:6473597d706e | 126 | #define IS_USART_123_PERIPH(PERIPH) (((PERIPH) == USART1) || \ |
bogdanm | 82:6473597d706e | 127 | ((PERIPH) == USART2) || \ |
bogdanm | 82:6473597d706e | 128 | ((PERIPH) == USART3)) |
bogdanm | 82:6473597d706e | 129 | |
bogdanm | 82:6473597d706e | 130 | #define IS_USART_1234_PERIPH(PERIPH) (((PERIPH) == USART1) || \ |
bogdanm | 82:6473597d706e | 131 | ((PERIPH) == USART2) || \ |
bogdanm | 82:6473597d706e | 132 | ((PERIPH) == USART3) || \ |
bogdanm | 82:6473597d706e | 133 | ((PERIPH) == UART4)) |
bogdanm | 82:6473597d706e | 134 | |
bogdanm | 82:6473597d706e | 135 | |
bogdanm | 82:6473597d706e | 136 | /** @defgroup USART_Word_Length |
bogdanm | 82:6473597d706e | 137 | * @{ |
bogdanm | 82:6473597d706e | 138 | */ |
bogdanm | 82:6473597d706e | 139 | |
bogdanm | 82:6473597d706e | 140 | #define USART_WordLength_8b ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 141 | #define USART_WordLength_9b USART_CR1_M |
bogdanm | 82:6473597d706e | 142 | #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \ |
bogdanm | 82:6473597d706e | 143 | ((LENGTH) == USART_WordLength_9b)) |
bogdanm | 82:6473597d706e | 144 | /** |
bogdanm | 82:6473597d706e | 145 | * @} |
bogdanm | 82:6473597d706e | 146 | */ |
bogdanm | 82:6473597d706e | 147 | |
bogdanm | 82:6473597d706e | 148 | /** @defgroup USART_Stop_Bits |
bogdanm | 82:6473597d706e | 149 | * @{ |
bogdanm | 82:6473597d706e | 150 | */ |
bogdanm | 82:6473597d706e | 151 | |
bogdanm | 82:6473597d706e | 152 | #define USART_StopBits_1 ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 153 | #define USART_StopBits_2 USART_CR2_STOP_1 |
bogdanm | 82:6473597d706e | 154 | #define USART_StopBits_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) |
bogdanm | 82:6473597d706e | 155 | #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \ |
bogdanm | 82:6473597d706e | 156 | ((STOPBITS) == USART_StopBits_2) || \ |
bogdanm | 82:6473597d706e | 157 | ((STOPBITS) == USART_StopBits_1_5)) |
bogdanm | 82:6473597d706e | 158 | /** |
bogdanm | 82:6473597d706e | 159 | * @} |
bogdanm | 82:6473597d706e | 160 | */ |
bogdanm | 82:6473597d706e | 161 | |
bogdanm | 82:6473597d706e | 162 | /** @defgroup USART_Parity |
bogdanm | 82:6473597d706e | 163 | * @{ |
bogdanm | 82:6473597d706e | 164 | */ |
bogdanm | 82:6473597d706e | 165 | |
bogdanm | 82:6473597d706e | 166 | #define USART_Parity_No ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 167 | #define USART_Parity_Even USART_CR1_PCE |
bogdanm | 82:6473597d706e | 168 | #define USART_Parity_Odd (USART_CR1_PCE | USART_CR1_PS) |
bogdanm | 82:6473597d706e | 169 | #define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \ |
bogdanm | 82:6473597d706e | 170 | ((PARITY) == USART_Parity_Even) || \ |
bogdanm | 82:6473597d706e | 171 | ((PARITY) == USART_Parity_Odd)) |
bogdanm | 82:6473597d706e | 172 | /** |
bogdanm | 82:6473597d706e | 173 | * @} |
bogdanm | 82:6473597d706e | 174 | */ |
bogdanm | 82:6473597d706e | 175 | |
bogdanm | 82:6473597d706e | 176 | /** @defgroup USART_Mode |
bogdanm | 82:6473597d706e | 177 | * @{ |
bogdanm | 82:6473597d706e | 178 | */ |
bogdanm | 82:6473597d706e | 179 | |
bogdanm | 82:6473597d706e | 180 | #define USART_Mode_Rx USART_CR1_RE |
bogdanm | 82:6473597d706e | 181 | #define USART_Mode_Tx USART_CR1_TE |
bogdanm | 82:6473597d706e | 182 | #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFFFFFF3) == 0x00) && \ |
bogdanm | 82:6473597d706e | 183 | ((MODE) != (uint32_t)0x00)) |
bogdanm | 82:6473597d706e | 184 | /** |
bogdanm | 82:6473597d706e | 185 | * @} |
bogdanm | 82:6473597d706e | 186 | */ |
bogdanm | 82:6473597d706e | 187 | |
bogdanm | 82:6473597d706e | 188 | /** @defgroup USART_Hardware_Flow_Control |
bogdanm | 82:6473597d706e | 189 | * @{ |
bogdanm | 82:6473597d706e | 190 | */ |
bogdanm | 82:6473597d706e | 191 | |
bogdanm | 82:6473597d706e | 192 | #define USART_HardwareFlowControl_None ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 193 | #define USART_HardwareFlowControl_RTS USART_CR3_RTSE |
bogdanm | 82:6473597d706e | 194 | #define USART_HardwareFlowControl_CTS USART_CR3_CTSE |
bogdanm | 82:6473597d706e | 195 | #define USART_HardwareFlowControl_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) |
bogdanm | 82:6473597d706e | 196 | #define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\ |
bogdanm | 82:6473597d706e | 197 | (((CONTROL) == USART_HardwareFlowControl_None) || \ |
bogdanm | 82:6473597d706e | 198 | ((CONTROL) == USART_HardwareFlowControl_RTS) || \ |
bogdanm | 82:6473597d706e | 199 | ((CONTROL) == USART_HardwareFlowControl_CTS) || \ |
bogdanm | 82:6473597d706e | 200 | ((CONTROL) == USART_HardwareFlowControl_RTS_CTS)) |
bogdanm | 82:6473597d706e | 201 | /** |
bogdanm | 82:6473597d706e | 202 | * @} |
bogdanm | 82:6473597d706e | 203 | */ |
bogdanm | 82:6473597d706e | 204 | |
bogdanm | 82:6473597d706e | 205 | /** @defgroup USART_Clock |
bogdanm | 82:6473597d706e | 206 | * @{ |
bogdanm | 82:6473597d706e | 207 | */ |
bogdanm | 82:6473597d706e | 208 | |
bogdanm | 82:6473597d706e | 209 | #define USART_Clock_Disable ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 210 | #define USART_Clock_Enable USART_CR2_CLKEN |
bogdanm | 82:6473597d706e | 211 | #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \ |
bogdanm | 82:6473597d706e | 212 | ((CLOCK) == USART_Clock_Enable)) |
bogdanm | 82:6473597d706e | 213 | /** |
bogdanm | 82:6473597d706e | 214 | * @} |
bogdanm | 82:6473597d706e | 215 | */ |
bogdanm | 82:6473597d706e | 216 | |
bogdanm | 82:6473597d706e | 217 | /** @defgroup USART_Clock_Polarity |
bogdanm | 82:6473597d706e | 218 | * @{ |
bogdanm | 82:6473597d706e | 219 | */ |
bogdanm | 82:6473597d706e | 220 | |
bogdanm | 82:6473597d706e | 221 | #define USART_CPOL_Low ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 222 | #define USART_CPOL_High USART_CR2_CPOL |
bogdanm | 82:6473597d706e | 223 | #define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High)) |
bogdanm | 82:6473597d706e | 224 | |
bogdanm | 82:6473597d706e | 225 | /** |
bogdanm | 82:6473597d706e | 226 | * @} |
bogdanm | 82:6473597d706e | 227 | */ |
bogdanm | 82:6473597d706e | 228 | |
bogdanm | 82:6473597d706e | 229 | /** @defgroup USART_Clock_Phase |
bogdanm | 82:6473597d706e | 230 | * @{ |
bogdanm | 82:6473597d706e | 231 | */ |
bogdanm | 82:6473597d706e | 232 | |
bogdanm | 82:6473597d706e | 233 | #define USART_CPHA_1Edge ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 234 | #define USART_CPHA_2Edge USART_CR2_CPHA |
bogdanm | 82:6473597d706e | 235 | #define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge)) |
bogdanm | 82:6473597d706e | 236 | |
bogdanm | 82:6473597d706e | 237 | /** |
bogdanm | 82:6473597d706e | 238 | * @} |
bogdanm | 82:6473597d706e | 239 | */ |
bogdanm | 82:6473597d706e | 240 | |
bogdanm | 82:6473597d706e | 241 | /** @defgroup USART_Last_Bit |
bogdanm | 82:6473597d706e | 242 | * @{ |
bogdanm | 82:6473597d706e | 243 | */ |
bogdanm | 82:6473597d706e | 244 | |
bogdanm | 82:6473597d706e | 245 | #define USART_LastBit_Disable ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 246 | #define USART_LastBit_Enable USART_CR2_LBCL |
bogdanm | 82:6473597d706e | 247 | #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \ |
bogdanm | 82:6473597d706e | 248 | ((LASTBIT) == USART_LastBit_Enable)) |
bogdanm | 82:6473597d706e | 249 | /** |
bogdanm | 82:6473597d706e | 250 | * @} |
bogdanm | 82:6473597d706e | 251 | */ |
bogdanm | 82:6473597d706e | 252 | |
bogdanm | 82:6473597d706e | 253 | /** @defgroup USART_DMA_Requests |
bogdanm | 82:6473597d706e | 254 | * @{ |
bogdanm | 82:6473597d706e | 255 | */ |
bogdanm | 82:6473597d706e | 256 | |
bogdanm | 82:6473597d706e | 257 | #define USART_DMAReq_Tx USART_CR3_DMAT |
bogdanm | 82:6473597d706e | 258 | #define USART_DMAReq_Rx USART_CR3_DMAR |
bogdanm | 82:6473597d706e | 259 | #define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint32_t)0xFFFFFF3F) == 0x00) && \ |
bogdanm | 82:6473597d706e | 260 | ((DMAREQ) != (uint32_t)0x00)) |
bogdanm | 82:6473597d706e | 261 | |
bogdanm | 82:6473597d706e | 262 | /** |
bogdanm | 82:6473597d706e | 263 | * @} |
bogdanm | 82:6473597d706e | 264 | */ |
bogdanm | 82:6473597d706e | 265 | |
bogdanm | 82:6473597d706e | 266 | /** @defgroup USART_DMA_Recception_Error |
bogdanm | 82:6473597d706e | 267 | * @{ |
bogdanm | 82:6473597d706e | 268 | */ |
bogdanm | 82:6473597d706e | 269 | |
bogdanm | 82:6473597d706e | 270 | #define USART_DMAOnError_Enable ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 271 | #define USART_DMAOnError_Disable USART_CR3_DDRE |
bogdanm | 82:6473597d706e | 272 | #define IS_USART_DMAONERROR(DMAERROR) (((DMAERROR) == USART_DMAOnError_Disable)|| \ |
bogdanm | 82:6473597d706e | 273 | ((DMAERROR) == USART_DMAOnError_Enable)) |
bogdanm | 82:6473597d706e | 274 | /** |
bogdanm | 82:6473597d706e | 275 | * @} |
bogdanm | 82:6473597d706e | 276 | */ |
bogdanm | 82:6473597d706e | 277 | |
bogdanm | 82:6473597d706e | 278 | /** @defgroup USART_MuteMode_WakeUp_methods |
bogdanm | 82:6473597d706e | 279 | * @{ |
bogdanm | 82:6473597d706e | 280 | */ |
bogdanm | 82:6473597d706e | 281 | |
bogdanm | 82:6473597d706e | 282 | #define USART_WakeUp_IdleLine ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 283 | #define USART_WakeUp_AddressMark USART_CR1_WAKE |
bogdanm | 82:6473597d706e | 284 | #define IS_USART_MUTEMODE_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \ |
bogdanm | 82:6473597d706e | 285 | ((WAKEUP) == USART_WakeUp_AddressMark)) |
bogdanm | 82:6473597d706e | 286 | /** |
bogdanm | 82:6473597d706e | 287 | * @} |
bogdanm | 82:6473597d706e | 288 | */ |
bogdanm | 82:6473597d706e | 289 | |
bogdanm | 82:6473597d706e | 290 | /** @defgroup USART_Address_Detection |
bogdanm | 82:6473597d706e | 291 | * @{ |
bogdanm | 82:6473597d706e | 292 | */ |
bogdanm | 82:6473597d706e | 293 | |
bogdanm | 82:6473597d706e | 294 | #define USART_AddressLength_4b ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 295 | #define USART_AddressLength_7b USART_CR2_ADDM7 |
bogdanm | 82:6473597d706e | 296 | #define IS_USART_ADDRESS_DETECTION(ADDRESS) (((ADDRESS) == USART_AddressLength_4b) || \ |
bogdanm | 82:6473597d706e | 297 | ((ADDRESS) == USART_AddressLength_7b)) |
bogdanm | 82:6473597d706e | 298 | /** |
bogdanm | 82:6473597d706e | 299 | * @} |
bogdanm | 82:6473597d706e | 300 | */ |
bogdanm | 82:6473597d706e | 301 | |
bogdanm | 82:6473597d706e | 302 | /** @defgroup USART_StopMode_WakeUp_methods |
bogdanm | 82:6473597d706e | 303 | * @{ |
bogdanm | 82:6473597d706e | 304 | */ |
bogdanm | 82:6473597d706e | 305 | |
bogdanm | 82:6473597d706e | 306 | #define USART_WakeUpSource_AddressMatch ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 307 | #define USART_WakeUpSource_StartBit USART_CR3_WUS_1 |
bogdanm | 82:6473597d706e | 308 | #define USART_WakeUpSource_RXNE (uint32_t)(USART_CR3_WUS_0 | USART_CR3_WUS_1) |
bogdanm | 82:6473597d706e | 309 | #define IS_USART_STOPMODE_WAKEUPSOURCE(SOURCE) (((SOURCE) == USART_WakeUpSource_AddressMatch) || \ |
bogdanm | 82:6473597d706e | 310 | ((SOURCE) == USART_WakeUpSource_StartBit) || \ |
bogdanm | 82:6473597d706e | 311 | ((SOURCE) == USART_WakeUpSource_RXNE)) |
bogdanm | 82:6473597d706e | 312 | /** |
bogdanm | 82:6473597d706e | 313 | * @} |
bogdanm | 82:6473597d706e | 314 | */ |
bogdanm | 82:6473597d706e | 315 | |
bogdanm | 82:6473597d706e | 316 | /** @defgroup USART_LIN_Break_Detection_Length |
bogdanm | 82:6473597d706e | 317 | * @{ |
bogdanm | 82:6473597d706e | 318 | */ |
bogdanm | 82:6473597d706e | 319 | |
bogdanm | 82:6473597d706e | 320 | #define USART_LINBreakDetectLength_10b ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 321 | #define USART_LINBreakDetectLength_11b USART_CR2_LBDL |
bogdanm | 82:6473597d706e | 322 | #define IS_USART_LIN_BREAK_DETECT_LENGTH(LENGTH) \ |
bogdanm | 82:6473597d706e | 323 | (((LENGTH) == USART_LINBreakDetectLength_10b) || \ |
bogdanm | 82:6473597d706e | 324 | ((LENGTH) == USART_LINBreakDetectLength_11b)) |
bogdanm | 82:6473597d706e | 325 | /** |
bogdanm | 82:6473597d706e | 326 | * @} |
bogdanm | 82:6473597d706e | 327 | */ |
bogdanm | 82:6473597d706e | 328 | |
bogdanm | 82:6473597d706e | 329 | /** @defgroup USART_IrDA_Low_Power |
bogdanm | 82:6473597d706e | 330 | * @{ |
bogdanm | 82:6473597d706e | 331 | */ |
bogdanm | 82:6473597d706e | 332 | |
bogdanm | 82:6473597d706e | 333 | #define USART_IrDAMode_LowPower USART_CR3_IRLP |
bogdanm | 82:6473597d706e | 334 | #define USART_IrDAMode_Normal ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 335 | #define IS_USART_IRDA_MODE(MODE) (((MODE) == USART_IrDAMode_LowPower) || \ |
bogdanm | 82:6473597d706e | 336 | ((MODE) == USART_IrDAMode_Normal)) |
bogdanm | 82:6473597d706e | 337 | /** |
bogdanm | 82:6473597d706e | 338 | * @} |
bogdanm | 82:6473597d706e | 339 | */ |
bogdanm | 82:6473597d706e | 340 | |
bogdanm | 82:6473597d706e | 341 | /** @defgroup USART_DE_Polarity |
bogdanm | 82:6473597d706e | 342 | * @{ |
bogdanm | 82:6473597d706e | 343 | */ |
bogdanm | 82:6473597d706e | 344 | |
bogdanm | 82:6473597d706e | 345 | #define USART_DEPolarity_High ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 346 | #define USART_DEPolarity_Low USART_CR3_DEP |
bogdanm | 82:6473597d706e | 347 | #define IS_USART_DE_POLARITY(POLARITY) (((POLARITY) == USART_DEPolarity_Low) || \ |
bogdanm | 82:6473597d706e | 348 | ((POLARITY) == USART_DEPolarity_High)) |
bogdanm | 82:6473597d706e | 349 | /** |
bogdanm | 82:6473597d706e | 350 | * @} |
bogdanm | 82:6473597d706e | 351 | */ |
bogdanm | 82:6473597d706e | 352 | |
bogdanm | 82:6473597d706e | 353 | /** @defgroup USART_Inversion_Pins |
bogdanm | 82:6473597d706e | 354 | * @{ |
bogdanm | 82:6473597d706e | 355 | */ |
bogdanm | 82:6473597d706e | 356 | |
bogdanm | 82:6473597d706e | 357 | #define USART_InvPin_Tx USART_CR2_TXINV |
bogdanm | 82:6473597d706e | 358 | #define USART_InvPin_Rx USART_CR2_RXINV |
bogdanm | 82:6473597d706e | 359 | #define IS_USART_INVERSTION_PIN(PIN) ((((PIN) & (uint32_t)0xFFFCFFFF) == 0x00) && \ |
bogdanm | 82:6473597d706e | 360 | ((PIN) != (uint32_t)0x00)) |
bogdanm | 82:6473597d706e | 361 | |
bogdanm | 82:6473597d706e | 362 | /** |
bogdanm | 82:6473597d706e | 363 | * @} |
bogdanm | 82:6473597d706e | 364 | */ |
bogdanm | 82:6473597d706e | 365 | |
bogdanm | 82:6473597d706e | 366 | /** @defgroup USART_AutoBaudRate_Mode |
bogdanm | 82:6473597d706e | 367 | * @{ |
bogdanm | 82:6473597d706e | 368 | */ |
bogdanm | 82:6473597d706e | 369 | |
bogdanm | 82:6473597d706e | 370 | #define USART_AutoBaudRate_StartBit ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 371 | #define USART_AutoBaudRate_FallingEdge USART_CR2_ABRMODE_0 |
bogdanm | 82:6473597d706e | 372 | #define USART_AutoBaudRate_0x7FFrame USART_CR2_ABRMODE_1 |
bogdanm | 82:6473597d706e | 373 | #define USART_AutoBaudRate_0x55Frame (USART_CR2_ABRMODE_0 | USART_CR2_ABRMODE_1) |
bogdanm | 82:6473597d706e | 374 | #define IS_USART_AUTOBAUDRATE_MODE(MODE) (((MODE) == USART_AutoBaudRate_StartBit) || \ |
bogdanm | 82:6473597d706e | 375 | ((MODE) == USART_AutoBaudRate_FallingEdge) || \ |
bogdanm | 82:6473597d706e | 376 | ((MODE) == USART_AutoBaudRate_0x7FFrame) || \ |
bogdanm | 82:6473597d706e | 377 | ((MODE) == USART_AutoBaudRate_0x55Frame)) |
bogdanm | 82:6473597d706e | 378 | /** |
bogdanm | 82:6473597d706e | 379 | * @} |
bogdanm | 82:6473597d706e | 380 | */ |
bogdanm | 82:6473597d706e | 381 | |
bogdanm | 82:6473597d706e | 382 | /** @defgroup USART_OVR_DETECTION |
bogdanm | 82:6473597d706e | 383 | * @{ |
bogdanm | 82:6473597d706e | 384 | */ |
bogdanm | 82:6473597d706e | 385 | |
bogdanm | 82:6473597d706e | 386 | #define USART_OVRDetection_Enable ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 387 | #define USART_OVRDetection_Disable USART_CR3_OVRDIS |
bogdanm | 82:6473597d706e | 388 | #define IS_USART_OVRDETECTION(OVR) (((OVR) == USART_OVRDetection_Enable)|| \ |
bogdanm | 82:6473597d706e | 389 | ((OVR) == USART_OVRDetection_Disable)) |
bogdanm | 82:6473597d706e | 390 | /** |
bogdanm | 82:6473597d706e | 391 | * @} |
bogdanm | 82:6473597d706e | 392 | */ |
bogdanm | 82:6473597d706e | 393 | /** @defgroup USART_Request |
bogdanm | 82:6473597d706e | 394 | * @{ |
bogdanm | 82:6473597d706e | 395 | */ |
bogdanm | 82:6473597d706e | 396 | |
bogdanm | 82:6473597d706e | 397 | #define USART_Request_ABRRQ USART_RQR_ABRRQ |
bogdanm | 82:6473597d706e | 398 | #define USART_Request_SBKRQ USART_RQR_SBKRQ |
bogdanm | 82:6473597d706e | 399 | #define USART_Request_MMRQ USART_RQR_MMRQ |
bogdanm | 82:6473597d706e | 400 | #define USART_Request_RXFRQ USART_RQR_RXFRQ |
bogdanm | 82:6473597d706e | 401 | #define USART_Request_TXFRQ USART_RQR_TXFRQ |
bogdanm | 82:6473597d706e | 402 | |
bogdanm | 82:6473597d706e | 403 | #define IS_USART_REQUEST(REQUEST) (((REQUEST) == USART_Request_TXFRQ) || \ |
bogdanm | 82:6473597d706e | 404 | ((REQUEST) == USART_Request_RXFRQ) || \ |
bogdanm | 82:6473597d706e | 405 | ((REQUEST) == USART_Request_MMRQ) || \ |
bogdanm | 82:6473597d706e | 406 | ((REQUEST) == USART_Request_SBKRQ) || \ |
bogdanm | 82:6473597d706e | 407 | ((REQUEST) == USART_Request_ABRRQ)) |
bogdanm | 82:6473597d706e | 408 | /** |
bogdanm | 82:6473597d706e | 409 | * @} |
bogdanm | 82:6473597d706e | 410 | */ |
bogdanm | 82:6473597d706e | 411 | |
bogdanm | 82:6473597d706e | 412 | /** @defgroup USART_Flags |
bogdanm | 82:6473597d706e | 413 | * @{ |
bogdanm | 82:6473597d706e | 414 | */ |
bogdanm | 82:6473597d706e | 415 | #define USART_FLAG_REACK USART_ISR_REACK |
bogdanm | 82:6473597d706e | 416 | #define USART_FLAG_TEACK USART_ISR_TEACK |
bogdanm | 82:6473597d706e | 417 | #define USART_FLAG_WU USART_ISR_WUF |
bogdanm | 82:6473597d706e | 418 | #define USART_FLAG_RWU USART_ISR_RWU |
bogdanm | 82:6473597d706e | 419 | #define USART_FLAG_SBK USART_ISR_SBKF |
bogdanm | 82:6473597d706e | 420 | #define USART_FLAG_CM USART_ISR_CMF |
bogdanm | 82:6473597d706e | 421 | #define USART_FLAG_BUSY USART_ISR_BUSY |
bogdanm | 82:6473597d706e | 422 | #define USART_FLAG_ABRF USART_ISR_ABRF |
bogdanm | 82:6473597d706e | 423 | #define USART_FLAG_ABRE USART_ISR_ABRE |
bogdanm | 82:6473597d706e | 424 | #define USART_FLAG_EOB USART_ISR_EOBF |
bogdanm | 82:6473597d706e | 425 | #define USART_FLAG_RTO USART_ISR_RTOF |
bogdanm | 82:6473597d706e | 426 | #define USART_FLAG_nCTSS USART_ISR_CTS |
bogdanm | 82:6473597d706e | 427 | #define USART_FLAG_CTS USART_ISR_CTSIF |
bogdanm | 82:6473597d706e | 428 | #define USART_FLAG_LBD USART_ISR_LBD |
bogdanm | 82:6473597d706e | 429 | #define USART_FLAG_TXE USART_ISR_TXE |
bogdanm | 82:6473597d706e | 430 | #define USART_FLAG_TC USART_ISR_TC |
bogdanm | 82:6473597d706e | 431 | #define USART_FLAG_RXNE USART_ISR_RXNE |
bogdanm | 82:6473597d706e | 432 | #define USART_FLAG_IDLE USART_ISR_IDLE |
bogdanm | 82:6473597d706e | 433 | #define USART_FLAG_ORE USART_ISR_ORE |
bogdanm | 82:6473597d706e | 434 | #define USART_FLAG_NE USART_ISR_NE |
bogdanm | 82:6473597d706e | 435 | #define USART_FLAG_FE USART_ISR_FE |
bogdanm | 82:6473597d706e | 436 | #define USART_FLAG_PE USART_ISR_PE |
bogdanm | 82:6473597d706e | 437 | #define IS_USART_FLAG(FLAG) (((FLAG) == USART_FLAG_PE) || ((FLAG) == USART_FLAG_TXE) || \ |
bogdanm | 82:6473597d706e | 438 | ((FLAG) == USART_FLAG_TC) || ((FLAG) == USART_FLAG_RXNE) || \ |
bogdanm | 82:6473597d706e | 439 | ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_LBD) || \ |
bogdanm | 82:6473597d706e | 440 | ((FLAG) == USART_FLAG_CTS) || ((FLAG) == USART_FLAG_ORE) || \ |
bogdanm | 82:6473597d706e | 441 | ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE) || \ |
bogdanm | 82:6473597d706e | 442 | ((FLAG) == USART_FLAG_nCTSS) || ((FLAG) == USART_FLAG_RTO) || \ |
bogdanm | 82:6473597d706e | 443 | ((FLAG) == USART_FLAG_EOB) || ((FLAG) == USART_FLAG_ABRE) || \ |
bogdanm | 82:6473597d706e | 444 | ((FLAG) == USART_FLAG_ABRF) || ((FLAG) == USART_FLAG_BUSY) || \ |
bogdanm | 82:6473597d706e | 445 | ((FLAG) == USART_FLAG_CM) || ((FLAG) == USART_FLAG_SBK) || \ |
bogdanm | 82:6473597d706e | 446 | ((FLAG) == USART_FLAG_RWU) || ((FLAG) == USART_FLAG_WU) || \ |
bogdanm | 82:6473597d706e | 447 | ((FLAG) == USART_FLAG_TEACK)|| ((FLAG) == USART_FLAG_REACK)) |
bogdanm | 82:6473597d706e | 448 | |
bogdanm | 82:6473597d706e | 449 | #define IS_USART_CLEAR_FLAG(FLAG) (((FLAG) == USART_FLAG_WU) || ((FLAG) == USART_FLAG_TC) || \ |
bogdanm | 82:6473597d706e | 450 | ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_ORE) || \ |
bogdanm | 82:6473597d706e | 451 | ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE) || \ |
bogdanm | 82:6473597d706e | 452 | ((FLAG) == USART_FLAG_LBD) || ((FLAG) == USART_FLAG_CTS) || \ |
bogdanm | 82:6473597d706e | 453 | ((FLAG) == USART_FLAG_RTO) || ((FLAG) == USART_FLAG_EOB) || \ |
bogdanm | 82:6473597d706e | 454 | ((FLAG) == USART_FLAG_CM) || ((FLAG) == USART_FLAG_PE)) |
bogdanm | 82:6473597d706e | 455 | /** |
bogdanm | 82:6473597d706e | 456 | * @} |
bogdanm | 82:6473597d706e | 457 | */ |
bogdanm | 82:6473597d706e | 458 | |
bogdanm | 82:6473597d706e | 459 | /** @defgroup USART_Interrupt_definition |
bogdanm | 82:6473597d706e | 460 | * @brief USART Interrupt definition |
bogdanm | 82:6473597d706e | 461 | * USART_IT possible values |
bogdanm | 82:6473597d706e | 462 | * Elements values convention: 0xZZZZYYXX |
bogdanm | 82:6473597d706e | 463 | * XX: Position of the corresponding Interrupt |
bogdanm | 82:6473597d706e | 464 | * YY: Register index |
bogdanm | 82:6473597d706e | 465 | * ZZZZ: Flag position |
bogdanm | 82:6473597d706e | 466 | * @{ |
bogdanm | 82:6473597d706e | 467 | */ |
bogdanm | 82:6473597d706e | 468 | |
bogdanm | 82:6473597d706e | 469 | #define USART_IT_WU ((uint32_t)0x00140316) |
bogdanm | 82:6473597d706e | 470 | #define USART_IT_CM ((uint32_t)0x0011010E) |
bogdanm | 82:6473597d706e | 471 | #define USART_IT_EOB ((uint32_t)0x000C011B) |
bogdanm | 82:6473597d706e | 472 | #define USART_IT_RTO ((uint32_t)0x000B011A) |
bogdanm | 82:6473597d706e | 473 | #define USART_IT_PE ((uint32_t)0x00000108) |
bogdanm | 82:6473597d706e | 474 | #define USART_IT_TXE ((uint32_t)0x00070107) |
bogdanm | 82:6473597d706e | 475 | #define USART_IT_TC ((uint32_t)0x00060106) |
bogdanm | 82:6473597d706e | 476 | #define USART_IT_RXNE ((uint32_t)0x00050105) |
bogdanm | 82:6473597d706e | 477 | #define USART_IT_IDLE ((uint32_t)0x00040104) |
bogdanm | 82:6473597d706e | 478 | #define USART_IT_LBD ((uint32_t)0x00080206) |
bogdanm | 82:6473597d706e | 479 | #define USART_IT_CTS ((uint32_t)0x0009030A) |
bogdanm | 82:6473597d706e | 480 | #define USART_IT_ERR ((uint32_t)0x00000300) |
bogdanm | 82:6473597d706e | 481 | #define USART_IT_ORE ((uint32_t)0x00030300) |
bogdanm | 82:6473597d706e | 482 | #define USART_IT_NE ((uint32_t)0x00020300) |
bogdanm | 82:6473597d706e | 483 | #define USART_IT_FE ((uint32_t)0x00010300) |
bogdanm | 82:6473597d706e | 484 | |
bogdanm | 82:6473597d706e | 485 | #define IS_USART_CONFIG_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \ |
bogdanm | 82:6473597d706e | 486 | ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \ |
bogdanm | 82:6473597d706e | 487 | ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \ |
bogdanm | 82:6473597d706e | 488 | ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ERR) || \ |
bogdanm | 82:6473597d706e | 489 | ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \ |
bogdanm | 82:6473597d706e | 490 | ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU)) |
bogdanm | 82:6473597d706e | 491 | |
bogdanm | 82:6473597d706e | 492 | #define IS_USART_GET_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \ |
bogdanm | 82:6473597d706e | 493 | ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \ |
bogdanm | 82:6473597d706e | 494 | ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \ |
bogdanm | 82:6473597d706e | 495 | ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ORE) || \ |
bogdanm | 82:6473597d706e | 496 | ((IT) == USART_IT_NE) || ((IT) == USART_IT_FE) || \ |
bogdanm | 82:6473597d706e | 497 | ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \ |
bogdanm | 82:6473597d706e | 498 | ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU)) |
bogdanm | 82:6473597d706e | 499 | |
bogdanm | 82:6473597d706e | 500 | #define IS_USART_CLEAR_IT(IT) (((IT) == USART_IT_TC) || ((IT) == USART_IT_PE) || \ |
bogdanm | 82:6473597d706e | 501 | ((IT) == USART_IT_FE) || ((IT) == USART_IT_NE) || \ |
bogdanm | 82:6473597d706e | 502 | ((IT) == USART_IT_ORE) || ((IT) == USART_IT_IDLE) || \ |
bogdanm | 82:6473597d706e | 503 | ((IT) == USART_IT_LBD) || ((IT) == USART_IT_CTS) || \ |
bogdanm | 82:6473597d706e | 504 | ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \ |
bogdanm | 82:6473597d706e | 505 | ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU)) |
bogdanm | 82:6473597d706e | 506 | /** |
bogdanm | 82:6473597d706e | 507 | * @} |
bogdanm | 82:6473597d706e | 508 | */ |
bogdanm | 82:6473597d706e | 509 | |
bogdanm | 82:6473597d706e | 510 | /** @defgroup USART_Global_definition |
bogdanm | 82:6473597d706e | 511 | * @{ |
bogdanm | 82:6473597d706e | 512 | */ |
bogdanm | 82:6473597d706e | 513 | |
bogdanm | 82:6473597d706e | 514 | #define IS_USART_BAUDRATE(BAUDRATE) (((BAUDRATE) > 0) && ((BAUDRATE) < 0x005B8D81)) |
bogdanm | 82:6473597d706e | 515 | #define IS_USART_DE_ASSERTION_DEASSERTION_TIME(TIME) ((TIME) <= 0x1F) |
bogdanm | 82:6473597d706e | 516 | #define IS_USART_AUTO_RETRY_COUNTER(COUNTER) ((COUNTER) <= 0x7) |
bogdanm | 82:6473597d706e | 517 | #define IS_USART_TIMEOUT(TIMEOUT) ((TIMEOUT) <= 0x00FFFFFF) |
bogdanm | 82:6473597d706e | 518 | #define IS_USART_DATA(DATA) ((DATA) <= 0x1FF) |
bogdanm | 82:6473597d706e | 519 | |
bogdanm | 82:6473597d706e | 520 | /** |
bogdanm | 82:6473597d706e | 521 | * @} |
bogdanm | 82:6473597d706e | 522 | */ |
bogdanm | 82:6473597d706e | 523 | |
bogdanm | 82:6473597d706e | 524 | /** |
bogdanm | 82:6473597d706e | 525 | * @} |
bogdanm | 82:6473597d706e | 526 | */ |
bogdanm | 82:6473597d706e | 527 | |
bogdanm | 82:6473597d706e | 528 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 529 | /* Exported functions ------------------------------------------------------- */ |
bogdanm | 82:6473597d706e | 530 | |
bogdanm | 82:6473597d706e | 531 | /* Initialization and Configuration functions *********************************/ |
bogdanm | 82:6473597d706e | 532 | void USART_DeInit(USART_TypeDef* USARTx); |
bogdanm | 82:6473597d706e | 533 | void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct); |
bogdanm | 82:6473597d706e | 534 | void USART_StructInit(USART_InitTypeDef* USART_InitStruct); |
bogdanm | 82:6473597d706e | 535 | void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct); |
bogdanm | 82:6473597d706e | 536 | void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct); |
bogdanm | 82:6473597d706e | 537 | void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 538 | void USART_DirectionModeCmd(USART_TypeDef* USARTx, uint32_t USART_DirectionMode, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 539 | void USART_SetPrescaler(USART_TypeDef* USARTx, uint8_t USART_Prescaler); |
bogdanm | 82:6473597d706e | 540 | void USART_OverSampling8Cmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 541 | void USART_OneBitMethodCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 542 | void USART_MSBFirstCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 543 | void USART_DataInvCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 544 | void USART_InvPinCmd(USART_TypeDef* USARTx, uint32_t USART_InvPin, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 545 | void USART_SWAPPinCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 546 | void USART_ReceiverTimeOutCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 547 | void USART_SetReceiverTimeOut(USART_TypeDef* USARTx, uint32_t USART_ReceiverTimeOut); |
bogdanm | 82:6473597d706e | 548 | |
bogdanm | 82:6473597d706e | 549 | /* STOP Mode functions ********************************************************/ |
bogdanm | 82:6473597d706e | 550 | void USART_STOPModeCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 551 | void USART_StopModeWakeUpSourceConfig(USART_TypeDef* USARTx, uint32_t USART_WakeUpSource); |
bogdanm | 82:6473597d706e | 552 | |
bogdanm | 82:6473597d706e | 553 | /* AutoBaudRate functions *****************************************************/ |
bogdanm | 82:6473597d706e | 554 | void USART_AutoBaudRateCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 555 | void USART_AutoBaudRateConfig(USART_TypeDef* USARTx, uint32_t USART_AutoBaudRate); |
bogdanm | 82:6473597d706e | 556 | |
bogdanm | 82:6473597d706e | 557 | /* Data transfers functions ***************************************************/ |
bogdanm | 82:6473597d706e | 558 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data); |
bogdanm | 82:6473597d706e | 559 | uint16_t USART_ReceiveData(USART_TypeDef* USARTx); |
bogdanm | 82:6473597d706e | 560 | |
bogdanm | 82:6473597d706e | 561 | /* Multi-Processor Communication functions ************************************/ |
bogdanm | 82:6473597d706e | 562 | void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address); |
bogdanm | 82:6473597d706e | 563 | void USART_MuteModeWakeUpConfig(USART_TypeDef* USARTx, uint32_t USART_WakeUp); |
bogdanm | 82:6473597d706e | 564 | void USART_MuteModeCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 565 | void USART_AddressDetectionConfig(USART_TypeDef* USARTx, uint32_t USART_AddressLength); |
bogdanm | 82:6473597d706e | 566 | /* LIN mode functions *********************************************************/ |
bogdanm | 82:6473597d706e | 567 | void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, uint32_t USART_LINBreakDetectLength); |
bogdanm | 82:6473597d706e | 568 | void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 569 | |
bogdanm | 82:6473597d706e | 570 | /* Half-duplex mode function **************************************************/ |
bogdanm | 82:6473597d706e | 571 | void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 572 | |
bogdanm | 82:6473597d706e | 573 | /* Smartcard mode functions ***************************************************/ |
bogdanm | 82:6473597d706e | 574 | void USART_SmartCardCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 575 | void USART_SmartCardNACKCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 576 | void USART_SetGuardTime(USART_TypeDef* USARTx, uint8_t USART_GuardTime); |
bogdanm | 82:6473597d706e | 577 | void USART_SetAutoRetryCount(USART_TypeDef* USARTx, uint8_t USART_AutoCount); |
bogdanm | 82:6473597d706e | 578 | void USART_SetBlockLength(USART_TypeDef* USARTx, uint8_t USART_BlockLength); |
bogdanm | 82:6473597d706e | 579 | |
bogdanm | 82:6473597d706e | 580 | /* IrDA mode functions ********************************************************/ |
bogdanm | 82:6473597d706e | 581 | void USART_IrDAConfig(USART_TypeDef* USARTx, uint32_t USART_IrDAMode); |
bogdanm | 82:6473597d706e | 582 | void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 583 | |
bogdanm | 82:6473597d706e | 584 | /* RS485 mode functions *******************************************************/ |
bogdanm | 82:6473597d706e | 585 | void USART_DECmd(USART_TypeDef* USARTx, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 586 | void USART_DEPolarityConfig(USART_TypeDef* USARTx, uint32_t USART_DEPolarity); |
bogdanm | 82:6473597d706e | 587 | void USART_SetDEAssertionTime(USART_TypeDef* USARTx, uint32_t USART_DEAssertionTime); |
bogdanm | 82:6473597d706e | 588 | void USART_SetDEDeassertionTime(USART_TypeDef* USARTx, uint32_t USART_DEDeassertionTime); |
bogdanm | 82:6473597d706e | 589 | |
bogdanm | 82:6473597d706e | 590 | /* DMA transfers management functions *****************************************/ |
bogdanm | 82:6473597d706e | 591 | void USART_DMACmd(USART_TypeDef* USARTx, uint32_t USART_DMAReq, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 592 | void USART_DMAReceptionErrorConfig(USART_TypeDef* USARTx, uint32_t USART_DMAOnError); |
bogdanm | 82:6473597d706e | 593 | |
bogdanm | 82:6473597d706e | 594 | /* Interrupts and flags management functions **********************************/ |
bogdanm | 82:6473597d706e | 595 | void USART_ITConfig(USART_TypeDef* USARTx, uint32_t USART_IT, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 596 | void USART_RequestCmd(USART_TypeDef* USARTx, uint32_t USART_Request, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 597 | void USART_OverrunDetectionConfig(USART_TypeDef* USARTx, uint32_t USART_OVRDetection); |
bogdanm | 82:6473597d706e | 598 | FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG); |
bogdanm | 82:6473597d706e | 599 | void USART_ClearFlag(USART_TypeDef* USARTx, uint32_t USART_FLAG); |
bogdanm | 82:6473597d706e | 600 | ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint32_t USART_IT); |
bogdanm | 82:6473597d706e | 601 | void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint32_t USART_IT); |
bogdanm | 82:6473597d706e | 602 | |
bogdanm | 82:6473597d706e | 603 | #ifdef __cplusplus |
bogdanm | 82:6473597d706e | 604 | } |
bogdanm | 82:6473597d706e | 605 | #endif |
bogdanm | 82:6473597d706e | 606 | |
bogdanm | 82:6473597d706e | 607 | #endif /* __STM32F30x_USART_H */ |
bogdanm | 82:6473597d706e | 608 | |
bogdanm | 82:6473597d706e | 609 | /** |
bogdanm | 82:6473597d706e | 610 | * @} |
bogdanm | 82:6473597d706e | 611 | */ |
bogdanm | 82:6473597d706e | 612 | |
bogdanm | 82:6473597d706e | 613 | /** |
bogdanm | 82:6473597d706e | 614 | * @} |
bogdanm | 82:6473597d706e | 615 | */ |
bogdanm | 82:6473597d706e | 616 | |
bogdanm | 82:6473597d706e | 617 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |