my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
92:4fc01daae5a5
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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