mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_usart.h@52:a51c77007319, 2013-12-02 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Dec 02 11:30:05 2013 +0000
- Revision:
- 52:a51c77007319
- Child:
- 70:c1fbde68b492
Synchronized with git revision 49df530ae72ce97ccc773d1f2c13b38e868e6abd
Full URL: https://github.com/mbedmicro/mbed/commit/49df530ae72ce97ccc773d1f2c13b38e868e6abd/
Add STMicroelectronics NUCLEO_F103RB target
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 52:a51c77007319 | 1 | /** |
mbed_official | 52:a51c77007319 | 2 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 3 | * @file stm32f10x_usart.h |
mbed_official | 52:a51c77007319 | 4 | * @author MCD Application Team |
mbed_official | 52:a51c77007319 | 5 | * @version V3.5.0 |
mbed_official | 52:a51c77007319 | 6 | * @date 11-March-2011 |
mbed_official | 52:a51c77007319 | 7 | * @brief This file contains all the functions prototypes for the USART |
mbed_official | 52:a51c77007319 | 8 | * firmware library. |
mbed_official | 52:a51c77007319 | 9 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 10 | * @attention |
mbed_official | 52:a51c77007319 | 11 | * |
mbed_official | 52:a51c77007319 | 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
mbed_official | 52:a51c77007319 | 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE |
mbed_official | 52:a51c77007319 | 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY |
mbed_official | 52:a51c77007319 | 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING |
mbed_official | 52:a51c77007319 | 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE |
mbed_official | 52:a51c77007319 | 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
mbed_official | 52:a51c77007319 | 18 | * |
mbed_official | 52:a51c77007319 | 19 | * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> |
mbed_official | 52:a51c77007319 | 20 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 21 | */ |
mbed_official | 52:a51c77007319 | 22 | |
mbed_official | 52:a51c77007319 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 52:a51c77007319 | 24 | #ifndef __STM32F10x_USART_H |
mbed_official | 52:a51c77007319 | 25 | #define __STM32F10x_USART_H |
mbed_official | 52:a51c77007319 | 26 | |
mbed_official | 52:a51c77007319 | 27 | #ifdef __cplusplus |
mbed_official | 52:a51c77007319 | 28 | extern "C" { |
mbed_official | 52:a51c77007319 | 29 | #endif |
mbed_official | 52:a51c77007319 | 30 | |
mbed_official | 52:a51c77007319 | 31 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 52:a51c77007319 | 32 | #include "stm32f10x.h" |
mbed_official | 52:a51c77007319 | 33 | |
mbed_official | 52:a51c77007319 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver |
mbed_official | 52:a51c77007319 | 35 | * @{ |
mbed_official | 52:a51c77007319 | 36 | */ |
mbed_official | 52:a51c77007319 | 37 | |
mbed_official | 52:a51c77007319 | 38 | /** @addtogroup USART |
mbed_official | 52:a51c77007319 | 39 | * @{ |
mbed_official | 52:a51c77007319 | 40 | */ |
mbed_official | 52:a51c77007319 | 41 | |
mbed_official | 52:a51c77007319 | 42 | /** @defgroup USART_Exported_Types |
mbed_official | 52:a51c77007319 | 43 | * @{ |
mbed_official | 52:a51c77007319 | 44 | */ |
mbed_official | 52:a51c77007319 | 45 | |
mbed_official | 52:a51c77007319 | 46 | /** |
mbed_official | 52:a51c77007319 | 47 | * @brief USART Init Structure definition |
mbed_official | 52:a51c77007319 | 48 | */ |
mbed_official | 52:a51c77007319 | 49 | |
mbed_official | 52:a51c77007319 | 50 | typedef struct |
mbed_official | 52:a51c77007319 | 51 | { |
mbed_official | 52:a51c77007319 | 52 | uint32_t USART_BaudRate; /*!< This member configures the USART communication baud rate. |
mbed_official | 52:a51c77007319 | 53 | The baud rate is computed using the following formula: |
mbed_official | 52:a51c77007319 | 54 | - IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate))) |
mbed_official | 52:a51c77007319 | 55 | - FractionalDivider = ((IntegerDivider - ((u32) IntegerDivider)) * 16) + 0.5 */ |
mbed_official | 52:a51c77007319 | 56 | |
mbed_official | 52:a51c77007319 | 57 | uint16_t USART_WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
mbed_official | 52:a51c77007319 | 58 | This parameter can be a value of @ref USART_Word_Length */ |
mbed_official | 52:a51c77007319 | 59 | |
mbed_official | 52:a51c77007319 | 60 | uint16_t USART_StopBits; /*!< Specifies the number of stop bits transmitted. |
mbed_official | 52:a51c77007319 | 61 | This parameter can be a value of @ref USART_Stop_Bits */ |
mbed_official | 52:a51c77007319 | 62 | |
mbed_official | 52:a51c77007319 | 63 | uint16_t USART_Parity; /*!< Specifies the parity mode. |
mbed_official | 52:a51c77007319 | 64 | This parameter can be a value of @ref USART_Parity |
mbed_official | 52:a51c77007319 | 65 | @note When parity is enabled, the computed parity is inserted |
mbed_official | 52:a51c77007319 | 66 | at the MSB position of the transmitted data (9th bit when |
mbed_official | 52:a51c77007319 | 67 | the word length is set to 9 data bits; 8th bit when the |
mbed_official | 52:a51c77007319 | 68 | word length is set to 8 data bits). */ |
mbed_official | 52:a51c77007319 | 69 | |
mbed_official | 52:a51c77007319 | 70 | uint16_t USART_Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled. |
mbed_official | 52:a51c77007319 | 71 | This parameter can be a value of @ref USART_Mode */ |
mbed_official | 52:a51c77007319 | 72 | |
mbed_official | 52:a51c77007319 | 73 | uint16_t USART_HardwareFlowControl; /*!< Specifies wether the hardware flow control mode is enabled |
mbed_official | 52:a51c77007319 | 74 | or disabled. |
mbed_official | 52:a51c77007319 | 75 | This parameter can be a value of @ref USART_Hardware_Flow_Control */ |
mbed_official | 52:a51c77007319 | 76 | } USART_InitTypeDef; |
mbed_official | 52:a51c77007319 | 77 | |
mbed_official | 52:a51c77007319 | 78 | /** |
mbed_official | 52:a51c77007319 | 79 | * @brief USART Clock Init Structure definition |
mbed_official | 52:a51c77007319 | 80 | */ |
mbed_official | 52:a51c77007319 | 81 | |
mbed_official | 52:a51c77007319 | 82 | typedef struct |
mbed_official | 52:a51c77007319 | 83 | { |
mbed_official | 52:a51c77007319 | 84 | |
mbed_official | 52:a51c77007319 | 85 | uint16_t USART_Clock; /*!< Specifies whether the USART clock is enabled or disabled. |
mbed_official | 52:a51c77007319 | 86 | This parameter can be a value of @ref USART_Clock */ |
mbed_official | 52:a51c77007319 | 87 | |
mbed_official | 52:a51c77007319 | 88 | uint16_t USART_CPOL; /*!< Specifies the steady state value of the serial clock. |
mbed_official | 52:a51c77007319 | 89 | This parameter can be a value of @ref USART_Clock_Polarity */ |
mbed_official | 52:a51c77007319 | 90 | |
mbed_official | 52:a51c77007319 | 91 | uint16_t USART_CPHA; /*!< Specifies the clock transition on which the bit capture is made. |
mbed_official | 52:a51c77007319 | 92 | This parameter can be a value of @ref USART_Clock_Phase */ |
mbed_official | 52:a51c77007319 | 93 | |
mbed_official | 52:a51c77007319 | 94 | uint16_t USART_LastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
mbed_official | 52:a51c77007319 | 95 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
mbed_official | 52:a51c77007319 | 96 | This parameter can be a value of @ref USART_Last_Bit */ |
mbed_official | 52:a51c77007319 | 97 | } USART_ClockInitTypeDef; |
mbed_official | 52:a51c77007319 | 98 | |
mbed_official | 52:a51c77007319 | 99 | /** |
mbed_official | 52:a51c77007319 | 100 | * @} |
mbed_official | 52:a51c77007319 | 101 | */ |
mbed_official | 52:a51c77007319 | 102 | |
mbed_official | 52:a51c77007319 | 103 | /** @defgroup USART_Exported_Constants |
mbed_official | 52:a51c77007319 | 104 | * @{ |
mbed_official | 52:a51c77007319 | 105 | */ |
mbed_official | 52:a51c77007319 | 106 | |
mbed_official | 52:a51c77007319 | 107 | #define IS_USART_ALL_PERIPH(PERIPH) (((PERIPH) == USART1) || \ |
mbed_official | 52:a51c77007319 | 108 | ((PERIPH) == USART2) || \ |
mbed_official | 52:a51c77007319 | 109 | ((PERIPH) == USART3) || \ |
mbed_official | 52:a51c77007319 | 110 | ((PERIPH) == UART4) || \ |
mbed_official | 52:a51c77007319 | 111 | ((PERIPH) == UART5)) |
mbed_official | 52:a51c77007319 | 112 | |
mbed_official | 52:a51c77007319 | 113 | #define IS_USART_123_PERIPH(PERIPH) (((PERIPH) == USART1) || \ |
mbed_official | 52:a51c77007319 | 114 | ((PERIPH) == USART2) || \ |
mbed_official | 52:a51c77007319 | 115 | ((PERIPH) == USART3)) |
mbed_official | 52:a51c77007319 | 116 | |
mbed_official | 52:a51c77007319 | 117 | #define IS_USART_1234_PERIPH(PERIPH) (((PERIPH) == USART1) || \ |
mbed_official | 52:a51c77007319 | 118 | ((PERIPH) == USART2) || \ |
mbed_official | 52:a51c77007319 | 119 | ((PERIPH) == USART3) || \ |
mbed_official | 52:a51c77007319 | 120 | ((PERIPH) == UART4)) |
mbed_official | 52:a51c77007319 | 121 | /** @defgroup USART_Word_Length |
mbed_official | 52:a51c77007319 | 122 | * @{ |
mbed_official | 52:a51c77007319 | 123 | */ |
mbed_official | 52:a51c77007319 | 124 | |
mbed_official | 52:a51c77007319 | 125 | #define USART_WordLength_8b ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 126 | #define USART_WordLength_9b ((uint16_t)0x1000) |
mbed_official | 52:a51c77007319 | 127 | |
mbed_official | 52:a51c77007319 | 128 | #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \ |
mbed_official | 52:a51c77007319 | 129 | ((LENGTH) == USART_WordLength_9b)) |
mbed_official | 52:a51c77007319 | 130 | /** |
mbed_official | 52:a51c77007319 | 131 | * @} |
mbed_official | 52:a51c77007319 | 132 | */ |
mbed_official | 52:a51c77007319 | 133 | |
mbed_official | 52:a51c77007319 | 134 | /** @defgroup USART_Stop_Bits |
mbed_official | 52:a51c77007319 | 135 | * @{ |
mbed_official | 52:a51c77007319 | 136 | */ |
mbed_official | 52:a51c77007319 | 137 | |
mbed_official | 52:a51c77007319 | 138 | #define USART_StopBits_1 ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 139 | #define USART_StopBits_0_5 ((uint16_t)0x1000) |
mbed_official | 52:a51c77007319 | 140 | #define USART_StopBits_2 ((uint16_t)0x2000) |
mbed_official | 52:a51c77007319 | 141 | #define USART_StopBits_1_5 ((uint16_t)0x3000) |
mbed_official | 52:a51c77007319 | 142 | #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \ |
mbed_official | 52:a51c77007319 | 143 | ((STOPBITS) == USART_StopBits_0_5) || \ |
mbed_official | 52:a51c77007319 | 144 | ((STOPBITS) == USART_StopBits_2) || \ |
mbed_official | 52:a51c77007319 | 145 | ((STOPBITS) == USART_StopBits_1_5)) |
mbed_official | 52:a51c77007319 | 146 | /** |
mbed_official | 52:a51c77007319 | 147 | * @} |
mbed_official | 52:a51c77007319 | 148 | */ |
mbed_official | 52:a51c77007319 | 149 | |
mbed_official | 52:a51c77007319 | 150 | /** @defgroup USART_Parity |
mbed_official | 52:a51c77007319 | 151 | * @{ |
mbed_official | 52:a51c77007319 | 152 | */ |
mbed_official | 52:a51c77007319 | 153 | |
mbed_official | 52:a51c77007319 | 154 | #define USART_Parity_No ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 155 | #define USART_Parity_Even ((uint16_t)0x0400) |
mbed_official | 52:a51c77007319 | 156 | #define USART_Parity_Odd ((uint16_t)0x0600) |
mbed_official | 52:a51c77007319 | 157 | #define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \ |
mbed_official | 52:a51c77007319 | 158 | ((PARITY) == USART_Parity_Even) || \ |
mbed_official | 52:a51c77007319 | 159 | ((PARITY) == USART_Parity_Odd)) |
mbed_official | 52:a51c77007319 | 160 | /** |
mbed_official | 52:a51c77007319 | 161 | * @} |
mbed_official | 52:a51c77007319 | 162 | */ |
mbed_official | 52:a51c77007319 | 163 | |
mbed_official | 52:a51c77007319 | 164 | /** @defgroup USART_Mode |
mbed_official | 52:a51c77007319 | 165 | * @{ |
mbed_official | 52:a51c77007319 | 166 | */ |
mbed_official | 52:a51c77007319 | 167 | |
mbed_official | 52:a51c77007319 | 168 | #define USART_Mode_Rx ((uint16_t)0x0004) |
mbed_official | 52:a51c77007319 | 169 | #define USART_Mode_Tx ((uint16_t)0x0008) |
mbed_official | 52:a51c77007319 | 170 | #define IS_USART_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00)) |
mbed_official | 52:a51c77007319 | 171 | /** |
mbed_official | 52:a51c77007319 | 172 | * @} |
mbed_official | 52:a51c77007319 | 173 | */ |
mbed_official | 52:a51c77007319 | 174 | |
mbed_official | 52:a51c77007319 | 175 | /** @defgroup USART_Hardware_Flow_Control |
mbed_official | 52:a51c77007319 | 176 | * @{ |
mbed_official | 52:a51c77007319 | 177 | */ |
mbed_official | 52:a51c77007319 | 178 | #define USART_HardwareFlowControl_None ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 179 | #define USART_HardwareFlowControl_RTS ((uint16_t)0x0100) |
mbed_official | 52:a51c77007319 | 180 | #define USART_HardwareFlowControl_CTS ((uint16_t)0x0200) |
mbed_official | 52:a51c77007319 | 181 | #define USART_HardwareFlowControl_RTS_CTS ((uint16_t)0x0300) |
mbed_official | 52:a51c77007319 | 182 | #define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\ |
mbed_official | 52:a51c77007319 | 183 | (((CONTROL) == USART_HardwareFlowControl_None) || \ |
mbed_official | 52:a51c77007319 | 184 | ((CONTROL) == USART_HardwareFlowControl_RTS) || \ |
mbed_official | 52:a51c77007319 | 185 | ((CONTROL) == USART_HardwareFlowControl_CTS) || \ |
mbed_official | 52:a51c77007319 | 186 | ((CONTROL) == USART_HardwareFlowControl_RTS_CTS)) |
mbed_official | 52:a51c77007319 | 187 | /** |
mbed_official | 52:a51c77007319 | 188 | * @} |
mbed_official | 52:a51c77007319 | 189 | */ |
mbed_official | 52:a51c77007319 | 190 | |
mbed_official | 52:a51c77007319 | 191 | /** @defgroup USART_Clock |
mbed_official | 52:a51c77007319 | 192 | * @{ |
mbed_official | 52:a51c77007319 | 193 | */ |
mbed_official | 52:a51c77007319 | 194 | #define USART_Clock_Disable ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 195 | #define USART_Clock_Enable ((uint16_t)0x0800) |
mbed_official | 52:a51c77007319 | 196 | #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \ |
mbed_official | 52:a51c77007319 | 197 | ((CLOCK) == USART_Clock_Enable)) |
mbed_official | 52:a51c77007319 | 198 | /** |
mbed_official | 52:a51c77007319 | 199 | * @} |
mbed_official | 52:a51c77007319 | 200 | */ |
mbed_official | 52:a51c77007319 | 201 | |
mbed_official | 52:a51c77007319 | 202 | /** @defgroup USART_Clock_Polarity |
mbed_official | 52:a51c77007319 | 203 | * @{ |
mbed_official | 52:a51c77007319 | 204 | */ |
mbed_official | 52:a51c77007319 | 205 | |
mbed_official | 52:a51c77007319 | 206 | #define USART_CPOL_Low ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 207 | #define USART_CPOL_High ((uint16_t)0x0400) |
mbed_official | 52:a51c77007319 | 208 | #define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High)) |
mbed_official | 52:a51c77007319 | 209 | |
mbed_official | 52:a51c77007319 | 210 | /** |
mbed_official | 52:a51c77007319 | 211 | * @} |
mbed_official | 52:a51c77007319 | 212 | */ |
mbed_official | 52:a51c77007319 | 213 | |
mbed_official | 52:a51c77007319 | 214 | /** @defgroup USART_Clock_Phase |
mbed_official | 52:a51c77007319 | 215 | * @{ |
mbed_official | 52:a51c77007319 | 216 | */ |
mbed_official | 52:a51c77007319 | 217 | |
mbed_official | 52:a51c77007319 | 218 | #define USART_CPHA_1Edge ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 219 | #define USART_CPHA_2Edge ((uint16_t)0x0200) |
mbed_official | 52:a51c77007319 | 220 | #define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge)) |
mbed_official | 52:a51c77007319 | 221 | |
mbed_official | 52:a51c77007319 | 222 | /** |
mbed_official | 52:a51c77007319 | 223 | * @} |
mbed_official | 52:a51c77007319 | 224 | */ |
mbed_official | 52:a51c77007319 | 225 | |
mbed_official | 52:a51c77007319 | 226 | /** @defgroup USART_Last_Bit |
mbed_official | 52:a51c77007319 | 227 | * @{ |
mbed_official | 52:a51c77007319 | 228 | */ |
mbed_official | 52:a51c77007319 | 229 | |
mbed_official | 52:a51c77007319 | 230 | #define USART_LastBit_Disable ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 231 | #define USART_LastBit_Enable ((uint16_t)0x0100) |
mbed_official | 52:a51c77007319 | 232 | #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \ |
mbed_official | 52:a51c77007319 | 233 | ((LASTBIT) == USART_LastBit_Enable)) |
mbed_official | 52:a51c77007319 | 234 | /** |
mbed_official | 52:a51c77007319 | 235 | * @} |
mbed_official | 52:a51c77007319 | 236 | */ |
mbed_official | 52:a51c77007319 | 237 | |
mbed_official | 52:a51c77007319 | 238 | /** @defgroup USART_Interrupt_definition |
mbed_official | 52:a51c77007319 | 239 | * @{ |
mbed_official | 52:a51c77007319 | 240 | */ |
mbed_official | 52:a51c77007319 | 241 | |
mbed_official | 52:a51c77007319 | 242 | #define USART_IT_PE ((uint16_t)0x0028) |
mbed_official | 52:a51c77007319 | 243 | #define USART_IT_TXE ((uint16_t)0x0727) |
mbed_official | 52:a51c77007319 | 244 | #define USART_IT_TC ((uint16_t)0x0626) |
mbed_official | 52:a51c77007319 | 245 | #define USART_IT_RXNE ((uint16_t)0x0525) |
mbed_official | 52:a51c77007319 | 246 | #define USART_IT_IDLE ((uint16_t)0x0424) |
mbed_official | 52:a51c77007319 | 247 | #define USART_IT_LBD ((uint16_t)0x0846) |
mbed_official | 52:a51c77007319 | 248 | #define USART_IT_CTS ((uint16_t)0x096A) |
mbed_official | 52:a51c77007319 | 249 | #define USART_IT_ERR ((uint16_t)0x0060) |
mbed_official | 52:a51c77007319 | 250 | #define USART_IT_ORE ((uint16_t)0x0360) |
mbed_official | 52:a51c77007319 | 251 | #define USART_IT_NE ((uint16_t)0x0260) |
mbed_official | 52:a51c77007319 | 252 | #define USART_IT_FE ((uint16_t)0x0160) |
mbed_official | 52:a51c77007319 | 253 | #define IS_USART_CONFIG_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \ |
mbed_official | 52:a51c77007319 | 254 | ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \ |
mbed_official | 52:a51c77007319 | 255 | ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \ |
mbed_official | 52:a51c77007319 | 256 | ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ERR)) |
mbed_official | 52:a51c77007319 | 257 | #define IS_USART_GET_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \ |
mbed_official | 52:a51c77007319 | 258 | ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \ |
mbed_official | 52:a51c77007319 | 259 | ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \ |
mbed_official | 52:a51c77007319 | 260 | ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ORE) || \ |
mbed_official | 52:a51c77007319 | 261 | ((IT) == USART_IT_NE) || ((IT) == USART_IT_FE)) |
mbed_official | 52:a51c77007319 | 262 | #define IS_USART_CLEAR_IT(IT) (((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \ |
mbed_official | 52:a51c77007319 | 263 | ((IT) == USART_IT_LBD) || ((IT) == USART_IT_CTS)) |
mbed_official | 52:a51c77007319 | 264 | /** |
mbed_official | 52:a51c77007319 | 265 | * @} |
mbed_official | 52:a51c77007319 | 266 | */ |
mbed_official | 52:a51c77007319 | 267 | |
mbed_official | 52:a51c77007319 | 268 | /** @defgroup USART_DMA_Requests |
mbed_official | 52:a51c77007319 | 269 | * @{ |
mbed_official | 52:a51c77007319 | 270 | */ |
mbed_official | 52:a51c77007319 | 271 | |
mbed_official | 52:a51c77007319 | 272 | #define USART_DMAReq_Tx ((uint16_t)0x0080) |
mbed_official | 52:a51c77007319 | 273 | #define USART_DMAReq_Rx ((uint16_t)0x0040) |
mbed_official | 52:a51c77007319 | 274 | #define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFF3F) == 0x00) && ((DMAREQ) != (uint16_t)0x00)) |
mbed_official | 52:a51c77007319 | 275 | |
mbed_official | 52:a51c77007319 | 276 | /** |
mbed_official | 52:a51c77007319 | 277 | * @} |
mbed_official | 52:a51c77007319 | 278 | */ |
mbed_official | 52:a51c77007319 | 279 | |
mbed_official | 52:a51c77007319 | 280 | /** @defgroup USART_WakeUp_methods |
mbed_official | 52:a51c77007319 | 281 | * @{ |
mbed_official | 52:a51c77007319 | 282 | */ |
mbed_official | 52:a51c77007319 | 283 | |
mbed_official | 52:a51c77007319 | 284 | #define USART_WakeUp_IdleLine ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 285 | #define USART_WakeUp_AddressMark ((uint16_t)0x0800) |
mbed_official | 52:a51c77007319 | 286 | #define IS_USART_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \ |
mbed_official | 52:a51c77007319 | 287 | ((WAKEUP) == USART_WakeUp_AddressMark)) |
mbed_official | 52:a51c77007319 | 288 | /** |
mbed_official | 52:a51c77007319 | 289 | * @} |
mbed_official | 52:a51c77007319 | 290 | */ |
mbed_official | 52:a51c77007319 | 291 | |
mbed_official | 52:a51c77007319 | 292 | /** @defgroup USART_LIN_Break_Detection_Length |
mbed_official | 52:a51c77007319 | 293 | * @{ |
mbed_official | 52:a51c77007319 | 294 | */ |
mbed_official | 52:a51c77007319 | 295 | |
mbed_official | 52:a51c77007319 | 296 | #define USART_LINBreakDetectLength_10b ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 297 | #define USART_LINBreakDetectLength_11b ((uint16_t)0x0020) |
mbed_official | 52:a51c77007319 | 298 | #define IS_USART_LIN_BREAK_DETECT_LENGTH(LENGTH) \ |
mbed_official | 52:a51c77007319 | 299 | (((LENGTH) == USART_LINBreakDetectLength_10b) || \ |
mbed_official | 52:a51c77007319 | 300 | ((LENGTH) == USART_LINBreakDetectLength_11b)) |
mbed_official | 52:a51c77007319 | 301 | /** |
mbed_official | 52:a51c77007319 | 302 | * @} |
mbed_official | 52:a51c77007319 | 303 | */ |
mbed_official | 52:a51c77007319 | 304 | |
mbed_official | 52:a51c77007319 | 305 | /** @defgroup USART_IrDA_Low_Power |
mbed_official | 52:a51c77007319 | 306 | * @{ |
mbed_official | 52:a51c77007319 | 307 | */ |
mbed_official | 52:a51c77007319 | 308 | |
mbed_official | 52:a51c77007319 | 309 | #define USART_IrDAMode_LowPower ((uint16_t)0x0004) |
mbed_official | 52:a51c77007319 | 310 | #define USART_IrDAMode_Normal ((uint16_t)0x0000) |
mbed_official | 52:a51c77007319 | 311 | #define IS_USART_IRDA_MODE(MODE) (((MODE) == USART_IrDAMode_LowPower) || \ |
mbed_official | 52:a51c77007319 | 312 | ((MODE) == USART_IrDAMode_Normal)) |
mbed_official | 52:a51c77007319 | 313 | /** |
mbed_official | 52:a51c77007319 | 314 | * @} |
mbed_official | 52:a51c77007319 | 315 | */ |
mbed_official | 52:a51c77007319 | 316 | |
mbed_official | 52:a51c77007319 | 317 | /** @defgroup USART_Flags |
mbed_official | 52:a51c77007319 | 318 | * @{ |
mbed_official | 52:a51c77007319 | 319 | */ |
mbed_official | 52:a51c77007319 | 320 | |
mbed_official | 52:a51c77007319 | 321 | #define USART_FLAG_CTS ((uint16_t)0x0200) |
mbed_official | 52:a51c77007319 | 322 | #define USART_FLAG_LBD ((uint16_t)0x0100) |
mbed_official | 52:a51c77007319 | 323 | #define USART_FLAG_TXE ((uint16_t)0x0080) |
mbed_official | 52:a51c77007319 | 324 | #define USART_FLAG_TC ((uint16_t)0x0040) |
mbed_official | 52:a51c77007319 | 325 | #define USART_FLAG_RXNE ((uint16_t)0x0020) |
mbed_official | 52:a51c77007319 | 326 | #define USART_FLAG_IDLE ((uint16_t)0x0010) |
mbed_official | 52:a51c77007319 | 327 | #define USART_FLAG_ORE ((uint16_t)0x0008) |
mbed_official | 52:a51c77007319 | 328 | #define USART_FLAG_NE ((uint16_t)0x0004) |
mbed_official | 52:a51c77007319 | 329 | #define USART_FLAG_FE ((uint16_t)0x0002) |
mbed_official | 52:a51c77007319 | 330 | #define USART_FLAG_PE ((uint16_t)0x0001) |
mbed_official | 52:a51c77007319 | 331 | #define IS_USART_FLAG(FLAG) (((FLAG) == USART_FLAG_PE) || ((FLAG) == USART_FLAG_TXE) || \ |
mbed_official | 52:a51c77007319 | 332 | ((FLAG) == USART_FLAG_TC) || ((FLAG) == USART_FLAG_RXNE) || \ |
mbed_official | 52:a51c77007319 | 333 | ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_LBD) || \ |
mbed_official | 52:a51c77007319 | 334 | ((FLAG) == USART_FLAG_CTS) || ((FLAG) == USART_FLAG_ORE) || \ |
mbed_official | 52:a51c77007319 | 335 | ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE)) |
mbed_official | 52:a51c77007319 | 336 | |
mbed_official | 52:a51c77007319 | 337 | #define IS_USART_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFC9F) == 0x00) && ((FLAG) != (uint16_t)0x00)) |
mbed_official | 52:a51c77007319 | 338 | #define IS_USART_PERIPH_FLAG(PERIPH, USART_FLAG) ((((*(uint32_t*)&(PERIPH)) != UART4_BASE) &&\ |
mbed_official | 52:a51c77007319 | 339 | ((*(uint32_t*)&(PERIPH)) != UART5_BASE)) \ |
mbed_official | 52:a51c77007319 | 340 | || ((USART_FLAG) != USART_FLAG_CTS)) |
mbed_official | 52:a51c77007319 | 341 | #define IS_USART_BAUDRATE(BAUDRATE) (((BAUDRATE) > 0) && ((BAUDRATE) < 0x0044AA21)) |
mbed_official | 52:a51c77007319 | 342 | #define IS_USART_ADDRESS(ADDRESS) ((ADDRESS) <= 0xF) |
mbed_official | 52:a51c77007319 | 343 | #define IS_USART_DATA(DATA) ((DATA) <= 0x1FF) |
mbed_official | 52:a51c77007319 | 344 | |
mbed_official | 52:a51c77007319 | 345 | /** |
mbed_official | 52:a51c77007319 | 346 | * @} |
mbed_official | 52:a51c77007319 | 347 | */ |
mbed_official | 52:a51c77007319 | 348 | |
mbed_official | 52:a51c77007319 | 349 | /** |
mbed_official | 52:a51c77007319 | 350 | * @} |
mbed_official | 52:a51c77007319 | 351 | */ |
mbed_official | 52:a51c77007319 | 352 | |
mbed_official | 52:a51c77007319 | 353 | /** @defgroup USART_Exported_Macros |
mbed_official | 52:a51c77007319 | 354 | * @{ |
mbed_official | 52:a51c77007319 | 355 | */ |
mbed_official | 52:a51c77007319 | 356 | |
mbed_official | 52:a51c77007319 | 357 | /** |
mbed_official | 52:a51c77007319 | 358 | * @} |
mbed_official | 52:a51c77007319 | 359 | */ |
mbed_official | 52:a51c77007319 | 360 | |
mbed_official | 52:a51c77007319 | 361 | /** @defgroup USART_Exported_Functions |
mbed_official | 52:a51c77007319 | 362 | * @{ |
mbed_official | 52:a51c77007319 | 363 | */ |
mbed_official | 52:a51c77007319 | 364 | |
mbed_official | 52:a51c77007319 | 365 | void USART_DeInit(USART_TypeDef* USARTx); |
mbed_official | 52:a51c77007319 | 366 | void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct); |
mbed_official | 52:a51c77007319 | 367 | void USART_StructInit(USART_InitTypeDef* USART_InitStruct); |
mbed_official | 52:a51c77007319 | 368 | void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct); |
mbed_official | 52:a51c77007319 | 369 | void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct); |
mbed_official | 52:a51c77007319 | 370 | void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 371 | void USART_ITConfig(USART_TypeDef* USARTx, uint16_t USART_IT, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 372 | void USART_DMACmd(USART_TypeDef* USARTx, uint16_t USART_DMAReq, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 373 | void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address); |
mbed_official | 52:a51c77007319 | 374 | void USART_WakeUpConfig(USART_TypeDef* USARTx, uint16_t USART_WakeUp); |
mbed_official | 52:a51c77007319 | 375 | void USART_ReceiverWakeUpCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 376 | void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, uint16_t USART_LINBreakDetectLength); |
mbed_official | 52:a51c77007319 | 377 | void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 378 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data); |
mbed_official | 52:a51c77007319 | 379 | uint16_t USART_ReceiveData(USART_TypeDef* USARTx); |
mbed_official | 52:a51c77007319 | 380 | void USART_SendBreak(USART_TypeDef* USARTx); |
mbed_official | 52:a51c77007319 | 381 | void USART_SetGuardTime(USART_TypeDef* USARTx, uint8_t USART_GuardTime); |
mbed_official | 52:a51c77007319 | 382 | void USART_SetPrescaler(USART_TypeDef* USARTx, uint8_t USART_Prescaler); |
mbed_official | 52:a51c77007319 | 383 | void USART_SmartCardCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 384 | void USART_SmartCardNACKCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 385 | void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 386 | void USART_OverSampling8Cmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 387 | void USART_OneBitMethodCmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 388 | void USART_IrDAConfig(USART_TypeDef* USARTx, uint16_t USART_IrDAMode); |
mbed_official | 52:a51c77007319 | 389 | void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 390 | FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint16_t USART_FLAG); |
mbed_official | 52:a51c77007319 | 391 | void USART_ClearFlag(USART_TypeDef* USARTx, uint16_t USART_FLAG); |
mbed_official | 52:a51c77007319 | 392 | ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT); |
mbed_official | 52:a51c77007319 | 393 | void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT); |
mbed_official | 52:a51c77007319 | 394 | |
mbed_official | 52:a51c77007319 | 395 | #ifdef __cplusplus |
mbed_official | 52:a51c77007319 | 396 | } |
mbed_official | 52:a51c77007319 | 397 | #endif |
mbed_official | 52:a51c77007319 | 398 | |
mbed_official | 52:a51c77007319 | 399 | #endif /* __STM32F10x_USART_H */ |
mbed_official | 52:a51c77007319 | 400 | /** |
mbed_official | 52:a51c77007319 | 401 | * @} |
mbed_official | 52:a51c77007319 | 402 | */ |
mbed_official | 52:a51c77007319 | 403 | |
mbed_official | 52:a51c77007319 | 404 | /** |
mbed_official | 52:a51c77007319 | 405 | * @} |
mbed_official | 52:a51c77007319 | 406 | */ |
mbed_official | 52:a51c77007319 | 407 | |
mbed_official | 52:a51c77007319 | 408 | /** |
mbed_official | 52:a51c77007319 | 409 | * @} |
mbed_official | 52:a51c77007319 | 410 | */ |
mbed_official | 52:a51c77007319 | 411 | |
mbed_official | 52:a51c77007319 | 412 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |