mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F334R8/stm32f3xx_hal_usart.h@237:f3da66175598, 2014-06-24 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Jun 24 14:45:08 2014 +0100
- Revision:
- 237:f3da66175598
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7
Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/
[NUCLEO_F334R8] Add platform files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 237:f3da66175598 | 1 | /** |
mbed_official | 237:f3da66175598 | 2 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 3 | * @file stm32f3xx_hal_usart.h |
mbed_official | 237:f3da66175598 | 4 | * @author MCD Application Team |
mbed_official | 237:f3da66175598 | 5 | * @version V1.0.1 |
mbed_official | 237:f3da66175598 | 6 | * @date 18-June-2014 |
mbed_official | 237:f3da66175598 | 7 | * @brief Header file of USART HAL module. |
mbed_official | 237:f3da66175598 | 8 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 9 | * @attention |
mbed_official | 237:f3da66175598 | 10 | * |
mbed_official | 237:f3da66175598 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 237:f3da66175598 | 12 | * |
mbed_official | 237:f3da66175598 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 237:f3da66175598 | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 237:f3da66175598 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 237:f3da66175598 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 237:f3da66175598 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 237:f3da66175598 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 237:f3da66175598 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 237:f3da66175598 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 237:f3da66175598 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 237:f3da66175598 | 22 | * without specific prior written permission. |
mbed_official | 237:f3da66175598 | 23 | * |
mbed_official | 237:f3da66175598 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 237:f3da66175598 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 237:f3da66175598 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 237:f3da66175598 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 237:f3da66175598 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 237:f3da66175598 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 237:f3da66175598 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 237:f3da66175598 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 237:f3da66175598 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 237:f3da66175598 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 237:f3da66175598 | 34 | * |
mbed_official | 237:f3da66175598 | 35 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 36 | */ |
mbed_official | 237:f3da66175598 | 37 | |
mbed_official | 237:f3da66175598 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 237:f3da66175598 | 39 | #ifndef __STM32F3xx_HAL_USART_H |
mbed_official | 237:f3da66175598 | 40 | #define __STM32F3xx_HAL_USART_H |
mbed_official | 237:f3da66175598 | 41 | |
mbed_official | 237:f3da66175598 | 42 | #ifdef __cplusplus |
mbed_official | 237:f3da66175598 | 43 | extern "C" { |
mbed_official | 237:f3da66175598 | 44 | #endif |
mbed_official | 237:f3da66175598 | 45 | |
mbed_official | 237:f3da66175598 | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 47 | #include "stm32f3xx_hal_def.h" |
mbed_official | 237:f3da66175598 | 48 | |
mbed_official | 237:f3da66175598 | 49 | /** @addtogroup STM32F3xx_HAL_Driver |
mbed_official | 237:f3da66175598 | 50 | * @{ |
mbed_official | 237:f3da66175598 | 51 | */ |
mbed_official | 237:f3da66175598 | 52 | |
mbed_official | 237:f3da66175598 | 53 | /** @addtogroup USART |
mbed_official | 237:f3da66175598 | 54 | * @{ |
mbed_official | 237:f3da66175598 | 55 | */ |
mbed_official | 237:f3da66175598 | 56 | |
mbed_official | 237:f3da66175598 | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 58 | |
mbed_official | 237:f3da66175598 | 59 | /** |
mbed_official | 237:f3da66175598 | 60 | * @brief USART Init Structure definition |
mbed_official | 237:f3da66175598 | 61 | */ |
mbed_official | 237:f3da66175598 | 62 | typedef struct |
mbed_official | 237:f3da66175598 | 63 | { |
mbed_official | 237:f3da66175598 | 64 | uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. |
mbed_official | 237:f3da66175598 | 65 | The baud rate is computed using the following formula: |
mbed_official | 237:f3da66175598 | 66 | Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate))) */ |
mbed_official | 237:f3da66175598 | 67 | |
mbed_official | 237:f3da66175598 | 68 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
mbed_official | 237:f3da66175598 | 69 | This parameter can be a value of @ref USARTEx_Word_Length */ |
mbed_official | 237:f3da66175598 | 70 | |
mbed_official | 237:f3da66175598 | 71 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
mbed_official | 237:f3da66175598 | 72 | This parameter can be a value of @ref USART_Stop_Bits */ |
mbed_official | 237:f3da66175598 | 73 | |
mbed_official | 237:f3da66175598 | 74 | uint32_t Parity; /*!< Specifies the parity mode. |
mbed_official | 237:f3da66175598 | 75 | This parameter can be a value of @ref USART_Parity |
mbed_official | 237:f3da66175598 | 76 | @note When parity is enabled, the computed parity is inserted |
mbed_official | 237:f3da66175598 | 77 | at the MSB position of the transmitted data (9th bit when |
mbed_official | 237:f3da66175598 | 78 | the word length is set to 9 data bits; 8th bit when the |
mbed_official | 237:f3da66175598 | 79 | word length is set to 8 data bits). */ |
mbed_official | 237:f3da66175598 | 80 | |
mbed_official | 237:f3da66175598 | 81 | uint32_t Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled. |
mbed_official | 237:f3da66175598 | 82 | This parameter can be a value of @ref USART_Mode */ |
mbed_official | 237:f3da66175598 | 83 | |
mbed_official | 237:f3da66175598 | 84 | uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
mbed_official | 237:f3da66175598 | 85 | This parameter can be a value of @ref USART_Clock_Polarity */ |
mbed_official | 237:f3da66175598 | 86 | |
mbed_official | 237:f3da66175598 | 87 | uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
mbed_official | 237:f3da66175598 | 88 | This parameter can be a value of @ref USART_Clock_Phase */ |
mbed_official | 237:f3da66175598 | 89 | |
mbed_official | 237:f3da66175598 | 90 | uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
mbed_official | 237:f3da66175598 | 91 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
mbed_official | 237:f3da66175598 | 92 | This parameter can be a value of @ref USART_Last_Bit */ |
mbed_official | 237:f3da66175598 | 93 | }USART_InitTypeDef; |
mbed_official | 237:f3da66175598 | 94 | |
mbed_official | 237:f3da66175598 | 95 | /** |
mbed_official | 237:f3da66175598 | 96 | * @brief HAL State structures definition |
mbed_official | 237:f3da66175598 | 97 | */ |
mbed_official | 237:f3da66175598 | 98 | typedef enum |
mbed_official | 237:f3da66175598 | 99 | { |
mbed_official | 237:f3da66175598 | 100 | HAL_USART_STATE_RESET = 0x00, /*!< Peripheral is not initialized */ |
mbed_official | 237:f3da66175598 | 101 | HAL_USART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
mbed_official | 237:f3da66175598 | 102 | HAL_USART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
mbed_official | 237:f3da66175598 | 103 | HAL_USART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
mbed_official | 237:f3da66175598 | 104 | HAL_USART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
mbed_official | 237:f3da66175598 | 105 | HAL_USART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission Reception process is ongoing */ |
mbed_official | 237:f3da66175598 | 106 | HAL_USART_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
mbed_official | 237:f3da66175598 | 107 | HAL_USART_STATE_ERROR = 0x04 /*!< Error */ |
mbed_official | 237:f3da66175598 | 108 | }HAL_USART_StateTypeDef; |
mbed_official | 237:f3da66175598 | 109 | |
mbed_official | 237:f3da66175598 | 110 | /** |
mbed_official | 237:f3da66175598 | 111 | * @brief HAL USART Error Code structure definition |
mbed_official | 237:f3da66175598 | 112 | */ |
mbed_official | 237:f3da66175598 | 113 | typedef enum |
mbed_official | 237:f3da66175598 | 114 | { |
mbed_official | 237:f3da66175598 | 115 | HAL_USART_ERROR_NONE = 0x00, /*!< No error */ |
mbed_official | 237:f3da66175598 | 116 | HAL_USART_ERROR_PE = 0x01, /*!< Parity error */ |
mbed_official | 237:f3da66175598 | 117 | HAL_USART_ERROR_NE = 0x02, /*!< Noise error */ |
mbed_official | 237:f3da66175598 | 118 | HAL_USART_ERROR_FE = 0x04, /*!< frame error */ |
mbed_official | 237:f3da66175598 | 119 | HAL_USART_ERROR_ORE = 0x08, /*!< Overrun error */ |
mbed_official | 237:f3da66175598 | 120 | HAL_USART_ERROR_DMA = 0x10 /*!< DMA transfer error */ |
mbed_official | 237:f3da66175598 | 121 | }HAL_USART_ErrorTypeDef; |
mbed_official | 237:f3da66175598 | 122 | |
mbed_official | 237:f3da66175598 | 123 | /** |
mbed_official | 237:f3da66175598 | 124 | * @brief USART clock sources definitions |
mbed_official | 237:f3da66175598 | 125 | */ |
mbed_official | 237:f3da66175598 | 126 | typedef enum |
mbed_official | 237:f3da66175598 | 127 | { |
mbed_official | 237:f3da66175598 | 128 | USART_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
mbed_official | 237:f3da66175598 | 129 | USART_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */ |
mbed_official | 237:f3da66175598 | 130 | USART_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
mbed_official | 237:f3da66175598 | 131 | USART_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
mbed_official | 237:f3da66175598 | 132 | USART_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */ |
mbed_official | 237:f3da66175598 | 133 | USART_CLOCKSOURCE_UNDEFINED = 0x10 /*!< Undefined clock source */ |
mbed_official | 237:f3da66175598 | 134 | }USART_ClockSourceTypeDef; |
mbed_official | 237:f3da66175598 | 135 | |
mbed_official | 237:f3da66175598 | 136 | |
mbed_official | 237:f3da66175598 | 137 | /** |
mbed_official | 237:f3da66175598 | 138 | * @brief USART handle Structure definition |
mbed_official | 237:f3da66175598 | 139 | */ |
mbed_official | 237:f3da66175598 | 140 | typedef struct |
mbed_official | 237:f3da66175598 | 141 | { |
mbed_official | 237:f3da66175598 | 142 | USART_TypeDef *Instance; /*!< USART registers base address */ |
mbed_official | 237:f3da66175598 | 143 | |
mbed_official | 237:f3da66175598 | 144 | USART_InitTypeDef Init; /*!< USART communication parameters */ |
mbed_official | 237:f3da66175598 | 145 | |
mbed_official | 237:f3da66175598 | 146 | uint8_t *pTxBuffPtr; /*!< Pointer to USART Tx transfer Buffer */ |
mbed_official | 237:f3da66175598 | 147 | |
mbed_official | 237:f3da66175598 | 148 | uint16_t TxXferSize; /*!< USART Tx Transfer size */ |
mbed_official | 237:f3da66175598 | 149 | |
mbed_official | 237:f3da66175598 | 150 | uint16_t TxXferCount; /*!< USART Tx Transfer Counter */ |
mbed_official | 237:f3da66175598 | 151 | |
mbed_official | 237:f3da66175598 | 152 | uint8_t *pRxBuffPtr; /*!< Pointer to USART Rx transfer Buffer */ |
mbed_official | 237:f3da66175598 | 153 | |
mbed_official | 237:f3da66175598 | 154 | uint16_t RxXferSize; /*!< USART Rx Transfer size */ |
mbed_official | 237:f3da66175598 | 155 | |
mbed_official | 237:f3da66175598 | 156 | uint16_t RxXferCount; /*!< USART Rx Transfer Counter */ |
mbed_official | 237:f3da66175598 | 157 | |
mbed_official | 237:f3da66175598 | 158 | uint16_t Mask; /*!< USART Rx RDR register mask */ |
mbed_official | 237:f3da66175598 | 159 | |
mbed_official | 237:f3da66175598 | 160 | DMA_HandleTypeDef *hdmatx; /*!< USART Tx DMA Handle parameters */ |
mbed_official | 237:f3da66175598 | 161 | |
mbed_official | 237:f3da66175598 | 162 | DMA_HandleTypeDef *hdmarx; /*!< USART Rx DMA Handle parameters */ |
mbed_official | 237:f3da66175598 | 163 | |
mbed_official | 237:f3da66175598 | 164 | HAL_LockTypeDef Lock; /*!< Locking object */ |
mbed_official | 237:f3da66175598 | 165 | |
mbed_official | 237:f3da66175598 | 166 | HAL_USART_StateTypeDef State; /*!< USART communication state */ |
mbed_official | 237:f3da66175598 | 167 | |
mbed_official | 237:f3da66175598 | 168 | HAL_USART_ErrorTypeDef ErrorCode; /*!< USART Error code */ |
mbed_official | 237:f3da66175598 | 169 | |
mbed_official | 237:f3da66175598 | 170 | }USART_HandleTypeDef; |
mbed_official | 237:f3da66175598 | 171 | |
mbed_official | 237:f3da66175598 | 172 | |
mbed_official | 237:f3da66175598 | 173 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 174 | |
mbed_official | 237:f3da66175598 | 175 | /** @defgroup USART_Exported_Constants |
mbed_official | 237:f3da66175598 | 176 | * @{ |
mbed_official | 237:f3da66175598 | 177 | */ |
mbed_official | 237:f3da66175598 | 178 | |
mbed_official | 237:f3da66175598 | 179 | /** @defgroup USART_Stop_Bits USART Number of Stop Bits |
mbed_official | 237:f3da66175598 | 180 | * @{ |
mbed_official | 237:f3da66175598 | 181 | */ |
mbed_official | 237:f3da66175598 | 182 | #define USART_STOPBITS_1 ((uint32_t)0x0000) |
mbed_official | 237:f3da66175598 | 183 | #define USART_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) |
mbed_official | 237:f3da66175598 | 184 | #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) |
mbed_official | 237:f3da66175598 | 185 | #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) |
mbed_official | 237:f3da66175598 | 186 | #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \ |
mbed_official | 237:f3da66175598 | 187 | ((STOPBITS) == USART_STOPBITS_0_5) || \ |
mbed_official | 237:f3da66175598 | 188 | ((STOPBITS) == USART_STOPBITS_1_5) || \ |
mbed_official | 237:f3da66175598 | 189 | ((STOPBITS) == USART_STOPBITS_2)) |
mbed_official | 237:f3da66175598 | 190 | /** |
mbed_official | 237:f3da66175598 | 191 | * @} |
mbed_official | 237:f3da66175598 | 192 | */ |
mbed_official | 237:f3da66175598 | 193 | |
mbed_official | 237:f3da66175598 | 194 | /** @defgroup USART_Parity USART Parity |
mbed_official | 237:f3da66175598 | 195 | * @{ |
mbed_official | 237:f3da66175598 | 196 | */ |
mbed_official | 237:f3da66175598 | 197 | #define USART_PARITY_NONE ((uint32_t)0x0000) |
mbed_official | 237:f3da66175598 | 198 | #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) |
mbed_official | 237:f3da66175598 | 199 | #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) |
mbed_official | 237:f3da66175598 | 200 | #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \ |
mbed_official | 237:f3da66175598 | 201 | ((PARITY) == USART_PARITY_EVEN) || \ |
mbed_official | 237:f3da66175598 | 202 | ((PARITY) == USART_PARITY_ODD)) |
mbed_official | 237:f3da66175598 | 203 | /** |
mbed_official | 237:f3da66175598 | 204 | * @} |
mbed_official | 237:f3da66175598 | 205 | */ |
mbed_official | 237:f3da66175598 | 206 | |
mbed_official | 237:f3da66175598 | 207 | /** @defgroup USART_Mode USART Mode |
mbed_official | 237:f3da66175598 | 208 | * @{ |
mbed_official | 237:f3da66175598 | 209 | */ |
mbed_official | 237:f3da66175598 | 210 | #define USART_MODE_RX ((uint32_t)USART_CR1_RE) |
mbed_official | 237:f3da66175598 | 211 | #define USART_MODE_TX ((uint32_t)USART_CR1_TE) |
mbed_official | 237:f3da66175598 | 212 | #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) |
mbed_official | 237:f3da66175598 | 213 | #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFFFFFF3) == 0x00) && ((MODE) != (uint32_t)0x00)) |
mbed_official | 237:f3da66175598 | 214 | /** |
mbed_official | 237:f3da66175598 | 215 | * @} |
mbed_official | 237:f3da66175598 | 216 | */ |
mbed_official | 237:f3da66175598 | 217 | |
mbed_official | 237:f3da66175598 | 218 | /** @defgroup USART_Clock USART Clock |
mbed_official | 237:f3da66175598 | 219 | * @{ |
mbed_official | 237:f3da66175598 | 220 | */ |
mbed_official | 237:f3da66175598 | 221 | #define USART_CLOCK_DISABLED ((uint32_t)0x0000) |
mbed_official | 237:f3da66175598 | 222 | #define USART_CLOCK_ENABLED ((uint32_t)USART_CR2_CLKEN) |
mbed_official | 237:f3da66175598 | 223 | #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLED) || \ |
mbed_official | 237:f3da66175598 | 224 | ((CLOCK) == USART_CLOCK_ENABLED)) |
mbed_official | 237:f3da66175598 | 225 | /** |
mbed_official | 237:f3da66175598 | 226 | * @} |
mbed_official | 237:f3da66175598 | 227 | */ |
mbed_official | 237:f3da66175598 | 228 | |
mbed_official | 237:f3da66175598 | 229 | /** @defgroup USART_Clock_Polarity USART Clock Polarity |
mbed_official | 237:f3da66175598 | 230 | * @{ |
mbed_official | 237:f3da66175598 | 231 | */ |
mbed_official | 237:f3da66175598 | 232 | #define USART_POLARITY_LOW ((uint32_t)0x0000) |
mbed_official | 237:f3da66175598 | 233 | #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) |
mbed_official | 237:f3da66175598 | 234 | #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || ((CPOL) == USART_POLARITY_HIGH)) |
mbed_official | 237:f3da66175598 | 235 | /** |
mbed_official | 237:f3da66175598 | 236 | * @} |
mbed_official | 237:f3da66175598 | 237 | */ |
mbed_official | 237:f3da66175598 | 238 | |
mbed_official | 237:f3da66175598 | 239 | /** @defgroup USART_Clock_Phase USART Clock Phase |
mbed_official | 237:f3da66175598 | 240 | * @{ |
mbed_official | 237:f3da66175598 | 241 | */ |
mbed_official | 237:f3da66175598 | 242 | #define USART_PHASE_1EDGE ((uint32_t)0x0000) |
mbed_official | 237:f3da66175598 | 243 | #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) |
mbed_official | 237:f3da66175598 | 244 | #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || ((CPHA) == USART_PHASE_2EDGE)) |
mbed_official | 237:f3da66175598 | 245 | /** |
mbed_official | 237:f3da66175598 | 246 | * @} |
mbed_official | 237:f3da66175598 | 247 | */ |
mbed_official | 237:f3da66175598 | 248 | |
mbed_official | 237:f3da66175598 | 249 | /** @defgroup USART_Last_Bit USART Last Bit |
mbed_official | 237:f3da66175598 | 250 | * @{ |
mbed_official | 237:f3da66175598 | 251 | */ |
mbed_official | 237:f3da66175598 | 252 | #define USART_LASTBIT_DISABLE ((uint32_t)0x0000) |
mbed_official | 237:f3da66175598 | 253 | #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) |
mbed_official | 237:f3da66175598 | 254 | #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \ |
mbed_official | 237:f3da66175598 | 255 | ((LASTBIT) == USART_LASTBIT_ENABLE)) |
mbed_official | 237:f3da66175598 | 256 | /** |
mbed_official | 237:f3da66175598 | 257 | * @} |
mbed_official | 237:f3da66175598 | 258 | */ |
mbed_official | 237:f3da66175598 | 259 | |
mbed_official | 237:f3da66175598 | 260 | |
mbed_official | 237:f3da66175598 | 261 | /** @defgroup USART_Flags USART Flags |
mbed_official | 237:f3da66175598 | 262 | * Elements values convention: 0xXXXX |
mbed_official | 237:f3da66175598 | 263 | * - 0xXXXX : Flag mask in the ISR register |
mbed_official | 237:f3da66175598 | 264 | * @{ |
mbed_official | 237:f3da66175598 | 265 | */ |
mbed_official | 237:f3da66175598 | 266 | #define USART_FLAG_REACK ((uint32_t)0x00400000) |
mbed_official | 237:f3da66175598 | 267 | #define USART_FLAG_TEACK ((uint32_t)0x00200000) |
mbed_official | 237:f3da66175598 | 268 | #define USART_FLAG_BUSY ((uint32_t)0x00010000) |
mbed_official | 237:f3da66175598 | 269 | #define USART_FLAG_CTS ((uint32_t)0x00000400) |
mbed_official | 237:f3da66175598 | 270 | #define USART_FLAG_CTSIF ((uint32_t)0x00000200) |
mbed_official | 237:f3da66175598 | 271 | #define USART_FLAG_LBDF ((uint32_t)0x00000100) |
mbed_official | 237:f3da66175598 | 272 | #define USART_FLAG_TXE ((uint32_t)0x00000080) |
mbed_official | 237:f3da66175598 | 273 | #define USART_FLAG_TC ((uint32_t)0x00000040) |
mbed_official | 237:f3da66175598 | 274 | #define USART_FLAG_RXNE ((uint32_t)0x00000020) |
mbed_official | 237:f3da66175598 | 275 | #define USART_FLAG_IDLE ((uint32_t)0x00000010) |
mbed_official | 237:f3da66175598 | 276 | #define USART_FLAG_ORE ((uint32_t)0x00000008) |
mbed_official | 237:f3da66175598 | 277 | #define USART_FLAG_NE ((uint32_t)0x00000004) |
mbed_official | 237:f3da66175598 | 278 | #define USART_FLAG_FE ((uint32_t)0x00000002) |
mbed_official | 237:f3da66175598 | 279 | #define USART_FLAG_PE ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 280 | /** |
mbed_official | 237:f3da66175598 | 281 | * @} |
mbed_official | 237:f3da66175598 | 282 | */ |
mbed_official | 237:f3da66175598 | 283 | |
mbed_official | 237:f3da66175598 | 284 | /** @defgroup USART_Interrupt_definition USART Interrupts Definition |
mbed_official | 237:f3da66175598 | 285 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
mbed_official | 237:f3da66175598 | 286 | * - YYYYY : Interrupt source position in the XX register (5bits) |
mbed_official | 237:f3da66175598 | 287 | * - XX : Interrupt source register (2bits) |
mbed_official | 237:f3da66175598 | 288 | * - 01: CR1 register |
mbed_official | 237:f3da66175598 | 289 | * - 10: CR2 register |
mbed_official | 237:f3da66175598 | 290 | * - 11: CR3 register |
mbed_official | 237:f3da66175598 | 291 | * - ZZZZ : Flag position in the ISR register(4bits) |
mbed_official | 237:f3da66175598 | 292 | * @{ |
mbed_official | 237:f3da66175598 | 293 | */ |
mbed_official | 237:f3da66175598 | 294 | |
mbed_official | 237:f3da66175598 | 295 | #define USART_IT_PE ((uint16_t)0x0028) |
mbed_official | 237:f3da66175598 | 296 | #define USART_IT_TXE ((uint16_t)0x0727) |
mbed_official | 237:f3da66175598 | 297 | #define USART_IT_TC ((uint16_t)0x0626) |
mbed_official | 237:f3da66175598 | 298 | #define USART_IT_RXNE ((uint16_t)0x0525) |
mbed_official | 237:f3da66175598 | 299 | #define USART_IT_IDLE ((uint16_t)0x0424) |
mbed_official | 237:f3da66175598 | 300 | #define USART_IT_ERR ((uint16_t)0x0060) |
mbed_official | 237:f3da66175598 | 301 | |
mbed_official | 237:f3da66175598 | 302 | #define USART_IT_ORE ((uint16_t)0x0300) |
mbed_official | 237:f3da66175598 | 303 | #define USART_IT_NE ((uint16_t)0x0200) |
mbed_official | 237:f3da66175598 | 304 | #define USART_IT_FE ((uint16_t)0x0100) |
mbed_official | 237:f3da66175598 | 305 | /** |
mbed_official | 237:f3da66175598 | 306 | * @} |
mbed_official | 237:f3da66175598 | 307 | */ |
mbed_official | 237:f3da66175598 | 308 | |
mbed_official | 237:f3da66175598 | 309 | /** @defgroup USART_IT_CLEAR_Flags USART Interruption Clear Flags |
mbed_official | 237:f3da66175598 | 310 | * @{ |
mbed_official | 237:f3da66175598 | 311 | */ |
mbed_official | 237:f3da66175598 | 312 | #define USART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
mbed_official | 237:f3da66175598 | 313 | #define USART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
mbed_official | 237:f3da66175598 | 314 | #define USART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
mbed_official | 237:f3da66175598 | 315 | #define USART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
mbed_official | 237:f3da66175598 | 316 | #define USART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
mbed_official | 237:f3da66175598 | 317 | #define USART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
mbed_official | 237:f3da66175598 | 318 | #define USART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
mbed_official | 237:f3da66175598 | 319 | /** |
mbed_official | 237:f3da66175598 | 320 | * @} |
mbed_official | 237:f3da66175598 | 321 | */ |
mbed_official | 237:f3da66175598 | 322 | |
mbed_official | 237:f3da66175598 | 323 | /** @defgroup USART_Request_Parameters USART Request Parameters |
mbed_official | 237:f3da66175598 | 324 | * @{ |
mbed_official | 237:f3da66175598 | 325 | */ |
mbed_official | 237:f3da66175598 | 326 | #define USART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
mbed_official | 237:f3da66175598 | 327 | #define USART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
mbed_official | 237:f3da66175598 | 328 | #define IS_USART_REQUEST_PARAMETER(PARAM) (((PARAM) == USART_RXDATA_FLUSH_REQUEST) || \ |
mbed_official | 237:f3da66175598 | 329 | ((PARAM) == USART_TXDATA_FLUSH_REQUEST)) |
mbed_official | 237:f3da66175598 | 330 | /** |
mbed_official | 237:f3da66175598 | 331 | * @} |
mbed_official | 237:f3da66175598 | 332 | */ |
mbed_official | 237:f3da66175598 | 333 | |
mbed_official | 237:f3da66175598 | 334 | /** @defgroup USART_Interruption_Mask USART interruptions flag mask |
mbed_official | 237:f3da66175598 | 335 | * @{ |
mbed_official | 237:f3da66175598 | 336 | */ |
mbed_official | 237:f3da66175598 | 337 | #define USART_IT_MASK ((uint16_t)0x001F) |
mbed_official | 237:f3da66175598 | 338 | /** |
mbed_official | 237:f3da66175598 | 339 | * @} |
mbed_official | 237:f3da66175598 | 340 | */ |
mbed_official | 237:f3da66175598 | 341 | |
mbed_official | 237:f3da66175598 | 342 | /** |
mbed_official | 237:f3da66175598 | 343 | * @} |
mbed_official | 237:f3da66175598 | 344 | */ |
mbed_official | 237:f3da66175598 | 345 | |
mbed_official | 237:f3da66175598 | 346 | |
mbed_official | 237:f3da66175598 | 347 | /* Exported macros ------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 348 | |
mbed_official | 237:f3da66175598 | 349 | /** @defgroup USART_Exported_Macros |
mbed_official | 237:f3da66175598 | 350 | * @{ |
mbed_official | 237:f3da66175598 | 351 | */ |
mbed_official | 237:f3da66175598 | 352 | |
mbed_official | 237:f3da66175598 | 353 | /** @brief Reset USART handle state |
mbed_official | 237:f3da66175598 | 354 | * @param __HANDLE__: USART handle. |
mbed_official | 237:f3da66175598 | 355 | * @retval None |
mbed_official | 237:f3da66175598 | 356 | */ |
mbed_official | 237:f3da66175598 | 357 | #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET) |
mbed_official | 237:f3da66175598 | 358 | |
mbed_official | 237:f3da66175598 | 359 | |
mbed_official | 237:f3da66175598 | 360 | /** @brief Checks whether the specified USART flag is set or not. |
mbed_official | 237:f3da66175598 | 361 | * @param __HANDLE__: specifies the USART Handle |
mbed_official | 237:f3da66175598 | 362 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 237:f3da66175598 | 363 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 364 | * @arg USART_FLAG_REACK: Receive enable ackowledge flag |
mbed_official | 237:f3da66175598 | 365 | * @arg USART_FLAG_TEACK: Transmit enable ackowledge flag |
mbed_official | 237:f3da66175598 | 366 | * @arg USART_FLAG_BUSY: Busy flag |
mbed_official | 237:f3da66175598 | 367 | * @arg USART_FLAG_CTS: CTS Change flag |
mbed_official | 237:f3da66175598 | 368 | * @arg USART_FLAG_TXE: Transmit data register empty flag |
mbed_official | 237:f3da66175598 | 369 | * @arg USART_FLAG_TC: Transmission Complete flag |
mbed_official | 237:f3da66175598 | 370 | * @arg USART_FLAG_RXNE: Receive data register not empty flag |
mbed_official | 237:f3da66175598 | 371 | * @arg USART_FLAG_IDLE: Idle Line detection flag |
mbed_official | 237:f3da66175598 | 372 | * @arg USART_FLAG_ORE: OverRun Error flag |
mbed_official | 237:f3da66175598 | 373 | * @arg USART_FLAG_NE: Noise Error flag |
mbed_official | 237:f3da66175598 | 374 | * @arg USART_FLAG_FE: Framing Error flag |
mbed_official | 237:f3da66175598 | 375 | * @arg USART_FLAG_PE: Parity Error flag |
mbed_official | 237:f3da66175598 | 376 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 237:f3da66175598 | 377 | */ |
mbed_official | 237:f3da66175598 | 378 | #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
mbed_official | 237:f3da66175598 | 379 | |
mbed_official | 237:f3da66175598 | 380 | |
mbed_official | 237:f3da66175598 | 381 | /** @brief Enables the specified USART interrupt. |
mbed_official | 237:f3da66175598 | 382 | * @param __HANDLE__: specifies the USART Handle |
mbed_official | 237:f3da66175598 | 383 | * @param __INTERRUPT__: specifies the USART interrupt source to enable. |
mbed_official | 237:f3da66175598 | 384 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 385 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
mbed_official | 237:f3da66175598 | 386 | * @arg USART_IT_TC: Transmission complete interrupt |
mbed_official | 237:f3da66175598 | 387 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
mbed_official | 237:f3da66175598 | 388 | * @arg USART_IT_IDLE: Idle line detection interrupt |
mbed_official | 237:f3da66175598 | 389 | * @arg USART_IT_PE: Parity Error interrupt |
mbed_official | 237:f3da66175598 | 390 | * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
mbed_official | 237:f3da66175598 | 391 | * @retval None |
mbed_official | 237:f3da66175598 | 392 | */ |
mbed_official | 237:f3da66175598 | 393 | #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
mbed_official | 237:f3da66175598 | 394 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
mbed_official | 237:f3da66175598 | 395 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
mbed_official | 237:f3da66175598 | 396 | |
mbed_official | 237:f3da66175598 | 397 | /** @brief Disables the specified USART interrupt. |
mbed_official | 237:f3da66175598 | 398 | * @param __HANDLE__: specifies the USART Handle. |
mbed_official | 237:f3da66175598 | 399 | * @param __INTERRUPT__: specifies the USART interrupt source to disable. |
mbed_official | 237:f3da66175598 | 400 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 401 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
mbed_official | 237:f3da66175598 | 402 | * @arg USART_IT_TC: Transmission complete interrupt |
mbed_official | 237:f3da66175598 | 403 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
mbed_official | 237:f3da66175598 | 404 | * @arg USART_IT_IDLE: Idle line detection interrupt |
mbed_official | 237:f3da66175598 | 405 | * @arg USART_IT_PE: Parity Error interrupt |
mbed_official | 237:f3da66175598 | 406 | * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
mbed_official | 237:f3da66175598 | 407 | * @retval None |
mbed_official | 237:f3da66175598 | 408 | */ |
mbed_official | 237:f3da66175598 | 409 | #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
mbed_official | 237:f3da66175598 | 410 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
mbed_official | 237:f3da66175598 | 411 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
mbed_official | 237:f3da66175598 | 412 | |
mbed_official | 237:f3da66175598 | 413 | |
mbed_official | 237:f3da66175598 | 414 | /** @brief Checks whether the specified USART interrupt has occurred or not. |
mbed_official | 237:f3da66175598 | 415 | * @param __HANDLE__: specifies the USART Handle |
mbed_official | 237:f3da66175598 | 416 | * @param __IT__: specifies the USART interrupt source to check. |
mbed_official | 237:f3da66175598 | 417 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 418 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
mbed_official | 237:f3da66175598 | 419 | * @arg USART_IT_TC: Transmission complete interrupt |
mbed_official | 237:f3da66175598 | 420 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
mbed_official | 237:f3da66175598 | 421 | * @arg USART_IT_IDLE: Idle line detection interrupt |
mbed_official | 237:f3da66175598 | 422 | * @arg USART_IT_ORE: OverRun Error interrupt |
mbed_official | 237:f3da66175598 | 423 | * @arg USART_IT_NE: Noise Error interrupt |
mbed_official | 237:f3da66175598 | 424 | * @arg USART_IT_FE: Framing Error interrupt |
mbed_official | 237:f3da66175598 | 425 | * @arg USART_IT_PE: Parity Error interrupt |
mbed_official | 237:f3da66175598 | 426 | * @retval The new state of __IT__ (TRUE or FALSE). |
mbed_official | 237:f3da66175598 | 427 | */ |
mbed_official | 237:f3da66175598 | 428 | #define __HAL_USART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08))) |
mbed_official | 237:f3da66175598 | 429 | |
mbed_official | 237:f3da66175598 | 430 | /** @brief Checks whether the specified USART interrupt source is enabled. |
mbed_official | 237:f3da66175598 | 431 | * @param __HANDLE__: specifies the USART Handle. |
mbed_official | 237:f3da66175598 | 432 | * @param __IT__: specifies the USART interrupt source to check. |
mbed_official | 237:f3da66175598 | 433 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 434 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
mbed_official | 237:f3da66175598 | 435 | * @arg USART_IT_TC: Transmission complete interrupt |
mbed_official | 237:f3da66175598 | 436 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
mbed_official | 237:f3da66175598 | 437 | * @arg USART_IT_IDLE: Idle line detection interrupt |
mbed_official | 237:f3da66175598 | 438 | * @arg USART_IT_ORE: OverRun Error interrupt |
mbed_official | 237:f3da66175598 | 439 | * @arg USART_IT_NE: Noise Error interrupt |
mbed_official | 237:f3da66175598 | 440 | * @arg USART_IT_FE: Framing Error interrupt |
mbed_official | 237:f3da66175598 | 441 | * @arg USART_IT_PE: Parity Error interrupt |
mbed_official | 237:f3da66175598 | 442 | * @retval The new state of __IT__ (TRUE or FALSE). |
mbed_official | 237:f3da66175598 | 443 | */ |
mbed_official | 237:f3da66175598 | 444 | #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5) == 2)? \ |
mbed_official | 237:f3da66175598 | 445 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \ |
mbed_official | 237:f3da66175598 | 446 | (((uint16_t)(__IT__)) & USART_IT_MASK))) |
mbed_official | 237:f3da66175598 | 447 | |
mbed_official | 237:f3da66175598 | 448 | |
mbed_official | 237:f3da66175598 | 449 | /** @brief Clears the specified USART ISR flag, in setting the proper ICR register flag. |
mbed_official | 237:f3da66175598 | 450 | * @param __HANDLE__: specifies the USART Handle. |
mbed_official | 237:f3da66175598 | 451 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
mbed_official | 237:f3da66175598 | 452 | * to clear the corresponding interrupt |
mbed_official | 237:f3da66175598 | 453 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 454 | * @arg USART_CLEAR_PEF: Parity Error Clear Flag |
mbed_official | 237:f3da66175598 | 455 | * @arg USART_CLEAR_FEF: Framing Error Clear Flag |
mbed_official | 237:f3da66175598 | 456 | * @arg USART_CLEAR_NEF: Noise detected Clear Flag |
mbed_official | 237:f3da66175598 | 457 | * @arg USART_CLEAR_OREF: OverRun Error Clear Flag |
mbed_official | 237:f3da66175598 | 458 | * @arg USART_CLEAR_IDLEF: IDLE line detected Clear Flag |
mbed_official | 237:f3da66175598 | 459 | * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag |
mbed_official | 237:f3da66175598 | 460 | * @arg USART_CLEAR_CTSF: CTS Interrupt Clear Flag |
mbed_official | 237:f3da66175598 | 461 | * @retval None |
mbed_official | 237:f3da66175598 | 462 | */ |
mbed_official | 237:f3da66175598 | 463 | #define __HAL_USART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
mbed_official | 237:f3da66175598 | 464 | |
mbed_official | 237:f3da66175598 | 465 | /** @brief Set a specific USART request flag. |
mbed_official | 237:f3da66175598 | 466 | * @param __HANDLE__: specifies the USART Handle. |
mbed_official | 237:f3da66175598 | 467 | * @param __REQ__: specifies the request flag to set |
mbed_official | 237:f3da66175598 | 468 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 469 | * @arg USART_RXDATA_FLUSH_REQUEST: Receive Data flush Request |
mbed_official | 237:f3da66175598 | 470 | * @arg USART_TXDATA_FLUSH_REQUEST: Transmit data flush Request |
mbed_official | 237:f3da66175598 | 471 | * |
mbed_official | 237:f3da66175598 | 472 | * @retval None |
mbed_official | 237:f3da66175598 | 473 | */ |
mbed_official | 237:f3da66175598 | 474 | #define __HAL_USART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) |
mbed_official | 237:f3da66175598 | 475 | |
mbed_official | 237:f3da66175598 | 476 | /** @brief Enable USART |
mbed_official | 237:f3da66175598 | 477 | * @param __HANDLE__: specifies the USART Handle. |
mbed_official | 237:f3da66175598 | 478 | * @retval None |
mbed_official | 237:f3da66175598 | 479 | */ |
mbed_official | 237:f3da66175598 | 480 | #define __HAL_USART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
mbed_official | 237:f3da66175598 | 481 | |
mbed_official | 237:f3da66175598 | 482 | /** @brief Disable USART |
mbed_official | 237:f3da66175598 | 483 | * @param __HANDLE__: specifies the USART Handle. |
mbed_official | 237:f3da66175598 | 484 | * @retval None |
mbed_official | 237:f3da66175598 | 485 | */ |
mbed_official | 237:f3da66175598 | 486 | #define __HAL_USART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
mbed_official | 237:f3da66175598 | 487 | |
mbed_official | 237:f3da66175598 | 488 | |
mbed_official | 237:f3da66175598 | 489 | /** @brief Check USART Baud rate |
mbed_official | 237:f3da66175598 | 490 | * @param BAUDRATE: Baudrate specified by the user |
mbed_official | 237:f3da66175598 | 491 | * The maximum Baud Rate is derived from the maximum clock on F3 (i.e. 72 MHz) |
mbed_official | 237:f3da66175598 | 492 | * divided by the smallest oversampling used on the USART (i.e. 8) |
mbed_official | 237:f3da66175598 | 493 | * @retval Test result (TRUE or FALSE) |
mbed_official | 237:f3da66175598 | 494 | */ |
mbed_official | 237:f3da66175598 | 495 | #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 9000001) |
mbed_official | 237:f3da66175598 | 496 | |
mbed_official | 237:f3da66175598 | 497 | /** |
mbed_official | 237:f3da66175598 | 498 | * @} |
mbed_official | 237:f3da66175598 | 499 | */ |
mbed_official | 237:f3da66175598 | 500 | |
mbed_official | 237:f3da66175598 | 501 | /* Include USART HAL Extension module */ |
mbed_official | 237:f3da66175598 | 502 | #include "stm32f3xx_hal_usart_ex.h" |
mbed_official | 237:f3da66175598 | 503 | |
mbed_official | 237:f3da66175598 | 504 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 505 | |
mbed_official | 237:f3da66175598 | 506 | /* Initialization and de-initialization functions ****************************/ |
mbed_official | 237:f3da66175598 | 507 | HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 508 | HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 509 | void HAL_USART_MspInit(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 510 | void HAL_USART_MspDeInit(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 511 | HAL_StatusTypeDef HAL_USART_CheckIdleState(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 512 | /* IO operation functions *****************************************************/ |
mbed_official | 237:f3da66175598 | 513 | HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout); |
mbed_official | 237:f3da66175598 | 514 | HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
mbed_official | 237:f3da66175598 | 515 | HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
mbed_official | 237:f3da66175598 | 516 | HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); |
mbed_official | 237:f3da66175598 | 517 | HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
mbed_official | 237:f3da66175598 | 518 | HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); |
mbed_official | 237:f3da66175598 | 519 | HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); |
mbed_official | 237:f3da66175598 | 520 | HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
mbed_official | 237:f3da66175598 | 521 | HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); |
mbed_official | 237:f3da66175598 | 522 | HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 523 | HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 524 | HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 525 | void HAL_USART_IRQHandler(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 526 | void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 527 | void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 528 | void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 529 | void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 530 | void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 531 | void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 532 | |
mbed_official | 237:f3da66175598 | 533 | /* Peripheral Control functions ***********************************************/ |
mbed_official | 237:f3da66175598 | 534 | |
mbed_official | 237:f3da66175598 | 535 | /* Peripheral State and Error functions ***************************************/ |
mbed_official | 237:f3da66175598 | 536 | HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 537 | uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart); |
mbed_official | 237:f3da66175598 | 538 | |
mbed_official | 237:f3da66175598 | 539 | /** |
mbed_official | 237:f3da66175598 | 540 | * @} |
mbed_official | 237:f3da66175598 | 541 | */ |
mbed_official | 237:f3da66175598 | 542 | |
mbed_official | 237:f3da66175598 | 543 | /** |
mbed_official | 237:f3da66175598 | 544 | * @} |
mbed_official | 237:f3da66175598 | 545 | */ |
mbed_official | 237:f3da66175598 | 546 | |
mbed_official | 237:f3da66175598 | 547 | #ifdef __cplusplus |
mbed_official | 237:f3da66175598 | 548 | } |
mbed_official | 237:f3da66175598 | 549 | #endif |
mbed_official | 237:f3da66175598 | 550 | |
mbed_official | 237:f3da66175598 | 551 | #endif /* __STM32F3xx_HAL_USART_H */ |
mbed_official | 237:f3da66175598 | 552 | |
mbed_official | 237:f3da66175598 | 553 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |