mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Nov 03 10:30:07 2014 +0000
Revision:
381:5460fc57b6e4
Synchronized with git revision 02478cd1f27fc7b9643486472635eb515b2bca81

Full URL: https://github.com/mbedmicro/mbed/commit/02478cd1f27fc7b9643486472635eb515b2bca81/

Target: LPC1549 - Fix serial interrupt issues (issue report #616)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 381:5460fc57b6e4 1 /**
mbed_official 381:5460fc57b6e4 2 ******************************************************************************
mbed_official 381:5460fc57b6e4 3 * @file stm32f3xx_hal_uart.h
mbed_official 381:5460fc57b6e4 4 * @author MCD Application Team
mbed_official 381:5460fc57b6e4 5 * @version V1.1.0
mbed_official 381:5460fc57b6e4 6 * @date 12-Sept-2014
mbed_official 381:5460fc57b6e4 7 * @brief Header file of UART HAL module.
mbed_official 381:5460fc57b6e4 8 ******************************************************************************
mbed_official 381:5460fc57b6e4 9 * @attention
mbed_official 381:5460fc57b6e4 10 *
mbed_official 381:5460fc57b6e4 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 381:5460fc57b6e4 12 *
mbed_official 381:5460fc57b6e4 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 381:5460fc57b6e4 14 * are permitted provided that the following conditions are met:
mbed_official 381:5460fc57b6e4 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 381:5460fc57b6e4 16 * this list of conditions and the following disclaimer.
mbed_official 381:5460fc57b6e4 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 381:5460fc57b6e4 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 381:5460fc57b6e4 19 * and/or other materials provided with the distribution.
mbed_official 381:5460fc57b6e4 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 381:5460fc57b6e4 21 * may be used to endorse or promote products derived from this software
mbed_official 381:5460fc57b6e4 22 * without specific prior written permission.
mbed_official 381:5460fc57b6e4 23 *
mbed_official 381:5460fc57b6e4 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 381:5460fc57b6e4 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 381:5460fc57b6e4 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 381:5460fc57b6e4 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 381:5460fc57b6e4 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 381:5460fc57b6e4 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 381:5460fc57b6e4 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 381:5460fc57b6e4 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 381:5460fc57b6e4 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 381:5460fc57b6e4 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 381:5460fc57b6e4 34 *
mbed_official 381:5460fc57b6e4 35 ******************************************************************************
mbed_official 381:5460fc57b6e4 36 */
mbed_official 381:5460fc57b6e4 37
mbed_official 381:5460fc57b6e4 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 381:5460fc57b6e4 39 #ifndef __STM32F3xx_HAL_UART_H
mbed_official 381:5460fc57b6e4 40 #define __STM32F3xx_HAL_UART_H
mbed_official 381:5460fc57b6e4 41
mbed_official 381:5460fc57b6e4 42 #ifdef __cplusplus
mbed_official 381:5460fc57b6e4 43 extern "C" {
mbed_official 381:5460fc57b6e4 44 #endif
mbed_official 381:5460fc57b6e4 45
mbed_official 381:5460fc57b6e4 46 /* Includes ------------------------------------------------------------------*/
mbed_official 381:5460fc57b6e4 47 #include "stm32f3xx_hal_def.h"
mbed_official 381:5460fc57b6e4 48
mbed_official 381:5460fc57b6e4 49 /** @addtogroup STM32F3xx_HAL_Driver
mbed_official 381:5460fc57b6e4 50 * @{
mbed_official 381:5460fc57b6e4 51 */
mbed_official 381:5460fc57b6e4 52
mbed_official 381:5460fc57b6e4 53 /** @addtogroup UART
mbed_official 381:5460fc57b6e4 54 * @{
mbed_official 381:5460fc57b6e4 55 */
mbed_official 381:5460fc57b6e4 56
mbed_official 381:5460fc57b6e4 57 /* Exported types ------------------------------------------------------------*/
mbed_official 381:5460fc57b6e4 58 /** @defgroup UART_Exported_Types UART Exported Types
mbed_official 381:5460fc57b6e4 59 * @{
mbed_official 381:5460fc57b6e4 60 */
mbed_official 381:5460fc57b6e4 61
mbed_official 381:5460fc57b6e4 62 /**
mbed_official 381:5460fc57b6e4 63 * @brief UART Init Structure definition
mbed_official 381:5460fc57b6e4 64 */
mbed_official 381:5460fc57b6e4 65 typedef struct
mbed_official 381:5460fc57b6e4 66 {
mbed_official 381:5460fc57b6e4 67 uint32_t BaudRate; /*!< This member configures the UART communication baud rate.
mbed_official 381:5460fc57b6e4 68 The baud rate register is computed using the following formula:
mbed_official 381:5460fc57b6e4 69 - If oversampling is 16 or in LIN mode,
mbed_official 381:5460fc57b6e4 70 Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate)))
mbed_official 381:5460fc57b6e4 71 - If oversampling is 8,
mbed_official 381:5460fc57b6e4 72 Baud Rate Register[15:4] = ((2 * PCLKx) / ((huart->Init.BaudRate)))[15:4]
mbed_official 381:5460fc57b6e4 73 Baud Rate Register[3] = 0
mbed_official 381:5460fc57b6e4 74 Baud Rate Register[2:0] = (((2 * PCLKx) / ((huart->Init.BaudRate)))[3:0]) >> 1 */
mbed_official 381:5460fc57b6e4 75
mbed_official 381:5460fc57b6e4 76 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
mbed_official 381:5460fc57b6e4 77 This parameter can be a value of @ref UARTEx_Word_Length */
mbed_official 381:5460fc57b6e4 78
mbed_official 381:5460fc57b6e4 79 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
mbed_official 381:5460fc57b6e4 80 This parameter can be a value of @ref UART_Stop_Bits */
mbed_official 381:5460fc57b6e4 81
mbed_official 381:5460fc57b6e4 82 uint32_t Parity; /*!< Specifies the parity mode.
mbed_official 381:5460fc57b6e4 83 This parameter can be a value of @ref UART_Parity
mbed_official 381:5460fc57b6e4 84 @note When parity is enabled, the computed parity is inserted
mbed_official 381:5460fc57b6e4 85 at the MSB position of the transmitted data (9th bit when
mbed_official 381:5460fc57b6e4 86 the word length is set to 9 data bits; 8th bit when the
mbed_official 381:5460fc57b6e4 87 word length is set to 8 data bits). */
mbed_official 381:5460fc57b6e4 88
mbed_official 381:5460fc57b6e4 89 uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
mbed_official 381:5460fc57b6e4 90 This parameter can be a value of @ref UART_Mode */
mbed_official 381:5460fc57b6e4 91
mbed_official 381:5460fc57b6e4 92 uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled
mbed_official 381:5460fc57b6e4 93 or disabled.
mbed_official 381:5460fc57b6e4 94 This parameter can be a value of @ref UART_Hardware_Flow_Control */
mbed_official 381:5460fc57b6e4 95
mbed_official 381:5460fc57b6e4 96 uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to fPCLK/8).
mbed_official 381:5460fc57b6e4 97 This parameter can be a value of @ref UART_Over_Sampling */
mbed_official 381:5460fc57b6e4 98
mbed_official 381:5460fc57b6e4 99 uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected.
mbed_official 381:5460fc57b6e4 100 Selecting the single sample method increases the receiver tolerance to clock
mbed_official 381:5460fc57b6e4 101 deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */
mbed_official 381:5460fc57b6e4 102 }UART_InitTypeDef;
mbed_official 381:5460fc57b6e4 103
mbed_official 381:5460fc57b6e4 104 /**
mbed_official 381:5460fc57b6e4 105 * @brief UART Advanced Features initalization structure definition
mbed_official 381:5460fc57b6e4 106 */
mbed_official 381:5460fc57b6e4 107 typedef struct
mbed_official 381:5460fc57b6e4 108 {
mbed_official 381:5460fc57b6e4 109 uint32_t AdvFeatureInit; /*!< Specifies which advanced UART features is initialized. Several
mbed_official 381:5460fc57b6e4 110 Advanced Features may be initialized at the same time .
mbed_official 381:5460fc57b6e4 111 This parameter can be a value of @ref UART_Advanced_Features_Initialization_Type */
mbed_official 381:5460fc57b6e4 112
mbed_official 381:5460fc57b6e4 113 uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted.
mbed_official 381:5460fc57b6e4 114 This parameter can be a value of @ref UART_Tx_Inv */
mbed_official 381:5460fc57b6e4 115
mbed_official 381:5460fc57b6e4 116 uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted.
mbed_official 381:5460fc57b6e4 117 This parameter can be a value of @ref UART_Rx_Inv */
mbed_official 381:5460fc57b6e4 118
mbed_official 381:5460fc57b6e4 119 uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic
mbed_official 381:5460fc57b6e4 120 vs negative/inverted logic).
mbed_official 381:5460fc57b6e4 121 This parameter can be a value of @ref UART_Data_Inv */
mbed_official 381:5460fc57b6e4 122
mbed_official 381:5460fc57b6e4 123 uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped.
mbed_official 381:5460fc57b6e4 124 This parameter can be a value of @ref UART_Rx_Tx_Swap */
mbed_official 381:5460fc57b6e4 125
mbed_official 381:5460fc57b6e4 126 uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled.
mbed_official 381:5460fc57b6e4 127 This parameter can be a value of @ref UART_Overrun_Disable */
mbed_official 381:5460fc57b6e4 128
mbed_official 381:5460fc57b6e4 129 uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error.
mbed_official 381:5460fc57b6e4 130 This parameter can be a value of @ref UART_DMA_Disable_on_Rx_Error */
mbed_official 381:5460fc57b6e4 131
mbed_official 381:5460fc57b6e4 132 uint32_t AutoBaudRateEnable; /*!< Specifies whether auto Baud rate detection is enabled.
mbed_official 381:5460fc57b6e4 133 This parameter can be a value of @ref UART_AutoBaudRate_Enable */
mbed_official 381:5460fc57b6e4 134
mbed_official 381:5460fc57b6e4 135 uint32_t AutoBaudRateMode; /*!< If auto Baud rate detection is enabled, specifies how the rate
mbed_official 381:5460fc57b6e4 136 detection is carried out.
mbed_official 381:5460fc57b6e4 137 This parameter can be a value of @ref UART_AutoBaud_Rate_Mode */
mbed_official 381:5460fc57b6e4 138
mbed_official 381:5460fc57b6e4 139 uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line.
mbed_official 381:5460fc57b6e4 140 This parameter can be a value of @ref UART_MSB_First */
mbed_official 381:5460fc57b6e4 141 } UART_AdvFeatureInitTypeDef;
mbed_official 381:5460fc57b6e4 142
mbed_official 381:5460fc57b6e4 143 /**
mbed_official 381:5460fc57b6e4 144 * @brief UART wake up from stop mode parameters
mbed_official 381:5460fc57b6e4 145 */
mbed_official 381:5460fc57b6e4 146 typedef struct
mbed_official 381:5460fc57b6e4 147 {
mbed_official 381:5460fc57b6e4 148 uint32_t WakeUpEvent; /*!< Specifies which event will activat the Wakeup from Stop mode flag (WUF).
mbed_official 381:5460fc57b6e4 149 This parameter can be a value of @ref UART_WakeUp_from_Stop_Selection.
mbed_official 381:5460fc57b6e4 150 If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must
mbed_official 381:5460fc57b6e4 151 be filled up. */
mbed_official 381:5460fc57b6e4 152
mbed_official 381:5460fc57b6e4 153 uint16_t AddressLength; /*!< Specifies whether the address is 4 or 7-bit long.
mbed_official 381:5460fc57b6e4 154 This parameter can be a value of @ref UART_WakeUp_Address_Length */
mbed_official 381:5460fc57b6e4 155
mbed_official 381:5460fc57b6e4 156 uint8_t Address; /*!< UART/USART node address (7-bit long max) */
mbed_official 381:5460fc57b6e4 157 } UART_WakeUpTypeDef;
mbed_official 381:5460fc57b6e4 158
mbed_official 381:5460fc57b6e4 159 /**
mbed_official 381:5460fc57b6e4 160 * @brief HAL UART State structures definition
mbed_official 381:5460fc57b6e4 161 */
mbed_official 381:5460fc57b6e4 162 typedef enum
mbed_official 381:5460fc57b6e4 163 {
mbed_official 381:5460fc57b6e4 164 HAL_UART_STATE_RESET = 0x00, /*!< Peripheral is not initialized */
mbed_official 381:5460fc57b6e4 165 HAL_UART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
mbed_official 381:5460fc57b6e4 166 HAL_UART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
mbed_official 381:5460fc57b6e4 167 HAL_UART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
mbed_official 381:5460fc57b6e4 168 HAL_UART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
mbed_official 381:5460fc57b6e4 169 HAL_UART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
mbed_official 381:5460fc57b6e4 170 HAL_UART_STATE_TIMEOUT = 0x03, /*!< Timeout state */
mbed_official 381:5460fc57b6e4 171 HAL_UART_STATE_ERROR = 0x04 /*!< Error */
mbed_official 381:5460fc57b6e4 172 }HAL_UART_StateTypeDef;
mbed_official 381:5460fc57b6e4 173
mbed_official 381:5460fc57b6e4 174 /**
mbed_official 381:5460fc57b6e4 175 * @brief HAL UART Error Code structure definition
mbed_official 381:5460fc57b6e4 176 */
mbed_official 381:5460fc57b6e4 177 typedef enum
mbed_official 381:5460fc57b6e4 178 {
mbed_official 381:5460fc57b6e4 179 HAL_UART_ERROR_NONE = 0x00, /*!< No error */
mbed_official 381:5460fc57b6e4 180 HAL_UART_ERROR_PE = 0x01, /*!< Parity error */
mbed_official 381:5460fc57b6e4 181 HAL_UART_ERROR_NE = 0x02, /*!< Noise error */
mbed_official 381:5460fc57b6e4 182 HAL_UART_ERROR_FE = 0x04, /*!< frame error */
mbed_official 381:5460fc57b6e4 183 HAL_UART_ERROR_ORE = 0x08, /*!< Overrun error */
mbed_official 381:5460fc57b6e4 184 HAL_UART_ERROR_DMA = 0x10 /*!< DMA transfer error */
mbed_official 381:5460fc57b6e4 185 }HAL_UART_ErrorTypeDef;
mbed_official 381:5460fc57b6e4 186
mbed_official 381:5460fc57b6e4 187 /**
mbed_official 381:5460fc57b6e4 188 * @brief UART clock sources definition
mbed_official 381:5460fc57b6e4 189 */
mbed_official 381:5460fc57b6e4 190 typedef enum
mbed_official 381:5460fc57b6e4 191 {
mbed_official 381:5460fc57b6e4 192 UART_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */
mbed_official 381:5460fc57b6e4 193 UART_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */
mbed_official 381:5460fc57b6e4 194 UART_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */
mbed_official 381:5460fc57b6e4 195 UART_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */
mbed_official 381:5460fc57b6e4 196 UART_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */
mbed_official 381:5460fc57b6e4 197 UART_CLOCKSOURCE_UNDEFINED = 0x10 /*!< Undefined clock source */
mbed_official 381:5460fc57b6e4 198 }UART_ClockSourceTypeDef;
mbed_official 381:5460fc57b6e4 199
mbed_official 381:5460fc57b6e4 200 /**
mbed_official 381:5460fc57b6e4 201 * @brief UART handle Structure definition
mbed_official 381:5460fc57b6e4 202 */
mbed_official 381:5460fc57b6e4 203 typedef struct
mbed_official 381:5460fc57b6e4 204 {
mbed_official 381:5460fc57b6e4 205 USART_TypeDef *Instance; /* UART registers base address */
mbed_official 381:5460fc57b6e4 206
mbed_official 381:5460fc57b6e4 207 UART_InitTypeDef Init; /* UART communication parameters */
mbed_official 381:5460fc57b6e4 208
mbed_official 381:5460fc57b6e4 209 UART_AdvFeatureInitTypeDef AdvancedInit; /* UART Advanced Features initialization parameters */
mbed_official 381:5460fc57b6e4 210
mbed_official 381:5460fc57b6e4 211 uint8_t *pTxBuffPtr; /* Pointer to UART Tx transfer Buffer */
mbed_official 381:5460fc57b6e4 212
mbed_official 381:5460fc57b6e4 213 uint16_t TxXferSize; /* UART Tx Transfer size */
mbed_official 381:5460fc57b6e4 214
mbed_official 381:5460fc57b6e4 215 uint16_t TxXferCount; /* UART Tx Transfer Counter */
mbed_official 381:5460fc57b6e4 216
mbed_official 381:5460fc57b6e4 217 uint8_t *pRxBuffPtr; /* Pointer to UART Rx transfer Buffer */
mbed_official 381:5460fc57b6e4 218
mbed_official 381:5460fc57b6e4 219 uint16_t RxXferSize; /* UART Rx Transfer size */
mbed_official 381:5460fc57b6e4 220
mbed_official 381:5460fc57b6e4 221 uint16_t RxXferCount; /* UART Rx Transfer Counter */
mbed_official 381:5460fc57b6e4 222
mbed_official 381:5460fc57b6e4 223 uint16_t Mask; /* UART Rx RDR register mask */
mbed_official 381:5460fc57b6e4 224
mbed_official 381:5460fc57b6e4 225 DMA_HandleTypeDef *hdmatx; /* UART Tx DMA Handle parameters */
mbed_official 381:5460fc57b6e4 226
mbed_official 381:5460fc57b6e4 227 DMA_HandleTypeDef *hdmarx; /* UART Rx DMA Handle parameters */
mbed_official 381:5460fc57b6e4 228
mbed_official 381:5460fc57b6e4 229 HAL_LockTypeDef Lock; /* Locking object */
mbed_official 381:5460fc57b6e4 230
mbed_official 381:5460fc57b6e4 231 HAL_UART_StateTypeDef State; /* UART communication state */
mbed_official 381:5460fc57b6e4 232
mbed_official 381:5460fc57b6e4 233 HAL_UART_ErrorTypeDef ErrorCode; /* UART Error code */
mbed_official 381:5460fc57b6e4 234
mbed_official 381:5460fc57b6e4 235 }UART_HandleTypeDef;
mbed_official 381:5460fc57b6e4 236
mbed_official 381:5460fc57b6e4 237 /**
mbed_official 381:5460fc57b6e4 238 * @}
mbed_official 381:5460fc57b6e4 239 */
mbed_official 381:5460fc57b6e4 240
mbed_official 381:5460fc57b6e4 241 /* Exported constants --------------------------------------------------------*/
mbed_official 381:5460fc57b6e4 242 /** @defgroup UART_Exported_Constants UART Exported Constants
mbed_official 381:5460fc57b6e4 243 * @{
mbed_official 381:5460fc57b6e4 244 */
mbed_official 381:5460fc57b6e4 245
mbed_official 381:5460fc57b6e4 246 /** @defgroup UART_Stop_Bits UART Number of Stop Bits
mbed_official 381:5460fc57b6e4 247 * @{
mbed_official 381:5460fc57b6e4 248 */
mbed_official 381:5460fc57b6e4 249 #define UART_STOPBITS_1 ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 250 #define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1)
mbed_official 381:5460fc57b6e4 251 #define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_1) || \
mbed_official 381:5460fc57b6e4 252 ((STOPBITS) == UART_STOPBITS_2))
mbed_official 381:5460fc57b6e4 253 /**
mbed_official 381:5460fc57b6e4 254 * @}
mbed_official 381:5460fc57b6e4 255 */
mbed_official 381:5460fc57b6e4 256
mbed_official 381:5460fc57b6e4 257 /** @defgroup UART_Parity UART Parity
mbed_official 381:5460fc57b6e4 258 * @{
mbed_official 381:5460fc57b6e4 259 */
mbed_official 381:5460fc57b6e4 260 #define UART_PARITY_NONE ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 261 #define UART_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
mbed_official 381:5460fc57b6e4 262 #define UART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
mbed_official 381:5460fc57b6e4 263 #define IS_UART_PARITY(PARITY) (((PARITY) == UART_PARITY_NONE) || \
mbed_official 381:5460fc57b6e4 264 ((PARITY) == UART_PARITY_EVEN) || \
mbed_official 381:5460fc57b6e4 265 ((PARITY) == UART_PARITY_ODD))
mbed_official 381:5460fc57b6e4 266 /**
mbed_official 381:5460fc57b6e4 267 * @}
mbed_official 381:5460fc57b6e4 268 */
mbed_official 381:5460fc57b6e4 269
mbed_official 381:5460fc57b6e4 270 /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
mbed_official 381:5460fc57b6e4 271 * @{
mbed_official 381:5460fc57b6e4 272 */
mbed_official 381:5460fc57b6e4 273 #define UART_HWCONTROL_NONE ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 274 #define UART_HWCONTROL_RTS ((uint32_t)USART_CR3_RTSE)
mbed_official 381:5460fc57b6e4 275 #define UART_HWCONTROL_CTS ((uint32_t)USART_CR3_CTSE)
mbed_official 381:5460fc57b6e4 276 #define UART_HWCONTROL_RTS_CTS ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE))
mbed_official 381:5460fc57b6e4 277 #define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL)\
mbed_official 381:5460fc57b6e4 278 (((CONTROL) == UART_HWCONTROL_NONE) || \
mbed_official 381:5460fc57b6e4 279 ((CONTROL) == UART_HWCONTROL_RTS) || \
mbed_official 381:5460fc57b6e4 280 ((CONTROL) == UART_HWCONTROL_CTS) || \
mbed_official 381:5460fc57b6e4 281 ((CONTROL) == UART_HWCONTROL_RTS_CTS))
mbed_official 381:5460fc57b6e4 282 /**
mbed_official 381:5460fc57b6e4 283 * @}
mbed_official 381:5460fc57b6e4 284 */
mbed_official 381:5460fc57b6e4 285
mbed_official 381:5460fc57b6e4 286 /** @defgroup UART_Mode UART Transfer Mode
mbed_official 381:5460fc57b6e4 287 * @{
mbed_official 381:5460fc57b6e4 288 */
mbed_official 381:5460fc57b6e4 289 #define UART_MODE_RX ((uint32_t)USART_CR1_RE)
mbed_official 381:5460fc57b6e4 290 #define UART_MODE_TX ((uint32_t)USART_CR1_TE)
mbed_official 381:5460fc57b6e4 291 #define UART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
mbed_official 381:5460fc57b6e4 292 #define IS_UART_MODE(MODE) ((((MODE) & (~((uint32_t)(UART_MODE_TX_RX)))) == (uint32_t)0x00) && ((MODE) != (uint32_t)0x00))
mbed_official 381:5460fc57b6e4 293 /**
mbed_official 381:5460fc57b6e4 294 * @}
mbed_official 381:5460fc57b6e4 295 */
mbed_official 381:5460fc57b6e4 296
mbed_official 381:5460fc57b6e4 297 /** @defgroup UART_State UART State
mbed_official 381:5460fc57b6e4 298 * @{
mbed_official 381:5460fc57b6e4 299 */
mbed_official 381:5460fc57b6e4 300 #define UART_STATE_DISABLE ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 301 #define UART_STATE_ENABLE ((uint32_t)USART_CR1_UE)
mbed_official 381:5460fc57b6e4 302 #define IS_UART_STATE(STATE) (((STATE) == UART_STATE_DISABLE) || \
mbed_official 381:5460fc57b6e4 303 ((STATE) == UART_STATE_ENABLE))
mbed_official 381:5460fc57b6e4 304 /**
mbed_official 381:5460fc57b6e4 305 * @}
mbed_official 381:5460fc57b6e4 306 */
mbed_official 381:5460fc57b6e4 307
mbed_official 381:5460fc57b6e4 308 /** @defgroup UART_Over_Sampling UART Over Sampling
mbed_official 381:5460fc57b6e4 309 * @{
mbed_official 381:5460fc57b6e4 310 */
mbed_official 381:5460fc57b6e4 311 #define UART_OVERSAMPLING_16 ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 312 #define UART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8)
mbed_official 381:5460fc57b6e4 313 #define IS_UART_OVERSAMPLING(SAMPLING) (((SAMPLING) == UART_OVERSAMPLING_16) || \
mbed_official 381:5460fc57b6e4 314 ((SAMPLING) == UART_OVERSAMPLING_8))
mbed_official 381:5460fc57b6e4 315 /**
mbed_official 381:5460fc57b6e4 316 * @}
mbed_official 381:5460fc57b6e4 317 */
mbed_official 381:5460fc57b6e4 318
mbed_official 381:5460fc57b6e4 319 /** @defgroup UART_OneBit_Sampling UART One Bit Sampling Method
mbed_official 381:5460fc57b6e4 320 * @{
mbed_official 381:5460fc57b6e4 321 */
mbed_official 381:5460fc57b6e4 322 #define UART_ONEBIT_SAMPLING_DISABLED ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 323 #define UART_ONEBIT_SAMPLING_ENABLED ((uint32_t)USART_CR3_ONEBIT)
mbed_official 381:5460fc57b6e4 324 #define IS_UART_ONEBIT_SAMPLING(ONEBIT) (((ONEBIT) == UART_ONEBIT_SAMPLING_DISABLED) || \
mbed_official 381:5460fc57b6e4 325 ((ONEBIT) == UART_ONEBIT_SAMPLING_ENABLED))
mbed_official 381:5460fc57b6e4 326 /**
mbed_official 381:5460fc57b6e4 327 * @}
mbed_official 381:5460fc57b6e4 328 */
mbed_official 381:5460fc57b6e4 329
mbed_official 381:5460fc57b6e4 330 /** @defgroup UART_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode
mbed_official 381:5460fc57b6e4 331 * @{
mbed_official 381:5460fc57b6e4 332 */
mbed_official 381:5460fc57b6e4 333 #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 334 #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0)
mbed_official 381:5460fc57b6e4 335 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1)
mbed_official 381:5460fc57b6e4 336 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME ((uint32_t)USART_CR2_ABRMODE)
mbed_official 381:5460fc57b6e4 337 #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
mbed_official 381:5460fc57b6e4 338 ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \
mbed_official 381:5460fc57b6e4 339 ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \
mbed_official 381:5460fc57b6e4 340 ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME))
mbed_official 381:5460fc57b6e4 341 /**
mbed_official 381:5460fc57b6e4 342 * @}
mbed_official 381:5460fc57b6e4 343 */
mbed_official 381:5460fc57b6e4 344
mbed_official 381:5460fc57b6e4 345 /** @defgroup UART_Receiver_TimeOut UART Receiver TimeOut
mbed_official 381:5460fc57b6e4 346 * @{
mbed_official 381:5460fc57b6e4 347 */
mbed_official 381:5460fc57b6e4 348 #define UART_RECEIVER_TIMEOUT_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 349 #define UART_RECEIVER_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN)
mbed_official 381:5460fc57b6e4 350 #define IS_UART_RECEIVER_TIMEOUT(TIMEOUT) (((TIMEOUT) == UART_RECEIVER_TIMEOUT_DISABLE) || \
mbed_official 381:5460fc57b6e4 351 ((TIMEOUT) == UART_RECEIVER_TIMEOUT_ENABLE))
mbed_official 381:5460fc57b6e4 352 /**
mbed_official 381:5460fc57b6e4 353 * @}
mbed_official 381:5460fc57b6e4 354 */
mbed_official 381:5460fc57b6e4 355
mbed_official 381:5460fc57b6e4 356 /** @defgroup UART_LIN UART Local Interconnection Network mode
mbed_official 381:5460fc57b6e4 357 * @{
mbed_official 381:5460fc57b6e4 358 */
mbed_official 381:5460fc57b6e4 359 #define UART_LIN_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 360 #define UART_LIN_ENABLE ((uint32_t)USART_CR2_LINEN)
mbed_official 381:5460fc57b6e4 361 #define IS_UART_LIN(LIN) (((LIN) == UART_LIN_DISABLE) || \
mbed_official 381:5460fc57b6e4 362 ((LIN) == UART_LIN_ENABLE))
mbed_official 381:5460fc57b6e4 363 /**
mbed_official 381:5460fc57b6e4 364 * @}
mbed_official 381:5460fc57b6e4 365 */
mbed_official 381:5460fc57b6e4 366
mbed_official 381:5460fc57b6e4 367 /** @defgroup UART_LIN_Break_Detection UART LIN Break Detection
mbed_official 381:5460fc57b6e4 368 * @{
mbed_official 381:5460fc57b6e4 369 */
mbed_official 381:5460fc57b6e4 370 #define UART_LINBREAKDETECTLENGTH_10B ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 371 #define UART_LINBREAKDETECTLENGTH_11B ((uint32_t)USART_CR2_LBDL)
mbed_official 381:5460fc57b6e4 372 #define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH) (((LENGTH) == UART_LINBREAKDETECTLENGTH_10B) || \
mbed_official 381:5460fc57b6e4 373 ((LENGTH) == UART_LINBREAKDETECTLENGTH_11B))
mbed_official 381:5460fc57b6e4 374 /**
mbed_official 381:5460fc57b6e4 375 * @}
mbed_official 381:5460fc57b6e4 376 */
mbed_official 381:5460fc57b6e4 377
mbed_official 381:5460fc57b6e4 378
mbed_official 381:5460fc57b6e4 379
mbed_official 381:5460fc57b6e4 380 /** @defgroup UART_One_Bit UART One Bit sampling
mbed_official 381:5460fc57b6e4 381 * @{
mbed_official 381:5460fc57b6e4 382 */
mbed_official 381:5460fc57b6e4 383 #define UART_ONE_BIT_SAMPLE_DISABLED ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 384 #define UART_ONE_BIT_SAMPLE_ENABLED ((uint32_t)USART_CR3_ONEBIT)
mbed_official 381:5460fc57b6e4 385 #define IS_UART_ONEBIT_SAMPLE(ONEBIT) (((ONEBIT) == UART_ONE_BIT_SAMPLE_DISABLED) || \
mbed_official 381:5460fc57b6e4 386 ((ONEBIT) == UART_ONE_BIT_SAMPLE_ENABLED))
mbed_official 381:5460fc57b6e4 387 /**
mbed_official 381:5460fc57b6e4 388 * @}
mbed_official 381:5460fc57b6e4 389 */
mbed_official 381:5460fc57b6e4 390
mbed_official 381:5460fc57b6e4 391 /** @defgroup UART_DMA_Tx UART DMA Tx
mbed_official 381:5460fc57b6e4 392 * @{
mbed_official 381:5460fc57b6e4 393 */
mbed_official 381:5460fc57b6e4 394 #define UART_DMA_TX_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 395 #define UART_DMA_TX_ENABLE ((uint32_t)USART_CR3_DMAT)
mbed_official 381:5460fc57b6e4 396 #define IS_UART_DMA_TX(DMATX) (((DMATX) == UART_DMA_TX_DISABLE) || \
mbed_official 381:5460fc57b6e4 397 ((DMATX) == UART_DMA_TX_ENABLE))
mbed_official 381:5460fc57b6e4 398 /**
mbed_official 381:5460fc57b6e4 399 * @}
mbed_official 381:5460fc57b6e4 400 */
mbed_official 381:5460fc57b6e4 401
mbed_official 381:5460fc57b6e4 402 /** @defgroup UART_DMA_Rx UART DMA Rx
mbed_official 381:5460fc57b6e4 403 * @{
mbed_official 381:5460fc57b6e4 404 */
mbed_official 381:5460fc57b6e4 405 #define UART_DMA_RX_DISABLE ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 406 #define UART_DMA_RX_ENABLE ((uint32_t)USART_CR3_DMAR)
mbed_official 381:5460fc57b6e4 407 #define IS_UART_DMA_RX(DMARX) (((DMARX) == UART_DMA_RX_DISABLE) || \
mbed_official 381:5460fc57b6e4 408 ((DMARX) == UART_DMA_RX_ENABLE))
mbed_official 381:5460fc57b6e4 409 /**
mbed_official 381:5460fc57b6e4 410 * @}
mbed_official 381:5460fc57b6e4 411 */
mbed_official 381:5460fc57b6e4 412
mbed_official 381:5460fc57b6e4 413 /** @defgroup UART_Half_Duplex_Selection UART Half Duplex Selection
mbed_official 381:5460fc57b6e4 414 * @{
mbed_official 381:5460fc57b6e4 415 */
mbed_official 381:5460fc57b6e4 416 #define UART_HALF_DUPLEX_DISABLE ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 417 #define UART_HALF_DUPLEX_ENABLE ((uint32_t)USART_CR3_HDSEL)
mbed_official 381:5460fc57b6e4 418 #define IS_UART_HALF_DUPLEX(HDSEL) (((HDSEL) == UART_HALF_DUPLEX_DISABLE) || \
mbed_official 381:5460fc57b6e4 419 ((HDSEL) == UART_HALF_DUPLEX_ENABLE))
mbed_official 381:5460fc57b6e4 420 /**
mbed_official 381:5460fc57b6e4 421 * @}
mbed_official 381:5460fc57b6e4 422 */
mbed_official 381:5460fc57b6e4 423
mbed_official 381:5460fc57b6e4 424 /** @defgroup UART_WakeUp_Methods UART WakeUp Methods
mbed_official 381:5460fc57b6e4 425 * @{
mbed_official 381:5460fc57b6e4 426 */
mbed_official 381:5460fc57b6e4 427 #define UART_WAKEUPMETHOD_IDLELINE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 428 #define UART_WAKEUPMETHOD_ADDRESSMARK ((uint32_t)USART_CR1_WAKE)
mbed_official 381:5460fc57b6e4 429 #define IS_UART_WAKEUPMETHOD(WAKEUP) (((WAKEUP) == UART_WAKEUPMETHOD_IDLELINE) || \
mbed_official 381:5460fc57b6e4 430 ((WAKEUP) == UART_WAKEUPMETHOD_ADDRESSMARK))
mbed_official 381:5460fc57b6e4 431 /**
mbed_official 381:5460fc57b6e4 432 * @}
mbed_official 381:5460fc57b6e4 433 */
mbed_official 381:5460fc57b6e4 434
mbed_official 381:5460fc57b6e4 435 /** @defgroup UART_Flags UART Status Flags
mbed_official 381:5460fc57b6e4 436 * Elements values convention: 0xXXXX
mbed_official 381:5460fc57b6e4 437 * - 0xXXXX : Flag mask in the ISR register
mbed_official 381:5460fc57b6e4 438 * @{
mbed_official 381:5460fc57b6e4 439 */
mbed_official 381:5460fc57b6e4 440 #define UART_FLAG_REACK ((uint32_t)0x00400000)
mbed_official 381:5460fc57b6e4 441 #define UART_FLAG_TEACK ((uint32_t)0x00200000)
mbed_official 381:5460fc57b6e4 442 #define UART_FLAG_WUF ((uint32_t)0x00100000)
mbed_official 381:5460fc57b6e4 443 #define UART_FLAG_RWU ((uint32_t)0x00080000)
mbed_official 381:5460fc57b6e4 444 #define UART_FLAG_SBKF ((uint32_t)0x00040000
mbed_official 381:5460fc57b6e4 445 #define UART_FLAG_CMF ((uint32_t)0x00020000)
mbed_official 381:5460fc57b6e4 446 #define UART_FLAG_BUSY ((uint32_t)0x00010000)
mbed_official 381:5460fc57b6e4 447 #define UART_FLAG_ABRF ((uint32_t)0x00008000)
mbed_official 381:5460fc57b6e4 448 #define UART_FLAG_ABRE ((uint32_t)0x00004000)
mbed_official 381:5460fc57b6e4 449 #define UART_FLAG_EOBF ((uint32_t)0x00001000)
mbed_official 381:5460fc57b6e4 450 #define UART_FLAG_RTOF ((uint32_t)0x00000800)
mbed_official 381:5460fc57b6e4 451 #define UART_FLAG_CTS ((uint32_t)0x00000400)
mbed_official 381:5460fc57b6e4 452 #define UART_FLAG_CTSIF ((uint32_t)0x00000200)
mbed_official 381:5460fc57b6e4 453 #define UART_FLAG_LBDF ((uint32_t)0x00000100)
mbed_official 381:5460fc57b6e4 454 #define UART_FLAG_TXE ((uint32_t)0x00000080)
mbed_official 381:5460fc57b6e4 455 #define UART_FLAG_TC ((uint32_t)0x00000040)
mbed_official 381:5460fc57b6e4 456 #define UART_FLAG_RXNE ((uint32_t)0x00000020)
mbed_official 381:5460fc57b6e4 457 #define UART_FLAG_IDLE ((uint32_t)0x00000010)
mbed_official 381:5460fc57b6e4 458 #define UART_FLAG_ORE ((uint32_t)0x00000008)
mbed_official 381:5460fc57b6e4 459 #define UART_FLAG_NE ((uint32_t)0x00000004)
mbed_official 381:5460fc57b6e4 460 #define UART_FLAG_FE ((uint32_t)0x00000002)
mbed_official 381:5460fc57b6e4 461 #define UART_FLAG_PE ((uint32_t)0x00000001)
mbed_official 381:5460fc57b6e4 462 /**
mbed_official 381:5460fc57b6e4 463 * @}
mbed_official 381:5460fc57b6e4 464 */
mbed_official 381:5460fc57b6e4 465
mbed_official 381:5460fc57b6e4 466 /** @defgroup UART_Interrupt_definition UART Interrupts Definition
mbed_official 381:5460fc57b6e4 467 * Elements values convention: 0000ZZZZ0XXYYYYYb
mbed_official 381:5460fc57b6e4 468 * - YYYYY : Interrupt source position in the XX register (5bits)
mbed_official 381:5460fc57b6e4 469 * - XX : Interrupt source register (2bits)
mbed_official 381:5460fc57b6e4 470 * - 01: CR1 register
mbed_official 381:5460fc57b6e4 471 * - 10: CR2 register
mbed_official 381:5460fc57b6e4 472 * - 11: CR3 register
mbed_official 381:5460fc57b6e4 473 * - ZZZZ : Flag position in the ISR register(4bits)
mbed_official 381:5460fc57b6e4 474 * @{
mbed_official 381:5460fc57b6e4 475 */
mbed_official 381:5460fc57b6e4 476 #define UART_IT_PE ((uint16_t)0x0028)
mbed_official 381:5460fc57b6e4 477 #define UART_IT_TXE ((uint16_t)0x0727)
mbed_official 381:5460fc57b6e4 478 #define UART_IT_TC ((uint16_t)0x0626)
mbed_official 381:5460fc57b6e4 479 #define UART_IT_RXNE ((uint16_t)0x0525)
mbed_official 381:5460fc57b6e4 480 #define UART_IT_IDLE ((uint16_t)0x0424)
mbed_official 381:5460fc57b6e4 481 #define UART_IT_LBD ((uint16_t)0x0846)
mbed_official 381:5460fc57b6e4 482 #define UART_IT_CTS ((uint16_t)0x096A)
mbed_official 381:5460fc57b6e4 483 #define UART_IT_CM ((uint16_t)0x142E)
mbed_official 381:5460fc57b6e4 484 #define UART_IT_WUF ((uint16_t)0x1476)
mbed_official 381:5460fc57b6e4 485
mbed_official 381:5460fc57b6e4 486 /** Elements values convention: 000000000XXYYYYYb
mbed_official 381:5460fc57b6e4 487 * - YYYYY : Interrupt source position in the XX register (5bits)
mbed_official 381:5460fc57b6e4 488 * - XX : Interrupt source register (2bits)
mbed_official 381:5460fc57b6e4 489 * - 01: CR1 register
mbed_official 381:5460fc57b6e4 490 * - 10: CR2 register
mbed_official 381:5460fc57b6e4 491 * - 11: CR3 register
mbed_official 381:5460fc57b6e4 492 */
mbed_official 381:5460fc57b6e4 493 #define UART_IT_ERR ((uint16_t)0x0060)
mbed_official 381:5460fc57b6e4 494
mbed_official 381:5460fc57b6e4 495 /** Elements values convention: 0000ZZZZ00000000b
mbed_official 381:5460fc57b6e4 496 * - ZZZZ : Flag position in the ISR register(4bits)
mbed_official 381:5460fc57b6e4 497 */
mbed_official 381:5460fc57b6e4 498 #define UART_IT_ORE ((uint16_t)0x0300)
mbed_official 381:5460fc57b6e4 499 #define UART_IT_NE ((uint16_t)0x0200)
mbed_official 381:5460fc57b6e4 500 #define UART_IT_FE ((uint16_t)0x0100)
mbed_official 381:5460fc57b6e4 501 /**
mbed_official 381:5460fc57b6e4 502 * @}
mbed_official 381:5460fc57b6e4 503 */
mbed_official 381:5460fc57b6e4 504
mbed_official 381:5460fc57b6e4 505 /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags
mbed_official 381:5460fc57b6e4 506 * @{
mbed_official 381:5460fc57b6e4 507 */
mbed_official 381:5460fc57b6e4 508 #define UART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
mbed_official 381:5460fc57b6e4 509 #define UART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
mbed_official 381:5460fc57b6e4 510 #define UART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
mbed_official 381:5460fc57b6e4 511 #define UART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
mbed_official 381:5460fc57b6e4 512 #define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
mbed_official 381:5460fc57b6e4 513 #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
mbed_official 381:5460fc57b6e4 514 #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag */
mbed_official 381:5460fc57b6e4 515 #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
mbed_official 381:5460fc57b6e4 516 #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
mbed_official 381:5460fc57b6e4 517 #define UART_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
mbed_official 381:5460fc57b6e4 518 #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */
mbed_official 381:5460fc57b6e4 519 #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */
mbed_official 381:5460fc57b6e4 520 /**
mbed_official 381:5460fc57b6e4 521 * @}
mbed_official 381:5460fc57b6e4 522 */
mbed_official 381:5460fc57b6e4 523
mbed_official 381:5460fc57b6e4 524 /** @defgroup UART_Request_Parameters UART Request Parameters
mbed_official 381:5460fc57b6e4 525 * @{
mbed_official 381:5460fc57b6e4 526 */
mbed_official 381:5460fc57b6e4 527 #define UART_AUTOBAUD_REQUEST ((uint32_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */
mbed_official 381:5460fc57b6e4 528 #define UART_SENDBREAK_REQUEST ((uint32_t)USART_RQR_SBKRQ) /*!< Send Break Request */
mbed_official 381:5460fc57b6e4 529 #define UART_MUTE_MODE_REQUEST ((uint32_t)USART_RQR_MMRQ) /*!< Mute Mode Request */
mbed_official 381:5460fc57b6e4 530 #define UART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
mbed_official 381:5460fc57b6e4 531 #define UART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
mbed_official 381:5460fc57b6e4 532 #define IS_UART_REQUEST_PARAMETER(PARAM) (((PARAM) == UART_AUTOBAUD_REQUEST) || \
mbed_official 381:5460fc57b6e4 533 ((PARAM) == UART_SENDBREAK_REQUEST) || \
mbed_official 381:5460fc57b6e4 534 ((PARAM) == UART_MUTE_MODE_REQUEST) || \
mbed_official 381:5460fc57b6e4 535 ((PARAM) == UART_RXDATA_FLUSH_REQUEST) || \
mbed_official 381:5460fc57b6e4 536 ((PARAM) == UART_TXDATA_FLUSH_REQUEST))
mbed_official 381:5460fc57b6e4 537 /**
mbed_official 381:5460fc57b6e4 538 * @}
mbed_official 381:5460fc57b6e4 539 */
mbed_official 381:5460fc57b6e4 540
mbed_official 381:5460fc57b6e4 541 /** @defgroup UART_Advanced_Features_Initialization_Type UART Advanced Feature Initialization Type
mbed_official 381:5460fc57b6e4 542 * @{
mbed_official 381:5460fc57b6e4 543 */
mbed_official 381:5460fc57b6e4 544 #define UART_ADVFEATURE_NO_INIT ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 545 #define UART_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001)
mbed_official 381:5460fc57b6e4 546 #define UART_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002)
mbed_official 381:5460fc57b6e4 547 #define UART_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004)
mbed_official 381:5460fc57b6e4 548 #define UART_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008)
mbed_official 381:5460fc57b6e4 549 #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010)
mbed_official 381:5460fc57b6e4 550 #define UART_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020)
mbed_official 381:5460fc57b6e4 551 #define UART_ADVFEATURE_AUTOBAUDRATE_INIT ((uint32_t)0x00000040)
mbed_official 381:5460fc57b6e4 552 #define UART_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080)
mbed_official 381:5460fc57b6e4 553 #define IS_UART_ADVFEATURE_INIT(INIT) ((INIT) <= (UART_ADVFEATURE_NO_INIT | \
mbed_official 381:5460fc57b6e4 554 UART_ADVFEATURE_TXINVERT_INIT | \
mbed_official 381:5460fc57b6e4 555 UART_ADVFEATURE_RXINVERT_INIT | \
mbed_official 381:5460fc57b6e4 556 UART_ADVFEATURE_DATAINVERT_INIT | \
mbed_official 381:5460fc57b6e4 557 UART_ADVFEATURE_SWAP_INIT | \
mbed_official 381:5460fc57b6e4 558 UART_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
mbed_official 381:5460fc57b6e4 559 UART_ADVFEATURE_DMADISABLEONERROR_INIT | \
mbed_official 381:5460fc57b6e4 560 UART_ADVFEATURE_AUTOBAUDRATE_INIT | \
mbed_official 381:5460fc57b6e4 561 UART_ADVFEATURE_MSBFIRST_INIT))
mbed_official 381:5460fc57b6e4 562 /**
mbed_official 381:5460fc57b6e4 563 * @}
mbed_official 381:5460fc57b6e4 564 */
mbed_official 381:5460fc57b6e4 565
mbed_official 381:5460fc57b6e4 566 /** @defgroup UART_Tx_Inv UART Advanced Feature TX Pin Active Level Inversion
mbed_official 381:5460fc57b6e4 567 * @{
mbed_official 381:5460fc57b6e4 568 */
mbed_official 381:5460fc57b6e4 569 #define UART_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 570 #define UART_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV)
mbed_official 381:5460fc57b6e4 571 #define IS_UART_ADVFEATURE_TXINV(TXINV) (((TXINV) == UART_ADVFEATURE_TXINV_DISABLE) || \
mbed_official 381:5460fc57b6e4 572 ((TXINV) == UART_ADVFEATURE_TXINV_ENABLE))
mbed_official 381:5460fc57b6e4 573 /**
mbed_official 381:5460fc57b6e4 574 * @}
mbed_official 381:5460fc57b6e4 575 */
mbed_official 381:5460fc57b6e4 576
mbed_official 381:5460fc57b6e4 577 /** @defgroup UART_Rx_Inv UART Advanced Feature RX Pin Active Level Inversion
mbed_official 381:5460fc57b6e4 578 * @{
mbed_official 381:5460fc57b6e4 579 */
mbed_official 381:5460fc57b6e4 580 #define UART_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 581 #define UART_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV)
mbed_official 381:5460fc57b6e4 582 #define IS_UART_ADVFEATURE_RXINV(RXINV) (((RXINV) == UART_ADVFEATURE_RXINV_DISABLE) || \
mbed_official 381:5460fc57b6e4 583 ((RXINV) == UART_ADVFEATURE_RXINV_ENABLE))
mbed_official 381:5460fc57b6e4 584 /**
mbed_official 381:5460fc57b6e4 585 * @}
mbed_official 381:5460fc57b6e4 586 */
mbed_official 381:5460fc57b6e4 587
mbed_official 381:5460fc57b6e4 588 /** @defgroup UART_Data_Inv UART Advanced Feature Binary Data Inversion
mbed_official 381:5460fc57b6e4 589 * @{
mbed_official 381:5460fc57b6e4 590 */
mbed_official 381:5460fc57b6e4 591 #define UART_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 592 #define UART_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV)
mbed_official 381:5460fc57b6e4 593 #define IS_UART_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == UART_ADVFEATURE_DATAINV_DISABLE) || \
mbed_official 381:5460fc57b6e4 594 ((DATAINV) == UART_ADVFEATURE_DATAINV_ENABLE))
mbed_official 381:5460fc57b6e4 595 /**
mbed_official 381:5460fc57b6e4 596 * @}
mbed_official 381:5460fc57b6e4 597 */
mbed_official 381:5460fc57b6e4 598
mbed_official 381:5460fc57b6e4 599 /** @defgroup UART_Rx_Tx_Swap UART Advanced Feature RX TX Pins Swap
mbed_official 381:5460fc57b6e4 600 * @{
mbed_official 381:5460fc57b6e4 601 */
mbed_official 381:5460fc57b6e4 602 #define UART_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 603 #define UART_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP)
mbed_official 381:5460fc57b6e4 604 #define IS_UART_ADVFEATURE_SWAP(SWAP) (((SWAP) == UART_ADVFEATURE_SWAP_DISABLE) || \
mbed_official 381:5460fc57b6e4 605 ((SWAP) == UART_ADVFEATURE_SWAP_ENABLE))
mbed_official 381:5460fc57b6e4 606 /**
mbed_official 381:5460fc57b6e4 607 * @}
mbed_official 381:5460fc57b6e4 608 */
mbed_official 381:5460fc57b6e4 609
mbed_official 381:5460fc57b6e4 610 /** @defgroup UART_Overrun_Disable UART Advanced Feature Overrun Disable
mbed_official 381:5460fc57b6e4 611 * @{
mbed_official 381:5460fc57b6e4 612 */
mbed_official 381:5460fc57b6e4 613 #define UART_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 614 #define UART_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS)
mbed_official 381:5460fc57b6e4 615 #define IS_UART_OVERRUN(OVERRUN) (((OVERRUN) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
mbed_official 381:5460fc57b6e4 616 ((OVERRUN) == UART_ADVFEATURE_OVERRUN_DISABLE))
mbed_official 381:5460fc57b6e4 617 /**
mbed_official 381:5460fc57b6e4 618 * @}
mbed_official 381:5460fc57b6e4 619 */
mbed_official 381:5460fc57b6e4 620
mbed_official 381:5460fc57b6e4 621 /** @defgroup UART_AutoBaudRate_Enable UART Advanced Feature Auto BaudRate Enable
mbed_official 381:5460fc57b6e4 622 * @{
mbed_official 381:5460fc57b6e4 623 */
mbed_official 381:5460fc57b6e4 624 #define UART_ADVFEATURE_AUTOBAUDRATE_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 625 #define UART_ADVFEATURE_AUTOBAUDRATE_ENABLE ((uint32_t)USART_CR2_ABREN)
mbed_official 381:5460fc57b6e4 626 #define IS_UART_ADVFEATURE_AUTOBAUDRATE(AUTOBAUDRATE) (((AUTOBAUDRATE) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
mbed_official 381:5460fc57b6e4 627 ((AUTOBAUDRATE) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))
mbed_official 381:5460fc57b6e4 628 /**
mbed_official 381:5460fc57b6e4 629 * @}
mbed_official 381:5460fc57b6e4 630 */
mbed_official 381:5460fc57b6e4 631
mbed_official 381:5460fc57b6e4 632 /** @defgroup UART_DMA_Disable_on_Rx_Error UART Advanced Feature DMA Disable On Rx Error
mbed_official 381:5460fc57b6e4 633 * @{
mbed_official 381:5460fc57b6e4 634 */
mbed_official 381:5460fc57b6e4 635 #define UART_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 636 #define UART_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE)
mbed_official 381:5460fc57b6e4 637 #define IS_UART_ADVFEATURE_DMAONRXERROR(DMA) (((DMA) == UART_ADVFEATURE_DMA_ENABLEONRXERROR) || \
mbed_official 381:5460fc57b6e4 638 ((DMA) == UART_ADVFEATURE_DMA_DISABLEONRXERROR))
mbed_official 381:5460fc57b6e4 639 /**
mbed_official 381:5460fc57b6e4 640 * @}
mbed_official 381:5460fc57b6e4 641 */
mbed_official 381:5460fc57b6e4 642
mbed_official 381:5460fc57b6e4 643 /** @defgroup UART_MSB_First UART Advanced Feature MSB First
mbed_official 381:5460fc57b6e4 644 * @{
mbed_official 381:5460fc57b6e4 645 */
mbed_official 381:5460fc57b6e4 646 #define UART_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 647 #define UART_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST)
mbed_official 381:5460fc57b6e4 648 #define IS_UART_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
mbed_official 381:5460fc57b6e4 649 ((MSBFIRST) == UART_ADVFEATURE_MSBFIRST_ENABLE))
mbed_official 381:5460fc57b6e4 650 /**
mbed_official 381:5460fc57b6e4 651 * @}
mbed_official 381:5460fc57b6e4 652 */
mbed_official 381:5460fc57b6e4 653
mbed_official 381:5460fc57b6e4 654 /** @defgroup UART_Stop_Mode_Enable UART Advanced Feature Stop Mode Enable
mbed_official 381:5460fc57b6e4 655 * @{
mbed_official 381:5460fc57b6e4 656 */
mbed_official 381:5460fc57b6e4 657 #define UART_ADVFEATURE_STOPMODE_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 658 #define UART_ADVFEATURE_STOPMODE_ENABLE ((uint32_t)USART_CR1_UESM)
mbed_official 381:5460fc57b6e4 659 #define IS_UART_ADVFEATURE_STOPMODE(STOPMODE) (((STOPMODE) == UART_ADVFEATURE_STOPMODE_DISABLE) || \
mbed_official 381:5460fc57b6e4 660 ((STOPMODE) == UART_ADVFEATURE_STOPMODE_ENABLE))
mbed_official 381:5460fc57b6e4 661 /**
mbed_official 381:5460fc57b6e4 662 * @}
mbed_official 381:5460fc57b6e4 663 */
mbed_official 381:5460fc57b6e4 664
mbed_official 381:5460fc57b6e4 665 /** @defgroup UART_Mute_Mode UART Advanced Feature Mute Mode Enable
mbed_official 381:5460fc57b6e4 666 * @{
mbed_official 381:5460fc57b6e4 667 */
mbed_official 381:5460fc57b6e4 668 #define UART_ADVFEATURE_MUTEMODE_DISABLE ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 669 #define UART_ADVFEATURE_MUTEMODE_ENABLE ((uint32_t)USART_CR1_MME)
mbed_official 381:5460fc57b6e4 670 #define IS_UART_MUTE_MODE(MUTE) (((MUTE) == UART_ADVFEATURE_MUTEMODE_DISABLE) || \
mbed_official 381:5460fc57b6e4 671 ((MUTE) == UART_ADVFEATURE_MUTEMODE_ENABLE))
mbed_official 381:5460fc57b6e4 672 /**
mbed_official 381:5460fc57b6e4 673 * @}
mbed_official 381:5460fc57b6e4 674 */
mbed_official 381:5460fc57b6e4 675
mbed_official 381:5460fc57b6e4 676 /** @defgroup UART_CR2_ADDRESS_LSB_POS UART Address-matching LSB Position In CR2 Register
mbed_official 381:5460fc57b6e4 677 * @{
mbed_official 381:5460fc57b6e4 678 */
mbed_official 381:5460fc57b6e4 679 #define UART_CR2_ADDRESS_LSB_POS ((uint32_t) 24)
mbed_official 381:5460fc57b6e4 680 /**
mbed_official 381:5460fc57b6e4 681 * @}
mbed_official 381:5460fc57b6e4 682 */
mbed_official 381:5460fc57b6e4 683
mbed_official 381:5460fc57b6e4 684 /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection
mbed_official 381:5460fc57b6e4 685 * @{
mbed_official 381:5460fc57b6e4 686 */
mbed_official 381:5460fc57b6e4 687 #define UART_WAKEUP_ON_ADDRESS ((uint32_t)0x0000)
mbed_official 381:5460fc57b6e4 688 #define UART_WAKEUP_ON_STARTBIT ((uint32_t)USART_CR3_WUS_1)
mbed_official 381:5460fc57b6e4 689 #define UART_WAKEUP_ON_READDATA_NONEMPTY ((uint32_t)USART_CR3_WUS)
mbed_official 381:5460fc57b6e4 690 #define IS_UART_WAKEUP_SELECTION(WAKE) (((WAKE) == UART_WAKEUP_ON_ADDRESS) || \
mbed_official 381:5460fc57b6e4 691 ((WAKE) == UART_WAKEUP_ON_STARTBIT) || \
mbed_official 381:5460fc57b6e4 692 ((WAKE) == UART_WAKEUP_ON_READDATA_NONEMPTY))
mbed_official 381:5460fc57b6e4 693 /**
mbed_official 381:5460fc57b6e4 694 * @}
mbed_official 381:5460fc57b6e4 695 */
mbed_official 381:5460fc57b6e4 696
mbed_official 381:5460fc57b6e4 697 /** @defgroup UART_DriverEnable_Polarity UART DriverEnable Polarity
mbed_official 381:5460fc57b6e4 698 * @{
mbed_official 381:5460fc57b6e4 699 */
mbed_official 381:5460fc57b6e4 700 #define UART_DE_POLARITY_HIGH ((uint32_t)0x00000000)
mbed_official 381:5460fc57b6e4 701 #define UART_DE_POLARITY_LOW ((uint32_t)USART_CR3_DEP)
mbed_official 381:5460fc57b6e4 702 #define IS_UART_DE_POLARITY(POLARITY) (((POLARITY) == UART_DE_POLARITY_HIGH) || \
mbed_official 381:5460fc57b6e4 703 ((POLARITY) == UART_DE_POLARITY_LOW))
mbed_official 381:5460fc57b6e4 704 /**
mbed_official 381:5460fc57b6e4 705 * @}
mbed_official 381:5460fc57b6e4 706 */
mbed_official 381:5460fc57b6e4 707
mbed_official 381:5460fc57b6e4 708 /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS UART Driver Enable Assertion Time LSB Position In CR1 Register
mbed_official 381:5460fc57b6e4 709 * @{
mbed_official 381:5460fc57b6e4 710 */
mbed_official 381:5460fc57b6e4 711 #define UART_CR1_DEAT_ADDRESS_LSB_POS ((uint32_t) 21)
mbed_official 381:5460fc57b6e4 712 /**
mbed_official 381:5460fc57b6e4 713 * @}
mbed_official 381:5460fc57b6e4 714 */
mbed_official 381:5460fc57b6e4 715
mbed_official 381:5460fc57b6e4 716 /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS UART Driver Enable DeAssertion Time LSB Position In CR1 Register
mbed_official 381:5460fc57b6e4 717 * @{
mbed_official 381:5460fc57b6e4 718 */
mbed_official 381:5460fc57b6e4 719 #define UART_CR1_DEDT_ADDRESS_LSB_POS ((uint32_t) 16)
mbed_official 381:5460fc57b6e4 720 /**
mbed_official 381:5460fc57b6e4 721 * @}
mbed_official 381:5460fc57b6e4 722 */
mbed_official 381:5460fc57b6e4 723
mbed_official 381:5460fc57b6e4 724 /** @defgroup UART_Interruption_Mask UART Interruptions Flag Mask
mbed_official 381:5460fc57b6e4 725 * @{
mbed_official 381:5460fc57b6e4 726 */
mbed_official 381:5460fc57b6e4 727 #define UART_IT_MASK ((uint32_t)0x001F)
mbed_official 381:5460fc57b6e4 728 /**
mbed_official 381:5460fc57b6e4 729 * @}
mbed_official 381:5460fc57b6e4 730 */
mbed_official 381:5460fc57b6e4 731
mbed_official 381:5460fc57b6e4 732 /** @defgroup UART_TimeOut_Value UART polling-based communications time-out value
mbed_official 381:5460fc57b6e4 733 * @{
mbed_official 381:5460fc57b6e4 734 */
mbed_official 381:5460fc57b6e4 735 #define HAL_UART_TIMEOUT_VALUE 0x1FFFFFF
mbed_official 381:5460fc57b6e4 736 /**
mbed_official 381:5460fc57b6e4 737 * @}
mbed_official 381:5460fc57b6e4 738 */
mbed_official 381:5460fc57b6e4 739
mbed_official 381:5460fc57b6e4 740 /**
mbed_official 381:5460fc57b6e4 741 * @}
mbed_official 381:5460fc57b6e4 742 */
mbed_official 381:5460fc57b6e4 743
mbed_official 381:5460fc57b6e4 744 /* Exported macros -----------------------------------------------------------*/
mbed_official 381:5460fc57b6e4 745 /** @defgroup UART_Exported_Macros UART Exported Macros
mbed_official 381:5460fc57b6e4 746 * @{
mbed_official 381:5460fc57b6e4 747 */
mbed_official 381:5460fc57b6e4 748
mbed_official 381:5460fc57b6e4 749 /** @brief Reset UART handle state
mbed_official 381:5460fc57b6e4 750 * @param __HANDLE__: UART handle.
mbed_official 381:5460fc57b6e4 751 * @retval None
mbed_official 381:5460fc57b6e4 752 */
mbed_official 381:5460fc57b6e4 753 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_UART_STATE_RESET)
mbed_official 381:5460fc57b6e4 754
mbed_official 381:5460fc57b6e4 755 /** @brief Checks whether the specified UART flag is set or not.
mbed_official 381:5460fc57b6e4 756 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 757 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 758 * UART peripheral (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 759 * @param __FLAG__: specifies the flag to check.
mbed_official 381:5460fc57b6e4 760 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 761 * @arg UART_FLAG_REACK: Receive enable ackowledge flag
mbed_official 381:5460fc57b6e4 762 * @arg UART_FLAG_TEACK: Transmit enable ackowledge flag
mbed_official 381:5460fc57b6e4 763 * @arg UART_FLAG_WUF: Wake up from stop mode flag
mbed_official 381:5460fc57b6e4 764 * @arg UART_FLAG_RWU: Receiver wake up flag (is the UART in mute mode)
mbed_official 381:5460fc57b6e4 765 * @arg UART_FLAG_SBKF: Send Break flag
mbed_official 381:5460fc57b6e4 766 * @arg UART_FLAG_CMF: Character match flag
mbed_official 381:5460fc57b6e4 767 * @arg UART_FLAG_BUSY: Busy flag
mbed_official 381:5460fc57b6e4 768 * @arg UART_FLAG_ABRF: Auto Baud rate detection flag
mbed_official 381:5460fc57b6e4 769 * @arg UART_FLAG_ABRE: Auto Baud rate detection error flag
mbed_official 381:5460fc57b6e4 770 * @arg UART_FLAG_EOBF: End of block flag
mbed_official 381:5460fc57b6e4 771 * @arg UART_FLAG_RTOF: Receiver timeout flag
mbed_official 381:5460fc57b6e4 772 * @arg UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5)
mbed_official 381:5460fc57b6e4 773 * @arg UART_FLAG_LBD: LIN Break detection flag
mbed_official 381:5460fc57b6e4 774 * @arg UART_FLAG_TXE: Transmit data register empty flag
mbed_official 381:5460fc57b6e4 775 * @arg UART_FLAG_TC: Transmission Complete flag
mbed_official 381:5460fc57b6e4 776 * @arg UART_FLAG_RXNE: Receive data register not empty flag
mbed_official 381:5460fc57b6e4 777 * @arg UART_FLAG_IDLE: Idle Line detection flag
mbed_official 381:5460fc57b6e4 778 * @arg UART_FLAG_ORE: OverRun Error flag
mbed_official 381:5460fc57b6e4 779 * @arg UART_FLAG_NE: Noise Error flag
mbed_official 381:5460fc57b6e4 780 * @arg UART_FLAG_FE: Framing Error flag
mbed_official 381:5460fc57b6e4 781 * @arg UART_FLAG_PE: Parity Error flag
mbed_official 381:5460fc57b6e4 782 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 381:5460fc57b6e4 783 */
mbed_official 381:5460fc57b6e4 784 #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
mbed_official 381:5460fc57b6e4 785
mbed_official 381:5460fc57b6e4 786 /** @brief Enables the specified UART interrupt.
mbed_official 381:5460fc57b6e4 787 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 788 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 789 * UART peripheral. (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 790 * @param __INTERRUPT__: specifies the UART interrupt source to enable.
mbed_official 381:5460fc57b6e4 791 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 792 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
mbed_official 381:5460fc57b6e4 793 * @arg UART_IT_CM: Character match interrupt
mbed_official 381:5460fc57b6e4 794 * @arg UART_IT_CTS: CTS change interrupt
mbed_official 381:5460fc57b6e4 795 * @arg UART_IT_LBD: LIN Break detection interrupt
mbed_official 381:5460fc57b6e4 796 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 381:5460fc57b6e4 797 * @arg UART_IT_TC: Transmission complete interrupt
mbed_official 381:5460fc57b6e4 798 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 381:5460fc57b6e4 799 * @arg UART_IT_IDLE: Idle line detection interrupt
mbed_official 381:5460fc57b6e4 800 * @arg UART_IT_PE: Parity Error interrupt
mbed_official 381:5460fc57b6e4 801 * @arg UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
mbed_official 381:5460fc57b6e4 802 * @retval None
mbed_official 381:5460fc57b6e4 803 */
mbed_official 381:5460fc57b6e4 804 #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
mbed_official 381:5460fc57b6e4 805 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
mbed_official 381:5460fc57b6e4 806 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))))
mbed_official 381:5460fc57b6e4 807
mbed_official 381:5460fc57b6e4 808
mbed_official 381:5460fc57b6e4 809 /** @brief Disables the specified UART interrupt.
mbed_official 381:5460fc57b6e4 810 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 811 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 812 * UART peripheral. (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 813 * @param __INTERRUPT__: specifies the UART interrupt source to disable.
mbed_official 381:5460fc57b6e4 814 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 815 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
mbed_official 381:5460fc57b6e4 816 * @arg UART_IT_CM: Character match interrupt
mbed_official 381:5460fc57b6e4 817 * @arg UART_IT_CTS: CTS change interrupt
mbed_official 381:5460fc57b6e4 818 * @arg UART_IT_LBD: LIN Break detection interrupt
mbed_official 381:5460fc57b6e4 819 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 381:5460fc57b6e4 820 * @arg UART_IT_TC: Transmission complete interrupt
mbed_official 381:5460fc57b6e4 821 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 381:5460fc57b6e4 822 * @arg UART_IT_IDLE: Idle line detection interrupt
mbed_official 381:5460fc57b6e4 823 * @arg UART_IT_PE: Parity Error interrupt
mbed_official 381:5460fc57b6e4 824 * @arg UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
mbed_official 381:5460fc57b6e4 825 * @retval None
mbed_official 381:5460fc57b6e4 826 */
mbed_official 381:5460fc57b6e4 827 #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
mbed_official 381:5460fc57b6e4 828 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
mbed_official 381:5460fc57b6e4 829 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))))
mbed_official 381:5460fc57b6e4 830
mbed_official 381:5460fc57b6e4 831 /** @brief Checks whether the specified UART interrupt has occurred or not.
mbed_official 381:5460fc57b6e4 832 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 833 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 834 * UART peripheral. (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 835 * @param __IT__: specifies the UART interrupt to check.
mbed_official 381:5460fc57b6e4 836 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 837 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
mbed_official 381:5460fc57b6e4 838 * @arg UART_IT_CM: Character match interrupt
mbed_official 381:5460fc57b6e4 839 * @arg UART_IT_CTS: CTS change interrupt (not available for UART4 and UART5)
mbed_official 381:5460fc57b6e4 840 * @arg UART_IT_LBD: LIN Break detection interrupt
mbed_official 381:5460fc57b6e4 841 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 381:5460fc57b6e4 842 * @arg UART_IT_TC: Transmission complete interrupt
mbed_official 381:5460fc57b6e4 843 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 381:5460fc57b6e4 844 * @arg UART_IT_IDLE: Idle line detection interrupt
mbed_official 381:5460fc57b6e4 845 * @arg UART_IT_ORE: OverRun Error interrupt
mbed_official 381:5460fc57b6e4 846 * @arg UART_IT_NE: Noise Error interrupt
mbed_official 381:5460fc57b6e4 847 * @arg UART_IT_FE: Framing Error interrupt
mbed_official 381:5460fc57b6e4 848 * @arg UART_IT_PE: Parity Error interrupt
mbed_official 381:5460fc57b6e4 849 * @retval The new state of __IT__ (TRUE or FALSE).
mbed_official 381:5460fc57b6e4 850 */
mbed_official 381:5460fc57b6e4 851 #define __HAL_UART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08)))
mbed_official 381:5460fc57b6e4 852
mbed_official 381:5460fc57b6e4 853 /** @brief Checks whether the specified UART interrupt source is enabled.
mbed_official 381:5460fc57b6e4 854 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 855 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 856 * UART peripheral. (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 857 * @param __IT__: specifies the UART interrupt source to check.
mbed_official 381:5460fc57b6e4 858 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 859 * @arg UART_IT_CTS: CTS change interrupt (not available for UART4 and UART5)
mbed_official 381:5460fc57b6e4 860 * @arg UART_IT_LBD: LIN Break detection interrupt
mbed_official 381:5460fc57b6e4 861 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 381:5460fc57b6e4 862 * @arg UART_IT_TC: Transmission complete interrupt
mbed_official 381:5460fc57b6e4 863 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 381:5460fc57b6e4 864 * @arg UART_IT_IDLE: Idle line detection interrupt
mbed_official 381:5460fc57b6e4 865 * @arg UART_IT_ORE: OverRun Error interrupt
mbed_official 381:5460fc57b6e4 866 * @arg UART_IT_NE: Noise Error interrupt
mbed_official 381:5460fc57b6e4 867 * @arg UART_IT_FE: Framing Error interrupt
mbed_official 381:5460fc57b6e4 868 * @arg UART_IT_PE: Parity Error interrupt
mbed_official 381:5460fc57b6e4 869 * @retval The new state of __IT__ (TRUE or FALSE).
mbed_official 381:5460fc57b6e4 870 */
mbed_official 381:5460fc57b6e4 871 #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2)? \
mbed_official 381:5460fc57b6e4 872 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & UART_IT_MASK)))
mbed_official 381:5460fc57b6e4 873
mbed_official 381:5460fc57b6e4 874 /** @brief Clears the specified UART ISR flag, in setting the proper ICR register flag.
mbed_official 381:5460fc57b6e4 875 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 876 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 877 * UART peripheral. (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 878 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
mbed_official 381:5460fc57b6e4 879 * to clear the corresponding interrupt
mbed_official 381:5460fc57b6e4 880 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 881 * @arg UART_CLEAR_PEF: Parity Error Clear Flag
mbed_official 381:5460fc57b6e4 882 * @arg UART_CLEAR_FEF: Framing Error Clear Flag
mbed_official 381:5460fc57b6e4 883 * @arg UART_CLEAR_NEF: Noise detected Clear Flag
mbed_official 381:5460fc57b6e4 884 * @arg UART_CLEAR_OREF: OverRun Error Clear Flag
mbed_official 381:5460fc57b6e4 885 * @arg UART_CLEAR_IDLEF: IDLE line detected Clear Flag
mbed_official 381:5460fc57b6e4 886 * @arg UART_CLEAR_TCF: Transmission Complete Clear Flag
mbed_official 381:5460fc57b6e4 887 * @arg UART_CLEAR_LBDF: LIN Break Detection Clear Flag
mbed_official 381:5460fc57b6e4 888 * @arg UART_CLEAR_CTSF: CTS Interrupt Clear Flag
mbed_official 381:5460fc57b6e4 889 * @arg UART_CLEAR_RTOF: Receiver Time Out Clear Flag
mbed_official 381:5460fc57b6e4 890 * @arg UART_CLEAR_EOBF: End Of Block Clear Flag
mbed_official 381:5460fc57b6e4 891 * @arg UART_CLEAR_CMF: Character Match Clear Flag
mbed_official 381:5460fc57b6e4 892 * @arg UART_CLEAR_WUF: Wake Up from stop mode Clear Flag
mbed_official 381:5460fc57b6e4 893 * @retval None
mbed_official 381:5460fc57b6e4 894 */
mbed_official 381:5460fc57b6e4 895 #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
mbed_official 381:5460fc57b6e4 896
mbed_official 381:5460fc57b6e4 897 /** @brief Set a specific UART request flag.
mbed_official 381:5460fc57b6e4 898 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 899 * This parameter can be UARTx where x: 1, 2, 3, 4, 5 to select the USART or
mbed_official 381:5460fc57b6e4 900 * UART peripheral. (datasheet: up to five USART/UARTs)
mbed_official 381:5460fc57b6e4 901 * @param __REQ__: specifies the request flag to set
mbed_official 381:5460fc57b6e4 902 * This parameter can be one of the following values:
mbed_official 381:5460fc57b6e4 903 * @arg UART_AUTOBAUD_REQUEST: Auto-Baud Rate Request
mbed_official 381:5460fc57b6e4 904 * @arg UART_SENDBREAK_REQUEST: Send Break Request
mbed_official 381:5460fc57b6e4 905 * @arg UART_MUTE_MODE_REQUEST: Mute Mode Request
mbed_official 381:5460fc57b6e4 906 * @arg UART_RXDATA_FLUSH_REQUEST: Receive Data flush Request
mbed_official 381:5460fc57b6e4 907 * @arg UART_TXDATA_FLUSH_REQUEST: Transmit data flush Request
mbed_official 381:5460fc57b6e4 908 * @retval None
mbed_official 381:5460fc57b6e4 909 */
mbed_official 381:5460fc57b6e4 910 #define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint32_t)(__REQ__))
mbed_official 381:5460fc57b6e4 911
mbed_official 381:5460fc57b6e4 912 /** @brief Enable UART
mbed_official 381:5460fc57b6e4 913 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 914 * The Handle Instance can be UARTx where x: 1, 2, 3, 4 or 5 to select the UART peripheral
mbed_official 381:5460fc57b6e4 915 * @retval None
mbed_official 381:5460fc57b6e4 916 */
mbed_official 381:5460fc57b6e4 917 #define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
mbed_official 381:5460fc57b6e4 918
mbed_official 381:5460fc57b6e4 919 /** @brief Disable UART
mbed_official 381:5460fc57b6e4 920 * @param __HANDLE__: specifies the UART Handle.
mbed_official 381:5460fc57b6e4 921 * The Handle Instance can be UARTx where x: 1, 2, 3, 4 or 5 to select the UART peripheral
mbed_official 381:5460fc57b6e4 922 * @retval None
mbed_official 381:5460fc57b6e4 923 */
mbed_official 381:5460fc57b6e4 924 #define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
mbed_official 381:5460fc57b6e4 925
mbed_official 381:5460fc57b6e4 926 /** @brief BRR division operation to set BRR register in 8-bit oversampling mode
mbed_official 381:5460fc57b6e4 927 * @param _PCLK_: UART clock
mbed_official 381:5460fc57b6e4 928 * @param _BAUD_: Baud rate set by the user
mbed_official 381:5460fc57b6e4 929 * @retval Division result
mbed_official 381:5460fc57b6e4 930 */
mbed_official 381:5460fc57b6e4 931 #define __DIV_SAMPLING8(_PCLK_, _BAUD_) (((_PCLK_)*2)/((_BAUD_)))
mbed_official 381:5460fc57b6e4 932
mbed_official 381:5460fc57b6e4 933 /** @brief BRR division operation to set BRR register in 16-bit oversampling mode
mbed_official 381:5460fc57b6e4 934 * @param _PCLK_: UART clock
mbed_official 381:5460fc57b6e4 935 * @param _BAUD_: Baud rate set by the user
mbed_official 381:5460fc57b6e4 936 * @retval Division result
mbed_official 381:5460fc57b6e4 937 */
mbed_official 381:5460fc57b6e4 938 #define __DIV_SAMPLING16(_PCLK_, _BAUD_) (((_PCLK_))/((_BAUD_)))
mbed_official 381:5460fc57b6e4 939
mbed_official 381:5460fc57b6e4 940 /** @brief Check UART Baud rate
mbed_official 381:5460fc57b6e4 941 * @param BAUDRATE: Baudrate specified by the user
mbed_official 381:5460fc57b6e4 942 * The maximum Baud Rate is derived from the maximum clock on F3 (i.e. 72 MHz)
mbed_official 381:5460fc57b6e4 943 * divided by the smallest oversampling used on the USART (i.e. 8)
mbed_official 381:5460fc57b6e4 944 * @retval Test result (TRUE or FALSE).
mbed_official 381:5460fc57b6e4 945 */
mbed_official 381:5460fc57b6e4 946 #define IS_UART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 9000001)
mbed_official 381:5460fc57b6e4 947
mbed_official 381:5460fc57b6e4 948 /** @brief Check UART assertion time
mbed_official 381:5460fc57b6e4 949 * @param TIME: 5-bit value assertion time
mbed_official 381:5460fc57b6e4 950 * @retval Test result (TRUE or FALSE).
mbed_official 381:5460fc57b6e4 951 */
mbed_official 381:5460fc57b6e4 952 #define IS_UART_ASSERTIONTIME(TIME) ((TIME) <= 0x1F)
mbed_official 381:5460fc57b6e4 953
mbed_official 381:5460fc57b6e4 954 /** @brief Check UART deassertion time
mbed_official 381:5460fc57b6e4 955 * @param TIME: 5-bit value deassertion time
mbed_official 381:5460fc57b6e4 956 * @retval Test result (TRUE or FALSE).
mbed_official 381:5460fc57b6e4 957 */
mbed_official 381:5460fc57b6e4 958 #define IS_UART_DEASSERTIONTIME(TIME) ((TIME) <= 0x1F)
mbed_official 381:5460fc57b6e4 959
mbed_official 381:5460fc57b6e4 960 /**
mbed_official 381:5460fc57b6e4 961 * @}
mbed_official 381:5460fc57b6e4 962 */
mbed_official 381:5460fc57b6e4 963
mbed_official 381:5460fc57b6e4 964 /* Include UART HAL Extended module */
mbed_official 381:5460fc57b6e4 965 #include "stm32f3xx_hal_uart_ex.h"
mbed_official 381:5460fc57b6e4 966
mbed_official 381:5460fc57b6e4 967 /* Exported functions --------------------------------------------------------*/
mbed_official 381:5460fc57b6e4 968 /** @addtogroup UART_Exported_Functions UART Exported Functions
mbed_official 381:5460fc57b6e4 969 * @{
mbed_official 381:5460fc57b6e4 970 */
mbed_official 381:5460fc57b6e4 971
mbed_official 381:5460fc57b6e4 972 /** @addtogroup UART_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 381:5460fc57b6e4 973 * @brief Initialization and Configuration functions
mbed_official 381:5460fc57b6e4 974 * @{
mbed_official 381:5460fc57b6e4 975 */
mbed_official 381:5460fc57b6e4 976 /* Initialization and de-initialization functions ****************************/
mbed_official 381:5460fc57b6e4 977 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 978 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 979 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
mbed_official 381:5460fc57b6e4 980 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
mbed_official 381:5460fc57b6e4 981 HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 982 void HAL_UART_MspInit(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 983 void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 984 /**
mbed_official 381:5460fc57b6e4 985 * @}
mbed_official 381:5460fc57b6e4 986 */
mbed_official 381:5460fc57b6e4 987
mbed_official 381:5460fc57b6e4 988 /** @addtogroup UART_Exported_Functions_Group2 Input and Output operation functions
mbed_official 381:5460fc57b6e4 989 * @brief UART Transmit/Receive functions
mbed_official 381:5460fc57b6e4 990 * @{
mbed_official 381:5460fc57b6e4 991 */
mbed_official 381:5460fc57b6e4 992 /* IO operation functions *****************************************************/
mbed_official 381:5460fc57b6e4 993 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 381:5460fc57b6e4 994 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 381:5460fc57b6e4 995 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
mbed_official 381:5460fc57b6e4 996 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
mbed_official 381:5460fc57b6e4 997 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
mbed_official 381:5460fc57b6e4 998 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
mbed_official 381:5460fc57b6e4 999 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1000 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1001 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1002 void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1003 void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1004 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1005 void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1006 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1007 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1008 void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1009
mbed_official 381:5460fc57b6e4 1010 HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Timeout);
mbed_official 381:5460fc57b6e4 1011 /**
mbed_official 381:5460fc57b6e4 1012 * @}
mbed_official 381:5460fc57b6e4 1013 */
mbed_official 381:5460fc57b6e4 1014
mbed_official 381:5460fc57b6e4 1015 /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions
mbed_official 381:5460fc57b6e4 1016 * @brief UART control functions
mbed_official 381:5460fc57b6e4 1017 * @{
mbed_official 381:5460fc57b6e4 1018 */
mbed_official 381:5460fc57b6e4 1019 /* Peripheral Control functions ***********************************************/
mbed_official 381:5460fc57b6e4 1020 HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1021 HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1022 void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1023 HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1024 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1025 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1026 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1027
mbed_official 381:5460fc57b6e4 1028 HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1029 void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1030 void UART_Wakeup_AddressConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
mbed_official 381:5460fc57b6e4 1031 /**
mbed_official 381:5460fc57b6e4 1032 * @}
mbed_official 381:5460fc57b6e4 1033 */
mbed_official 381:5460fc57b6e4 1034
mbed_official 381:5460fc57b6e4 1035 /** @addtogroup UART_Exported_Functions_Group4 Peripheral State and Error functions
mbed_official 381:5460fc57b6e4 1036 * @brief Peripheral State and Error functions
mbed_official 381:5460fc57b6e4 1037 * @{
mbed_official 381:5460fc57b6e4 1038 */
mbed_official 381:5460fc57b6e4 1039 /* Peripheral State and Error functions ***************************************/
mbed_official 381:5460fc57b6e4 1040 HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1041 uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
mbed_official 381:5460fc57b6e4 1042 /**
mbed_official 381:5460fc57b6e4 1043 * @}
mbed_official 381:5460fc57b6e4 1044 */
mbed_official 381:5460fc57b6e4 1045
mbed_official 381:5460fc57b6e4 1046 /**
mbed_official 381:5460fc57b6e4 1047 * @}
mbed_official 381:5460fc57b6e4 1048 */
mbed_official 381:5460fc57b6e4 1049
mbed_official 381:5460fc57b6e4 1050 /**
mbed_official 381:5460fc57b6e4 1051 * @}
mbed_official 381:5460fc57b6e4 1052 */
mbed_official 381:5460fc57b6e4 1053
mbed_official 381:5460fc57b6e4 1054 /**
mbed_official 381:5460fc57b6e4 1055 * @}
mbed_official 381:5460fc57b6e4 1056 */
mbed_official 381:5460fc57b6e4 1057
mbed_official 381:5460fc57b6e4 1058 #ifdef __cplusplus
mbed_official 381:5460fc57b6e4 1059 }
mbed_official 381:5460fc57b6e4 1060 #endif
mbed_official 381:5460fc57b6e4 1061
mbed_official 381:5460fc57b6e4 1062 #endif /* __STM32F3xx_HAL_UART_H */
mbed_official 381:5460fc57b6e4 1063
mbed_official 381:5460fc57b6e4 1064 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/