mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
130:1dec54e4aec3
test with CLOCK_SETUP = 0

Who changed what in which revision?

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