mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
93:e188a91d3eaa
remove SerialHalfDuplex.h

Who changed what in which revision?

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