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:
157:90e3acc479a2
test with CLOCK_SETUP = 0

Who changed what in which revision?

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