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