Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
Release 107  of the mbed library

Changes:
- new platforms - DISCO_F746NG, DISCO_L476VG, NUCLEO_L476RG
- KL43Z - bugfix RTC init function
- K20 - SPI mode fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 107:4f6c30876dfa 1 /**
Kojto 107:4f6c30876dfa 2 ******************************************************************************
Kojto 107:4f6c30876dfa 3 * @file stm32l4xx_hal_uart.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.0
Kojto 107:4f6c30876dfa 6 * @date 26-June-2015
Kojto 107:4f6c30876dfa 7 * @brief Header file of UART HAL module.
Kojto 107:4f6c30876dfa 8 ******************************************************************************
Kojto 107:4f6c30876dfa 9 * @attention
Kojto 107:4f6c30876dfa 10 *
Kojto 107:4f6c30876dfa 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 107:4f6c30876dfa 12 *
Kojto 107:4f6c30876dfa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 107:4f6c30876dfa 14 * are permitted provided that the following conditions are met:
Kojto 107:4f6c30876dfa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 107:4f6c30876dfa 16 * this list of conditions and the following disclaimer.
Kojto 107:4f6c30876dfa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 107:4f6c30876dfa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 107:4f6c30876dfa 19 * and/or other materials provided with the distribution.
Kojto 107:4f6c30876dfa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 107:4f6c30876dfa 21 * may be used to endorse or promote products derived from this software
Kojto 107:4f6c30876dfa 22 * without specific prior written permission.
Kojto 107:4f6c30876dfa 23 *
Kojto 107:4f6c30876dfa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 107:4f6c30876dfa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 107:4f6c30876dfa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 107:4f6c30876dfa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 107:4f6c30876dfa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 107:4f6c30876dfa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 107:4f6c30876dfa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 107:4f6c30876dfa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 107:4f6c30876dfa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 107:4f6c30876dfa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 107:4f6c30876dfa 34 *
Kojto 107:4f6c30876dfa 35 ******************************************************************************
Kojto 107:4f6c30876dfa 36 */
Kojto 107:4f6c30876dfa 37
Kojto 107:4f6c30876dfa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 107:4f6c30876dfa 39 #ifndef __STM32L4xx_HAL_UART_H
Kojto 107:4f6c30876dfa 40 #define __STM32L4xx_HAL_UART_H
Kojto 107:4f6c30876dfa 41
Kojto 107:4f6c30876dfa 42 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 43 extern "C" {
Kojto 107:4f6c30876dfa 44 #endif
Kojto 107:4f6c30876dfa 45
Kojto 107:4f6c30876dfa 46 /* Includes ------------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 47 #include "stm32l4xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32L4xx_HAL_Driver
Kojto 107:4f6c30876dfa 50 * @{
Kojto 107:4f6c30876dfa 51 */
Kojto 107:4f6c30876dfa 52
Kojto 107:4f6c30876dfa 53 /** @addtogroup UART
Kojto 107:4f6c30876dfa 54 * @{
Kojto 107:4f6c30876dfa 55 */
Kojto 107:4f6c30876dfa 56
Kojto 107:4f6c30876dfa 57 /* Exported types ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 58 /** @defgroup UART_Exported_Types UART Exported Types
Kojto 107:4f6c30876dfa 59 * @{
Kojto 107:4f6c30876dfa 60 */
Kojto 107:4f6c30876dfa 61
Kojto 107:4f6c30876dfa 62 /**
Kojto 107:4f6c30876dfa 63 * @brief UART Init Structure definition
Kojto 107:4f6c30876dfa 64 */
Kojto 107:4f6c30876dfa 65 typedef struct
Kojto 107:4f6c30876dfa 66 {
Kojto 107:4f6c30876dfa 67 uint32_t BaudRate; /*!< This member configures the UART communication baud rate.
Kojto 107:4f6c30876dfa 68 The baud rate register is computed using the following formula:
Kojto 107:4f6c30876dfa 69 - If oversampling is 16 or in LIN mode,
Kojto 107:4f6c30876dfa 70 Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate)))
Kojto 107:4f6c30876dfa 71 - If oversampling is 8,
Kojto 107:4f6c30876dfa 72 - - Baud Rate Register[15:4] = ((2 * PCLKx) / ((huart->Init.BaudRate)))[15:4]
Kojto 107:4f6c30876dfa 73 - - Baud Rate Register[3] = 0
Kojto 107:4f6c30876dfa 74 - - Baud Rate Register[2:0] = (((2 * PCLKx) / ((huart->Init.BaudRate)))[3:0]) >> 1 */
Kojto 107:4f6c30876dfa 75
Kojto 107:4f6c30876dfa 76 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
Kojto 107:4f6c30876dfa 77 This parameter can be a value of @ref UARTEx_Word_Length. */
Kojto 107:4f6c30876dfa 78
Kojto 107:4f6c30876dfa 79 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
Kojto 107:4f6c30876dfa 80 This parameter can be a value of @ref UART_Stop_Bits. */
Kojto 107:4f6c30876dfa 81
Kojto 107:4f6c30876dfa 82 uint32_t Parity; /*!< Specifies the parity mode.
Kojto 107:4f6c30876dfa 83 This parameter can be a value of @ref UART_Parity
Kojto 107:4f6c30876dfa 84 @note When parity is enabled, the computed parity is inserted
Kojto 107:4f6c30876dfa 85 at the MSB position of the transmitted data (9th bit when
Kojto 107:4f6c30876dfa 86 the word length is set to 9 data bits; 8th bit when the
Kojto 107:4f6c30876dfa 87 word length is set to 8 data bits). */
Kojto 107:4f6c30876dfa 88
Kojto 107:4f6c30876dfa 89 uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
Kojto 107:4f6c30876dfa 90 This parameter can be a value of @ref UART_Mode. */
Kojto 107:4f6c30876dfa 91
Kojto 107:4f6c30876dfa 92 uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled
Kojto 107:4f6c30876dfa 93 or disabled.
Kojto 107:4f6c30876dfa 94 This parameter can be a value of @ref UART_Hardware_Flow_Control. */
Kojto 107:4f6c30876dfa 95
Kojto 107:4f6c30876dfa 96 uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to f_PCLK/8).
Kojto 107:4f6c30876dfa 97 This parameter can be a value of @ref UART_Over_Sampling. */
Kojto 107:4f6c30876dfa 98
Kojto 107:4f6c30876dfa 99 uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected.
Kojto 107:4f6c30876dfa 100 Selecting the single sample method increases the receiver tolerance to clock
Kojto 107:4f6c30876dfa 101 deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */
Kojto 107:4f6c30876dfa 102 }UART_InitTypeDef;
Kojto 107:4f6c30876dfa 103
Kojto 107:4f6c30876dfa 104 /**
Kojto 107:4f6c30876dfa 105 * @brief UART Advanced Features initalization structure definition
Kojto 107:4f6c30876dfa 106 */
Kojto 107:4f6c30876dfa 107 typedef struct
Kojto 107:4f6c30876dfa 108 {
Kojto 107:4f6c30876dfa 109 uint32_t AdvFeatureInit; /*!< Specifies which advanced UART features is initialized. Several
Kojto 107:4f6c30876dfa 110 Advanced Features may be initialized at the same time .
Kojto 107:4f6c30876dfa 111 This parameter can be a value of @ref UART_Advanced_Features_Initialization_Type. */
Kojto 107:4f6c30876dfa 112
Kojto 107:4f6c30876dfa 113 uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted.
Kojto 107:4f6c30876dfa 114 This parameter can be a value of @ref UART_Tx_Inv. */
Kojto 107:4f6c30876dfa 115
Kojto 107:4f6c30876dfa 116 uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted.
Kojto 107:4f6c30876dfa 117 This parameter can be a value of @ref UART_Rx_Inv. */
Kojto 107:4f6c30876dfa 118
Kojto 107:4f6c30876dfa 119 uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic
Kojto 107:4f6c30876dfa 120 vs negative/inverted logic).
Kojto 107:4f6c30876dfa 121 This parameter can be a value of @ref UART_Data_Inv. */
Kojto 107:4f6c30876dfa 122
Kojto 107:4f6c30876dfa 123 uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped.
Kojto 107:4f6c30876dfa 124 This parameter can be a value of @ref UART_Rx_Tx_Swap. */
Kojto 107:4f6c30876dfa 125
Kojto 107:4f6c30876dfa 126 uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled.
Kojto 107:4f6c30876dfa 127 This parameter can be a value of @ref UART_Overrun_Disable. */
Kojto 107:4f6c30876dfa 128
Kojto 107:4f6c30876dfa 129 uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error.
Kojto 107:4f6c30876dfa 130 This parameter can be a value of @ref UART_DMA_Disable_on_Rx_Error. */
Kojto 107:4f6c30876dfa 131
Kojto 107:4f6c30876dfa 132 uint32_t AutoBaudRateEnable; /*!< Specifies whether auto Baud rate detection is enabled.
Kojto 107:4f6c30876dfa 133 This parameter can be a value of @ref UART_AutoBaudRate_Enable */
Kojto 107:4f6c30876dfa 134
Kojto 107:4f6c30876dfa 135 uint32_t AutoBaudRateMode; /*!< If auto Baud rate detection is enabled, specifies how the rate
Kojto 107:4f6c30876dfa 136 detection is carried out.
Kojto 107:4f6c30876dfa 137 This parameter can be a value of @ref UART_AutoBaud_Rate_Mode. */
Kojto 107:4f6c30876dfa 138
Kojto 107:4f6c30876dfa 139 uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line.
Kojto 107:4f6c30876dfa 140 This parameter can be a value of @ref UART_MSB_First. */
Kojto 107:4f6c30876dfa 141 } UART_AdvFeatureInitTypeDef;
Kojto 107:4f6c30876dfa 142
Kojto 107:4f6c30876dfa 143
Kojto 107:4f6c30876dfa 144
Kojto 107:4f6c30876dfa 145 /**
Kojto 107:4f6c30876dfa 146 * @brief HAL UART State structures definition
Kojto 107:4f6c30876dfa 147 */
Kojto 107:4f6c30876dfa 148 typedef enum
Kojto 107:4f6c30876dfa 149 {
Kojto 107:4f6c30876dfa 150 HAL_UART_STATE_RESET = 0x00, /*!< Peripheral is not initialized */
Kojto 107:4f6c30876dfa 151 HAL_UART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 107:4f6c30876dfa 152 HAL_UART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
Kojto 107:4f6c30876dfa 153 HAL_UART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
Kojto 107:4f6c30876dfa 154 HAL_UART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
Kojto 107:4f6c30876dfa 155 HAL_UART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
Kojto 107:4f6c30876dfa 156 HAL_UART_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 107:4f6c30876dfa 157 HAL_UART_STATE_ERROR = 0x04 /*!< Error */
Kojto 107:4f6c30876dfa 158 }HAL_UART_StateTypeDef;
Kojto 107:4f6c30876dfa 159
Kojto 107:4f6c30876dfa 160 /**
Kojto 107:4f6c30876dfa 161 * @brief HAL UART Error Code structure definition
Kojto 107:4f6c30876dfa 162 */
Kojto 107:4f6c30876dfa 163 typedef enum
Kojto 107:4f6c30876dfa 164 {
Kojto 107:4f6c30876dfa 165 HAL_UART_ERROR_NONE = 0x00, /*!< No error */
Kojto 107:4f6c30876dfa 166 HAL_UART_ERROR_PE = 0x01, /*!< Parity error */
Kojto 107:4f6c30876dfa 167 HAL_UART_ERROR_NE = 0x02, /*!< Noise error */
Kojto 107:4f6c30876dfa 168 HAL_UART_ERROR_FE = 0x04, /*!< frame error */
Kojto 107:4f6c30876dfa 169 HAL_UART_ERROR_ORE = 0x08, /*!< Overrun error */
Kojto 107:4f6c30876dfa 170 HAL_UART_ERROR_DMA = 0x10 /*!< DMA transfer error */
Kojto 107:4f6c30876dfa 171 }HAL_UART_ErrorTypeDef;
Kojto 107:4f6c30876dfa 172
Kojto 107:4f6c30876dfa 173 /**
Kojto 107:4f6c30876dfa 174 * @brief UART clock sources definition
Kojto 107:4f6c30876dfa 175 */
Kojto 107:4f6c30876dfa 176 typedef enum
Kojto 107:4f6c30876dfa 177 {
Kojto 107:4f6c30876dfa 178 UART_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */
Kojto 107:4f6c30876dfa 179 UART_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */
Kojto 107:4f6c30876dfa 180 UART_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */
Kojto 107:4f6c30876dfa 181 UART_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */
Kojto 107:4f6c30876dfa 182 UART_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */
Kojto 107:4f6c30876dfa 183 UART_CLOCKSOURCE_UNDEFINED = 0x10 /*!< Undefined clock source */
Kojto 107:4f6c30876dfa 184 }UART_ClockSourceTypeDef;
Kojto 107:4f6c30876dfa 185
Kojto 107:4f6c30876dfa 186 /**
Kojto 107:4f6c30876dfa 187 * @brief UART handle Structure definition
Kojto 107:4f6c30876dfa 188 */
Kojto 107:4f6c30876dfa 189 typedef struct
Kojto 107:4f6c30876dfa 190 {
Kojto 107:4f6c30876dfa 191 USART_TypeDef *Instance; /*!< UART registers base address */
Kojto 107:4f6c30876dfa 192
Kojto 107:4f6c30876dfa 193 UART_InitTypeDef Init; /*!< UART communication parameters */
Kojto 107:4f6c30876dfa 194
Kojto 107:4f6c30876dfa 195 UART_AdvFeatureInitTypeDef AdvancedInit; /*!< UART Advanced Features initialization parameters */
Kojto 107:4f6c30876dfa 196
Kojto 107:4f6c30876dfa 197 uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */
Kojto 107:4f6c30876dfa 198
Kojto 107:4f6c30876dfa 199 uint16_t TxXferSize; /*!< UART Tx Transfer size */
Kojto 107:4f6c30876dfa 200
Kojto 107:4f6c30876dfa 201 uint16_t TxXferCount; /*!< UART Tx Transfer Counter */
Kojto 107:4f6c30876dfa 202
Kojto 107:4f6c30876dfa 203 uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */
Kojto 107:4f6c30876dfa 204
Kojto 107:4f6c30876dfa 205 uint16_t RxXferSize; /*!< UART Rx Transfer size */
Kojto 107:4f6c30876dfa 206
Kojto 107:4f6c30876dfa 207 uint16_t RxXferCount; /*!< UART Rx Transfer Counter */
Kojto 107:4f6c30876dfa 208
Kojto 107:4f6c30876dfa 209 uint16_t Mask; /*!< UART Rx RDR register mask */
Kojto 107:4f6c30876dfa 210
Kojto 107:4f6c30876dfa 211 DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */
Kojto 107:4f6c30876dfa 212
Kojto 107:4f6c30876dfa 213 DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */
Kojto 107:4f6c30876dfa 214
Kojto 107:4f6c30876dfa 215 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 107:4f6c30876dfa 216
Kojto 107:4f6c30876dfa 217 __IO HAL_UART_StateTypeDef State; /*!< UART communication state */
Kojto 107:4f6c30876dfa 218
Kojto 107:4f6c30876dfa 219 __IO uint32_t ErrorCode; /*!< UART Error code */
Kojto 107:4f6c30876dfa 220
Kojto 107:4f6c30876dfa 221 }UART_HandleTypeDef;
Kojto 107:4f6c30876dfa 222
Kojto 107:4f6c30876dfa 223 /**
Kojto 107:4f6c30876dfa 224 * @}
Kojto 107:4f6c30876dfa 225 */
Kojto 107:4f6c30876dfa 226
Kojto 107:4f6c30876dfa 227 /* Exported constants --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 228 /** @defgroup UART_Exported_Constants UART Exported Constants
Kojto 107:4f6c30876dfa 229 * @{
Kojto 107:4f6c30876dfa 230 */
Kojto 107:4f6c30876dfa 231
Kojto 107:4f6c30876dfa 232 /** @defgroup UART_Stop_Bits UART Number of Stop Bits
Kojto 107:4f6c30876dfa 233 * @{
Kojto 107:4f6c30876dfa 234 */
Kojto 107:4f6c30876dfa 235 #define UART_STOPBITS_1 ((uint32_t)0x00000000) /*!< UART frame with 1 stop bit */
Kojto 107:4f6c30876dfa 236 #define UART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) /*!< UART frame with 1.5 stop bits */
Kojto 107:4f6c30876dfa 237 #define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) /*!< UART frame with 2 stop bits */
Kojto 107:4f6c30876dfa 238 /**
Kojto 107:4f6c30876dfa 239 * @}
Kojto 107:4f6c30876dfa 240 */
Kojto 107:4f6c30876dfa 241
Kojto 107:4f6c30876dfa 242 /** @defgroup UART_Parity UART Parity
Kojto 107:4f6c30876dfa 243 * @{
Kojto 107:4f6c30876dfa 244 */
Kojto 107:4f6c30876dfa 245 #define UART_PARITY_NONE ((uint32_t)0x00000000) /*!< No parity */
Kojto 107:4f6c30876dfa 246 #define UART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) /*!< Even parity */
Kojto 107:4f6c30876dfa 247 #define UART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) /*!< Odd parity */
Kojto 107:4f6c30876dfa 248 /**
Kojto 107:4f6c30876dfa 249 * @}
Kojto 107:4f6c30876dfa 250 */
Kojto 107:4f6c30876dfa 251
Kojto 107:4f6c30876dfa 252 /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
Kojto 107:4f6c30876dfa 253 * @{
Kojto 107:4f6c30876dfa 254 */
Kojto 107:4f6c30876dfa 255 #define UART_HWCONTROL_NONE ((uint32_t)0x00000000) /*!< No hardware control */
Kojto 107:4f6c30876dfa 256 #define UART_HWCONTROL_RTS ((uint32_t)USART_CR3_RTSE) /*!< Request To Send */
Kojto 107:4f6c30876dfa 257 #define UART_HWCONTROL_CTS ((uint32_t)USART_CR3_CTSE) /*!< Clear To Send */
Kojto 107:4f6c30876dfa 258 #define UART_HWCONTROL_RTS_CTS ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE)) /*!< Request and Clear To Send */
Kojto 107:4f6c30876dfa 259 /**
Kojto 107:4f6c30876dfa 260 * @}
Kojto 107:4f6c30876dfa 261 */
Kojto 107:4f6c30876dfa 262
Kojto 107:4f6c30876dfa 263 /** @defgroup UART_Mode UART Transfer Mode
Kojto 107:4f6c30876dfa 264 * @{
Kojto 107:4f6c30876dfa 265 */
Kojto 107:4f6c30876dfa 266 #define UART_MODE_RX ((uint32_t)USART_CR1_RE) /*!< RX mode */
Kojto 107:4f6c30876dfa 267 #define UART_MODE_TX ((uint32_t)USART_CR1_TE) /*!< TX mode */
Kojto 107:4f6c30876dfa 268 #define UART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) /*!< RX and TX mode */
Kojto 107:4f6c30876dfa 269 /**
Kojto 107:4f6c30876dfa 270 * @}
Kojto 107:4f6c30876dfa 271 */
Kojto 107:4f6c30876dfa 272
Kojto 107:4f6c30876dfa 273 /** @defgroup UART_State UART State
Kojto 107:4f6c30876dfa 274 * @{
Kojto 107:4f6c30876dfa 275 */
Kojto 107:4f6c30876dfa 276 #define UART_STATE_DISABLE ((uint32_t)0x00000000) /*!< UART disabled */
Kojto 107:4f6c30876dfa 277 #define UART_STATE_ENABLE ((uint32_t)USART_CR1_UE) /*!< UART enabled */
Kojto 107:4f6c30876dfa 278 /**
Kojto 107:4f6c30876dfa 279 * @}
Kojto 107:4f6c30876dfa 280 */
Kojto 107:4f6c30876dfa 281
Kojto 107:4f6c30876dfa 282 /** @defgroup UART_Over_Sampling UART Over Sampling
Kojto 107:4f6c30876dfa 283 * @{
Kojto 107:4f6c30876dfa 284 */
Kojto 107:4f6c30876dfa 285 #define UART_OVERSAMPLING_16 ((uint32_t)0x00000000) /*!< Oversampling by 16 */
Kojto 107:4f6c30876dfa 286 #define UART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8) /*!< Oversampling by 8 */
Kojto 107:4f6c30876dfa 287 /**
Kojto 107:4f6c30876dfa 288 * @}
Kojto 107:4f6c30876dfa 289 */
Kojto 107:4f6c30876dfa 290
Kojto 107:4f6c30876dfa 291 /** @defgroup UART_OneBit_Sampling UART One Bit Sampling Method
Kojto 107:4f6c30876dfa 292 * @{
Kojto 107:4f6c30876dfa 293 */
Kojto 107:4f6c30876dfa 294 #define UART_ONE_BIT_SAMPLE_DISABLE ((uint32_t)0x00000000) /*!< One-bit sampling disable */
Kojto 107:4f6c30876dfa 295 #define UART_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT) /*!< One-bit sampling enable */
Kojto 107:4f6c30876dfa 296 /**
Kojto 107:4f6c30876dfa 297 * @}
Kojto 107:4f6c30876dfa 298 */
Kojto 107:4f6c30876dfa 299
Kojto 107:4f6c30876dfa 300 /** @defgroup UART_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode
Kojto 107:4f6c30876dfa 301 * @{
Kojto 107:4f6c30876dfa 302 */
Kojto 107:4f6c30876dfa 303 #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000) /*!< Auto Baud rate detection on start bit */
Kojto 107:4f6c30876dfa 304 #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) /*!< Auto Baud rate detection on falling edge */
Kojto 107:4f6c30876dfa 305 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1) /*!< Auto Baud rate detection on 0x7F frame detection */
Kojto 107:4f6c30876dfa 306 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME ((uint32_t)USART_CR2_ABRMODE) /*!< Auto Baud rate detection on 0x55 frame detection */
Kojto 107:4f6c30876dfa 307 /**
Kojto 107:4f6c30876dfa 308 * @}
Kojto 107:4f6c30876dfa 309 */
Kojto 107:4f6c30876dfa 310
Kojto 107:4f6c30876dfa 311 /** @defgroup UART_Receiver_TimeOut UART Receiver TimeOut
Kojto 107:4f6c30876dfa 312 * @{
Kojto 107:4f6c30876dfa 313 */
Kojto 107:4f6c30876dfa 314 #define UART_RECEIVER_TIMEOUT_DISABLE ((uint32_t)0x00000000) /*!< UART receiver timeout disable */
Kojto 107:4f6c30876dfa 315 #define UART_RECEIVER_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN) /*!< UART receiver timeout enable */
Kojto 107:4f6c30876dfa 316 /**
Kojto 107:4f6c30876dfa 317 * @}
Kojto 107:4f6c30876dfa 318 */
Kojto 107:4f6c30876dfa 319
Kojto 107:4f6c30876dfa 320 /** @defgroup UART_LIN UART Local Interconnection Network mode
Kojto 107:4f6c30876dfa 321 * @{
Kojto 107:4f6c30876dfa 322 */
Kojto 107:4f6c30876dfa 323 #define UART_LIN_DISABLE ((uint32_t)0x00000000) /*!< Local Interconnect Network disable */
Kojto 107:4f6c30876dfa 324 #define UART_LIN_ENABLE ((uint32_t)USART_CR2_LINEN) /*!< Local Interconnect Network enable */
Kojto 107:4f6c30876dfa 325 /**
Kojto 107:4f6c30876dfa 326 * @}
Kojto 107:4f6c30876dfa 327 */
Kojto 107:4f6c30876dfa 328
Kojto 107:4f6c30876dfa 329 /** @defgroup UART_LIN_Break_Detection UART LIN Break Detection
Kojto 107:4f6c30876dfa 330 * @{
Kojto 107:4f6c30876dfa 331 */
Kojto 107:4f6c30876dfa 332 #define UART_LINBREAKDETECTLENGTH_10B ((uint32_t)0x00000000) /*!< LIN 10-bit break detection length */
Kojto 107:4f6c30876dfa 333 #define UART_LINBREAKDETECTLENGTH_11B ((uint32_t)USART_CR2_LBDL) /*!< LIN 11-bit break detection length */
Kojto 107:4f6c30876dfa 334 /**
Kojto 107:4f6c30876dfa 335 * @}
Kojto 107:4f6c30876dfa 336 */
Kojto 107:4f6c30876dfa 337
Kojto 107:4f6c30876dfa 338 /** @defgroup UART_DMA_Tx UART DMA Tx
Kojto 107:4f6c30876dfa 339 * @{
Kojto 107:4f6c30876dfa 340 */
Kojto 107:4f6c30876dfa 341 #define UART_DMA_TX_DISABLE ((uint32_t)0x00000000) /*!< UART DMA TX disabled */
Kojto 107:4f6c30876dfa 342 #define UART_DMA_TX_ENABLE ((uint32_t)USART_CR3_DMAT) /*!< UART DMA TX enabled */
Kojto 107:4f6c30876dfa 343 /**
Kojto 107:4f6c30876dfa 344 * @}
Kojto 107:4f6c30876dfa 345 */
Kojto 107:4f6c30876dfa 346
Kojto 107:4f6c30876dfa 347 /** @defgroup UART_DMA_Rx UART DMA Rx
Kojto 107:4f6c30876dfa 348 * @{
Kojto 107:4f6c30876dfa 349 */
Kojto 107:4f6c30876dfa 350 #define UART_DMA_RX_DISABLE ((uint32_t)0x0000) /*!< UART DMA RX disabled */
Kojto 107:4f6c30876dfa 351 #define UART_DMA_RX_ENABLE ((uint32_t)USART_CR3_DMAR) /*!< UART DMA RX enabled */
Kojto 107:4f6c30876dfa 352 /**
Kojto 107:4f6c30876dfa 353 * @}
Kojto 107:4f6c30876dfa 354 */
Kojto 107:4f6c30876dfa 355
Kojto 107:4f6c30876dfa 356 /** @defgroup UART_Half_Duplex_Selection UART Half Duplex Selection
Kojto 107:4f6c30876dfa 357 * @{
Kojto 107:4f6c30876dfa 358 */
Kojto 107:4f6c30876dfa 359 #define UART_HALF_DUPLEX_DISABLE ((uint32_t)0x0000) /*!< UART half-duplex disabled */
Kojto 107:4f6c30876dfa 360 #define UART_HALF_DUPLEX_ENABLE ((uint32_t)USART_CR3_HDSEL) /*!< UART half-duplex enabled */
Kojto 107:4f6c30876dfa 361 /**
Kojto 107:4f6c30876dfa 362 * @}
Kojto 107:4f6c30876dfa 363 */
Kojto 107:4f6c30876dfa 364
Kojto 107:4f6c30876dfa 365 /** @defgroup UART_WakeUp_Methods UART WakeUp Methods
Kojto 107:4f6c30876dfa 366 * @{
Kojto 107:4f6c30876dfa 367 */
Kojto 107:4f6c30876dfa 368 #define UART_WAKEUPMETHOD_IDLELINE ((uint32_t)0x00000000) /*!< UART wake-up on idle line */
Kojto 107:4f6c30876dfa 369 #define UART_WAKEUPMETHOD_ADDRESSMARK ((uint32_t)USART_CR1_WAKE) /*!< UART wake-up on address mark */
Kojto 107:4f6c30876dfa 370 /**
Kojto 107:4f6c30876dfa 371 * @}
Kojto 107:4f6c30876dfa 372 */
Kojto 107:4f6c30876dfa 373
Kojto 107:4f6c30876dfa 374 /** @defgroup UART_Request_Parameters UART Request Parameters
Kojto 107:4f6c30876dfa 375 * @{
Kojto 107:4f6c30876dfa 376 */
Kojto 107:4f6c30876dfa 377 #define UART_AUTOBAUD_REQUEST ((uint32_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */
Kojto 107:4f6c30876dfa 378 #define UART_SENDBREAK_REQUEST ((uint32_t)USART_RQR_SBKRQ) /*!< Send Break Request */
Kojto 107:4f6c30876dfa 379 #define UART_MUTE_MODE_REQUEST ((uint32_t)USART_RQR_MMRQ) /*!< Mute Mode Request */
Kojto 107:4f6c30876dfa 380 #define UART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
Kojto 107:4f6c30876dfa 381 #define UART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
Kojto 107:4f6c30876dfa 382 /**
Kojto 107:4f6c30876dfa 383 * @}
Kojto 107:4f6c30876dfa 384 */
Kojto 107:4f6c30876dfa 385
Kojto 107:4f6c30876dfa 386 /** @defgroup UART_Advanced_Features_Initialization_Type UART Advanced Feature Initialization Type
Kojto 107:4f6c30876dfa 387 * @{
Kojto 107:4f6c30876dfa 388 */
Kojto 107:4f6c30876dfa 389 #define UART_ADVFEATURE_NO_INIT ((uint32_t)0x00000000) /*!< No advanced feature initialization */
Kojto 107:4f6c30876dfa 390 #define UART_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001) /*!< TX pin active level inversion */
Kojto 107:4f6c30876dfa 391 #define UART_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002) /*!< RX pin active level inversion */
Kojto 107:4f6c30876dfa 392 #define UART_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004) /*!< Binary data inversion */
Kojto 107:4f6c30876dfa 393 #define UART_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008) /*!< TX/RX pins swap */
Kojto 107:4f6c30876dfa 394 #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010) /*!< RX overrun disable */
Kojto 107:4f6c30876dfa 395 #define UART_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020) /*!< DMA disable on Reception Error */
Kojto 107:4f6c30876dfa 396 #define UART_ADVFEATURE_AUTOBAUDRATE_INIT ((uint32_t)0x00000040) /*!< Auto Baud rate detection initialization */
Kojto 107:4f6c30876dfa 397 #define UART_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080) /*!< Most significant bit sent/received first */
Kojto 107:4f6c30876dfa 398 /**
Kojto 107:4f6c30876dfa 399 * @}
Kojto 107:4f6c30876dfa 400 */
Kojto 107:4f6c30876dfa 401
Kojto 107:4f6c30876dfa 402 /** @defgroup UART_Tx_Inv UART Advanced Feature TX Pin Active Level Inversion
Kojto 107:4f6c30876dfa 403 * @{
Kojto 107:4f6c30876dfa 404 */
Kojto 107:4f6c30876dfa 405 #define UART_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000) /*!< TX pin active level inversion disable */
Kojto 107:4f6c30876dfa 406 #define UART_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV) /*!< TX pin active level inversion enable */
Kojto 107:4f6c30876dfa 407 /**
Kojto 107:4f6c30876dfa 408 * @}
Kojto 107:4f6c30876dfa 409 */
Kojto 107:4f6c30876dfa 410
Kojto 107:4f6c30876dfa 411 /** @defgroup UART_Rx_Inv UART Advanced Feature RX Pin Active Level Inversion
Kojto 107:4f6c30876dfa 412 * @{
Kojto 107:4f6c30876dfa 413 */
Kojto 107:4f6c30876dfa 414 #define UART_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000) /*!< RX pin active level inversion disable */
Kojto 107:4f6c30876dfa 415 #define UART_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV) /*!< RX pin active level inversion enable */
Kojto 107:4f6c30876dfa 416 /**
Kojto 107:4f6c30876dfa 417 * @}
Kojto 107:4f6c30876dfa 418 */
Kojto 107:4f6c30876dfa 419
Kojto 107:4f6c30876dfa 420 /** @defgroup UART_Data_Inv UART Advanced Feature Binary Data Inversion
Kojto 107:4f6c30876dfa 421 * @{
Kojto 107:4f6c30876dfa 422 */
Kojto 107:4f6c30876dfa 423 #define UART_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000) /*!< Binary data inversion disable */
Kojto 107:4f6c30876dfa 424 #define UART_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV) /*!< Binary data inversion enable */
Kojto 107:4f6c30876dfa 425 /**
Kojto 107:4f6c30876dfa 426 * @}
Kojto 107:4f6c30876dfa 427 */
Kojto 107:4f6c30876dfa 428
Kojto 107:4f6c30876dfa 429 /** @defgroup UART_Rx_Tx_Swap UART Advanced Feature RX TX Pins Swap
Kojto 107:4f6c30876dfa 430 * @{
Kojto 107:4f6c30876dfa 431 */
Kojto 107:4f6c30876dfa 432 #define UART_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000) /*!< TX/RX pins swap disable */
Kojto 107:4f6c30876dfa 433 #define UART_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP) /*!< TX/RX pins swap enable */
Kojto 107:4f6c30876dfa 434 /**
Kojto 107:4f6c30876dfa 435 * @}
Kojto 107:4f6c30876dfa 436 */
Kojto 107:4f6c30876dfa 437
Kojto 107:4f6c30876dfa 438 /** @defgroup UART_Overrun_Disable UART Advanced Feature Overrun Disable
Kojto 107:4f6c30876dfa 439 * @{
Kojto 107:4f6c30876dfa 440 */
Kojto 107:4f6c30876dfa 441 #define UART_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000) /*!< RX overrun enable */
Kojto 107:4f6c30876dfa 442 #define UART_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS) /*!< RX overrun disable */
Kojto 107:4f6c30876dfa 443 /**
Kojto 107:4f6c30876dfa 444 * @}
Kojto 107:4f6c30876dfa 445 */
Kojto 107:4f6c30876dfa 446
Kojto 107:4f6c30876dfa 447 /** @defgroup UART_AutoBaudRate_Enable UART Advanced Feature Auto BaudRate Enable
Kojto 107:4f6c30876dfa 448 * @{
Kojto 107:4f6c30876dfa 449 */
Kojto 107:4f6c30876dfa 450 #define UART_ADVFEATURE_AUTOBAUDRATE_DISABLE ((uint32_t)0x00000000) /*!< RX Auto Baud rate detection enable */
Kojto 107:4f6c30876dfa 451 #define UART_ADVFEATURE_AUTOBAUDRATE_ENABLE ((uint32_t)USART_CR2_ABREN) /*!< RX Auto Baud rate detection disable */
Kojto 107:4f6c30876dfa 452 /**
Kojto 107:4f6c30876dfa 453 * @}
Kojto 107:4f6c30876dfa 454 */
Kojto 107:4f6c30876dfa 455
Kojto 107:4f6c30876dfa 456 /** @defgroup UART_DMA_Disable_on_Rx_Error UART Advanced Feature DMA Disable On Rx Error
Kojto 107:4f6c30876dfa 457 * @{
Kojto 107:4f6c30876dfa 458 */
Kojto 107:4f6c30876dfa 459 #define UART_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000) /*!< DMA enable on Reception Error */
Kojto 107:4f6c30876dfa 460 #define UART_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE) /*!< DMA disable on Reception Error */
Kojto 107:4f6c30876dfa 461 /**
Kojto 107:4f6c30876dfa 462 * @}
Kojto 107:4f6c30876dfa 463 */
Kojto 107:4f6c30876dfa 464
Kojto 107:4f6c30876dfa 465 /** @defgroup UART_MSB_First UART Advanced Feature MSB First
Kojto 107:4f6c30876dfa 466 * @{
Kojto 107:4f6c30876dfa 467 */
Kojto 107:4f6c30876dfa 468 #define UART_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000) /*!< Most significant bit sent/received first disable */
Kojto 107:4f6c30876dfa 469 #define UART_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST) /*!< Most significant bit sent/received first enable */
Kojto 107:4f6c30876dfa 470 /**
Kojto 107:4f6c30876dfa 471 * @}
Kojto 107:4f6c30876dfa 472 */
Kojto 107:4f6c30876dfa 473
Kojto 107:4f6c30876dfa 474 /** @defgroup UART_Stop_Mode_Enable UART Advanced Feature Stop Mode Enable
Kojto 107:4f6c30876dfa 475 * @{
Kojto 107:4f6c30876dfa 476 */
Kojto 107:4f6c30876dfa 477 #define UART_ADVFEATURE_STOPMODE_DISABLE ((uint32_t)0x00000000) /*!< UART stop mode disable */
Kojto 107:4f6c30876dfa 478 #define UART_ADVFEATURE_STOPMODE_ENABLE ((uint32_t)USART_CR1_UESM) /*!< UART stop mode enable */
Kojto 107:4f6c30876dfa 479 /**
Kojto 107:4f6c30876dfa 480 * @}
Kojto 107:4f6c30876dfa 481 */
Kojto 107:4f6c30876dfa 482
Kojto 107:4f6c30876dfa 483 /** @defgroup UART_Mute_Mode UART Advanced Feature Mute Mode Enable
Kojto 107:4f6c30876dfa 484 * @{
Kojto 107:4f6c30876dfa 485 */
Kojto 107:4f6c30876dfa 486 #define UART_ADVFEATURE_MUTEMODE_DISABLE ((uint32_t)0x00000000) /*!< UART mute mode disable */
Kojto 107:4f6c30876dfa 487 #define UART_ADVFEATURE_MUTEMODE_ENABLE ((uint32_t)USART_CR1_MME) /*!< UART mute mode enable */
Kojto 107:4f6c30876dfa 488 /**
Kojto 107:4f6c30876dfa 489 * @}
Kojto 107:4f6c30876dfa 490 */
Kojto 107:4f6c30876dfa 491
Kojto 107:4f6c30876dfa 492 /** @defgroup UART_CR2_ADDRESS_LSB_POS UART Address-matching LSB Position In CR2 Register
Kojto 107:4f6c30876dfa 493 * @{
Kojto 107:4f6c30876dfa 494 */
Kojto 107:4f6c30876dfa 495 #define UART_CR2_ADDRESS_LSB_POS ((uint32_t) 24) /*!< UART address-matching LSB position in CR2 register */
Kojto 107:4f6c30876dfa 496 /**
Kojto 107:4f6c30876dfa 497 * @}
Kojto 107:4f6c30876dfa 498 */
Kojto 107:4f6c30876dfa 499
Kojto 107:4f6c30876dfa 500 /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection
Kojto 107:4f6c30876dfa 501 * @{
Kojto 107:4f6c30876dfa 502 */
Kojto 107:4f6c30876dfa 503 #define UART_WAKEUP_ON_ADDRESS ((uint32_t)0x00000000) /*!< UART wake-up on address */
Kojto 107:4f6c30876dfa 504 #define UART_WAKEUP_ON_STARTBIT ((uint32_t)USART_CR3_WUS_1) /*!< UART wake-up on start bit */
Kojto 107:4f6c30876dfa 505 #define UART_WAKEUP_ON_READDATA_NONEMPTY ((uint32_t)USART_CR3_WUS) /*!< UART wake-up on receive data register not empty */
Kojto 107:4f6c30876dfa 506 /**
Kojto 107:4f6c30876dfa 507 * @}
Kojto 107:4f6c30876dfa 508 */
Kojto 107:4f6c30876dfa 509
Kojto 107:4f6c30876dfa 510 /** @defgroup UART_DriverEnable_Polarity UART DriverEnable Polarity
Kojto 107:4f6c30876dfa 511 * @{
Kojto 107:4f6c30876dfa 512 */
Kojto 107:4f6c30876dfa 513 #define UART_DE_POLARITY_HIGH ((uint32_t)0x00000000) /*!< Driver enable signal is active high */
Kojto 107:4f6c30876dfa 514 #define UART_DE_POLARITY_LOW ((uint32_t)USART_CR3_DEP) /*!< Driver enable signal is active low */
Kojto 107:4f6c30876dfa 515 /**
Kojto 107:4f6c30876dfa 516 * @}
Kojto 107:4f6c30876dfa 517 */
Kojto 107:4f6c30876dfa 518
Kojto 107:4f6c30876dfa 519 /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS UART Driver Enable Assertion Time LSB Position In CR1 Register
Kojto 107:4f6c30876dfa 520 * @{
Kojto 107:4f6c30876dfa 521 */
Kojto 107:4f6c30876dfa 522 #define UART_CR1_DEAT_ADDRESS_LSB_POS ((uint32_t) 21) /*!< UART Driver Enable assertion time LSB position in CR1 register */
Kojto 107:4f6c30876dfa 523 /**
Kojto 107:4f6c30876dfa 524 * @}
Kojto 107:4f6c30876dfa 525 */
Kojto 107:4f6c30876dfa 526
Kojto 107:4f6c30876dfa 527 /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS UART Driver Enable DeAssertion Time LSB Position In CR1 Register
Kojto 107:4f6c30876dfa 528 * @{
Kojto 107:4f6c30876dfa 529 */
Kojto 107:4f6c30876dfa 530 #define UART_CR1_DEDT_ADDRESS_LSB_POS ((uint32_t) 16) /*!< UART Driver Enable de-assertion time LSB position in CR1 register */
Kojto 107:4f6c30876dfa 531 /**
Kojto 107:4f6c30876dfa 532 * @}
Kojto 107:4f6c30876dfa 533 */
Kojto 107:4f6c30876dfa 534
Kojto 107:4f6c30876dfa 535 /** @defgroup UART_Interruption_Mask UART Interruptions Flag Mask
Kojto 107:4f6c30876dfa 536 * @{
Kojto 107:4f6c30876dfa 537 */
Kojto 107:4f6c30876dfa 538 #define UART_IT_MASK ((uint32_t)0x001F) /*!< UART interruptions flags mask */
Kojto 107:4f6c30876dfa 539 /**
Kojto 107:4f6c30876dfa 540 * @}
Kojto 107:4f6c30876dfa 541 */
Kojto 107:4f6c30876dfa 542
Kojto 107:4f6c30876dfa 543 /** @defgroup UART_TimeOut_Value UART polling-based communications time-out value
Kojto 107:4f6c30876dfa 544 * @{
Kojto 107:4f6c30876dfa 545 */
Kojto 107:4f6c30876dfa 546 #define HAL_UART_TIMEOUT_VALUE 0x1FFFFFF /*!< UART polling-based communications time-out value */
Kojto 107:4f6c30876dfa 547 /**
Kojto 107:4f6c30876dfa 548 * @}
Kojto 107:4f6c30876dfa 549 */
Kojto 107:4f6c30876dfa 550
Kojto 107:4f6c30876dfa 551 /** @defgroup UART_Flags UART Status Flags
Kojto 107:4f6c30876dfa 552 * Elements values convention: 0xXXXX
Kojto 107:4f6c30876dfa 553 * - 0xXXXX : Flag mask in the ISR register
Kojto 107:4f6c30876dfa 554 * @{
Kojto 107:4f6c30876dfa 555 */
Kojto 107:4f6c30876dfa 556 #define UART_FLAG_REACK ((uint32_t)0x00400000) /*!< UART receive enable acknowledge flag */
Kojto 107:4f6c30876dfa 557 #define UART_FLAG_TEACK ((uint32_t)0x00200000) /*!< UART transmit enable acknowledge flag */
Kojto 107:4f6c30876dfa 558 #define UART_FLAG_WUF ((uint32_t)0x00100000) /*!< UART wake-up from stop mode flag */
Kojto 107:4f6c30876dfa 559 #define UART_FLAG_RWU ((uint32_t)0x00080000) /*!< UART receiver wake-up from mute mode flag */
Kojto 107:4f6c30876dfa 560 #define UART_FLAG_SBKF ((uint32_t)0x00040000) /*!< UART send break flag */
Kojto 107:4f6c30876dfa 561 #define UART_FLAG_CMF ((uint32_t)0x00020000) /*!< UART character match flag */
Kojto 107:4f6c30876dfa 562 #define UART_FLAG_BUSY ((uint32_t)0x00010000) /*!< UART busy flag */
Kojto 107:4f6c30876dfa 563 #define UART_FLAG_ABRF ((uint32_t)0x00008000) /*!< UART auto Baud rate flag */
Kojto 107:4f6c30876dfa 564 #define UART_FLAG_ABRE ((uint32_t)0x00004000) /*!< UART uto Baud rate error */
Kojto 107:4f6c30876dfa 565 #define UART_FLAG_EOBF ((uint32_t)0x00001000) /*!< UART end of block flag */
Kojto 107:4f6c30876dfa 566 #define UART_FLAG_RTOF ((uint32_t)0x00000800) /*!< UART receiver timeout flag */
Kojto 107:4f6c30876dfa 567 #define UART_FLAG_CTS ((uint32_t)0x00000400) /*!< UART clear to send flag */
Kojto 107:4f6c30876dfa 568 #define UART_FLAG_CTSIF ((uint32_t)0x00000200) /*!< UART clear to send interrupt flag */
Kojto 107:4f6c30876dfa 569 #define UART_FLAG_LBDF ((uint32_t)0x00000100) /*!< UART LIN break detection flag */
Kojto 107:4f6c30876dfa 570 #define UART_FLAG_TXE ((uint32_t)0x00000080) /*!< UART transmit data register empty */
Kojto 107:4f6c30876dfa 571 #define UART_FLAG_TC ((uint32_t)0x00000040) /*!< UART transmission complete */
Kojto 107:4f6c30876dfa 572 #define UART_FLAG_RXNE ((uint32_t)0x00000020) /*!< UART read data register not empty */
Kojto 107:4f6c30876dfa 573 #define UART_FLAG_IDLE ((uint32_t)0x00000010) /*!< UART idle flag */
Kojto 107:4f6c30876dfa 574 #define UART_FLAG_ORE ((uint32_t)0x00000008) /*!< UART overrun error */
Kojto 107:4f6c30876dfa 575 #define UART_FLAG_NE ((uint32_t)0x00000004) /*!< UART noise error */
Kojto 107:4f6c30876dfa 576 #define UART_FLAG_FE ((uint32_t)0x00000002) /*!< UART frame error */
Kojto 107:4f6c30876dfa 577 #define UART_FLAG_PE ((uint32_t)0x00000001) /*!< UART parity error */
Kojto 107:4f6c30876dfa 578 /**
Kojto 107:4f6c30876dfa 579 * @}
Kojto 107:4f6c30876dfa 580 */
Kojto 107:4f6c30876dfa 581
Kojto 107:4f6c30876dfa 582 /** @defgroup UART_Interrupt_definition UART Interrupts Definition
Kojto 107:4f6c30876dfa 583 * Elements values convention: 000ZZZZZ0XXYYYYYb
Kojto 107:4f6c30876dfa 584 * - YYYYY : Interrupt source position in the XX register (5bits)
Kojto 107:4f6c30876dfa 585 * - XX : Interrupt source register (2bits)
Kojto 107:4f6c30876dfa 586 * - 01: CR1 register
Kojto 107:4f6c30876dfa 587 * - 10: CR2 register
Kojto 107:4f6c30876dfa 588 * - 11: CR3 register
Kojto 107:4f6c30876dfa 589 * - ZZZZZ : Flag position in the ISR register(5bits)
Kojto 107:4f6c30876dfa 590 * @{
Kojto 107:4f6c30876dfa 591 */
Kojto 107:4f6c30876dfa 592 #define UART_IT_PE ((uint32_t)0x0028) /*!< UART parity error interruption */
Kojto 107:4f6c30876dfa 593 #define UART_IT_TXE ((uint32_t)0x0727) /*!< UART transmit data register empty interruption */
Kojto 107:4f6c30876dfa 594 #define UART_IT_TC ((uint32_t)0x0626) /*!< UART transmission complete interruption */
Kojto 107:4f6c30876dfa 595 #define UART_IT_RXNE ((uint32_t)0x0525) /*!< UART read data register not empty interruption */
Kojto 107:4f6c30876dfa 596 #define UART_IT_IDLE ((uint32_t)0x0424) /*!< UART idle interruption */
Kojto 107:4f6c30876dfa 597 #define UART_IT_LBD ((uint32_t)0x0846) /*!< UART LIN break detection interruption */
Kojto 107:4f6c30876dfa 598 #define UART_IT_CTS ((uint32_t)0x096A) /*!< UART CTS interruption */
Kojto 107:4f6c30876dfa 599 #define UART_IT_CM ((uint32_t)0x112E) /*!< UART character match interruption */
Kojto 107:4f6c30876dfa 600 #define UART_IT_WUF ((uint32_t)0x1476) /*!< UART wake-up from stop mode interruption */
Kojto 107:4f6c30876dfa 601
Kojto 107:4f6c30876dfa 602 /* Elements values convention: 000000000XXYYYYYb
Kojto 107:4f6c30876dfa 603 - YYYYY : Interrupt source position in the XX register (5bits)
Kojto 107:4f6c30876dfa 604 - XX : Interrupt source register (2bits)
Kojto 107:4f6c30876dfa 605 - 01: CR1 register
Kojto 107:4f6c30876dfa 606 - 10: CR2 register
Kojto 107:4f6c30876dfa 607 - 11: CR3 register */
Kojto 107:4f6c30876dfa 608 #define UART_IT_ERR ((uint32_t)0x0060) /*!< UART error interruption */
Kojto 107:4f6c30876dfa 609
Kojto 107:4f6c30876dfa 610 /* Elements values convention: 0000ZZZZ00000000b
Kojto 107:4f6c30876dfa 611 - ZZZZ : Flag position in the ISR register(4bits) */
Kojto 107:4f6c30876dfa 612 #define UART_IT_ORE ((uint32_t)0x0300) /*!< UART overrun error interruption */
Kojto 107:4f6c30876dfa 613 #define UART_IT_NE ((uint32_t)0x0200) /*!< UART noise error interruption */
Kojto 107:4f6c30876dfa 614 #define UART_IT_FE ((uint32_t)0x0100) /*!< UART frame error interruption */
Kojto 107:4f6c30876dfa 615 /**
Kojto 107:4f6c30876dfa 616 * @}
Kojto 107:4f6c30876dfa 617 */
Kojto 107:4f6c30876dfa 618
Kojto 107:4f6c30876dfa 619 /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags
Kojto 107:4f6c30876dfa 620 * @{
Kojto 107:4f6c30876dfa 621 */
Kojto 107:4f6c30876dfa 622 #define UART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
Kojto 107:4f6c30876dfa 623 #define UART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
Kojto 107:4f6c30876dfa 624 #define UART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
Kojto 107:4f6c30876dfa 625 #define UART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
Kojto 107:4f6c30876dfa 626 #define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
Kojto 107:4f6c30876dfa 627 #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
Kojto 107:4f6c30876dfa 628 #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag */
Kojto 107:4f6c30876dfa 629 #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
Kojto 107:4f6c30876dfa 630 #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
Kojto 107:4f6c30876dfa 631 #define UART_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
Kojto 107:4f6c30876dfa 632 #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */
Kojto 107:4f6c30876dfa 633 #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */
Kojto 107:4f6c30876dfa 634 /**
Kojto 107:4f6c30876dfa 635 * @}
Kojto 107:4f6c30876dfa 636 */
Kojto 107:4f6c30876dfa 637
Kojto 107:4f6c30876dfa 638
Kojto 107:4f6c30876dfa 639 /**
Kojto 107:4f6c30876dfa 640 * @}
Kojto 107:4f6c30876dfa 641 */
Kojto 107:4f6c30876dfa 642
Kojto 107:4f6c30876dfa 643 /* Exported macros -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 644 /** @defgroup UART_Exported_Macros UART Exported Macros
Kojto 107:4f6c30876dfa 645 * @{
Kojto 107:4f6c30876dfa 646 */
Kojto 107:4f6c30876dfa 647
Kojto 107:4f6c30876dfa 648 /** @brief Reset UART handle state.
Kojto 107:4f6c30876dfa 649 * @param __HANDLE__: UART handle.
Kojto 107:4f6c30876dfa 650 * @retval None
Kojto 107:4f6c30876dfa 651 */
Kojto 107:4f6c30876dfa 652 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_UART_STATE_RESET)
Kojto 107:4f6c30876dfa 653
Kojto 107:4f6c30876dfa 654 /** @brief Flush the UART Data registers.
Kojto 107:4f6c30876dfa 655 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 656 * @retval None
Kojto 107:4f6c30876dfa 657 */
Kojto 107:4f6c30876dfa 658 #define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
Kojto 107:4f6c30876dfa 659 do{ \
Kojto 107:4f6c30876dfa 660 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
Kojto 107:4f6c30876dfa 661 SET_BIT((__HANDLE__)->Instance->RQR, UART_TXDATA_FLUSH_REQUEST); \
Kojto 107:4f6c30876dfa 662 } while(0)
Kojto 107:4f6c30876dfa 663
Kojto 107:4f6c30876dfa 664 /** @brief Clear the specified UART pending flag.
Kojto 107:4f6c30876dfa 665 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 666 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 667 * This parameter can be any combination of the following values:
Kojto 107:4f6c30876dfa 668 * @arg UART_CLEAR_PEF, Parity Error Clear Flag
Kojto 107:4f6c30876dfa 669 * @arg UART_CLEAR_FEF, Framing Error Clear Flag
Kojto 107:4f6c30876dfa 670 * @arg UART_CLEAR_NEF, Noise detected Clear Flag
Kojto 107:4f6c30876dfa 671 * @arg UART_CLEAR_OREF, OverRun Error Clear Flag
Kojto 107:4f6c30876dfa 672 * @arg UART_CLEAR_IDLEF, IDLE line detected Clear Flag
Kojto 107:4f6c30876dfa 673 * @arg UART_CLEAR_TCF, Transmission Complete Clear Flag
Kojto 107:4f6c30876dfa 674 * @arg UART_CLEAR_LBDF, LIN Break Detection Clear Flag
Kojto 107:4f6c30876dfa 675 * @arg UART_CLEAR_CTSF, CTS Interrupt Clear Flag
Kojto 107:4f6c30876dfa 676 * @arg UART_CLEAR_RTOF, Receiver Time Out Clear Flag
Kojto 107:4f6c30876dfa 677 * @arg UART_CLEAR_EOBF, End Of Block Clear Flag
Kojto 107:4f6c30876dfa 678 * @arg UART_CLEAR_CMF, Character Match Clear Flag
Kojto 107:4f6c30876dfa 679 * @arg UART_CLEAR_WUF, Wake Up from stop mode Clear Flag
Kojto 107:4f6c30876dfa 680 * @retval None
Kojto 107:4f6c30876dfa 681 */
Kojto 107:4f6c30876dfa 682 #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
Kojto 107:4f6c30876dfa 683
Kojto 107:4f6c30876dfa 684 /** @brief Clear the UART PE pending flag.
Kojto 107:4f6c30876dfa 685 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 686 * @retval None
Kojto 107:4f6c30876dfa 687 */
Kojto 107:4f6c30876dfa 688 #define __HAL_UART_CLEAR_PEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_PEF)
Kojto 107:4f6c30876dfa 689
Kojto 107:4f6c30876dfa 690 /** @brief Clear the UART FE pending flag.
Kojto 107:4f6c30876dfa 691 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 692 * @retval None
Kojto 107:4f6c30876dfa 693 */
Kojto 107:4f6c30876dfa 694 #define __HAL_UART_CLEAR_FEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_FEF)
Kojto 107:4f6c30876dfa 695
Kojto 107:4f6c30876dfa 696 /** @brief Clear the UART NE pending flag.
Kojto 107:4f6c30876dfa 697 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 698 * @retval None
Kojto 107:4f6c30876dfa 699 */
Kojto 107:4f6c30876dfa 700 #define __HAL_UART_CLEAR_NEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_NEF)
Kojto 107:4f6c30876dfa 701
Kojto 107:4f6c30876dfa 702 /** @brief Clear the UART ORE pending flag.
Kojto 107:4f6c30876dfa 703 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 704 * @retval None
Kojto 107:4f6c30876dfa 705 */
Kojto 107:4f6c30876dfa 706 #define __HAL_UART_CLEAR_OREFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_OREF)
Kojto 107:4f6c30876dfa 707
Kojto 107:4f6c30876dfa 708 /** @brief Clear the UART IDLE pending flag.
Kojto 107:4f6c30876dfa 709 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 710 * @retval None
Kojto 107:4f6c30876dfa 711 */
Kojto 107:4f6c30876dfa 712 #define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_IDLEF)
Kojto 107:4f6c30876dfa 713
Kojto 107:4f6c30876dfa 714 /** @brief Check whether the specified UART flag is set or not.
Kojto 107:4f6c30876dfa 715 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 716 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 717 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 718 * @arg UART_FLAG_REACK: Receive enable acknowledge flag
Kojto 107:4f6c30876dfa 719 * @arg UART_FLAG_TEACK: Transmit enable acknowledge flag
Kojto 107:4f6c30876dfa 720 * @arg UART_FLAG_WUF: Wake up from stop mode flag
Kojto 107:4f6c30876dfa 721 * @arg UART_FLAG_RWU: Receiver wake up flag (if the UART in mute mode)
Kojto 107:4f6c30876dfa 722 * @arg UART_FLAG_SBKF: Send Break flag
Kojto 107:4f6c30876dfa 723 * @arg UART_FLAG_CMF: Character match flag
Kojto 107:4f6c30876dfa 724 * @arg UART_FLAG_BUSY: Busy flag
Kojto 107:4f6c30876dfa 725 * @arg UART_FLAG_ABRF: Auto Baud rate detection flag
Kojto 107:4f6c30876dfa 726 * @arg UART_FLAG_ABRE: Auto Baud rate detection error flag
Kojto 107:4f6c30876dfa 727 * @arg UART_FLAG_EOBF: End of block flag
Kojto 107:4f6c30876dfa 728 * @arg UART_FLAG_RTOF: Receiver timeout flag
Kojto 107:4f6c30876dfa 729 * @arg UART_FLAG_CTS: CTS Change flag
Kojto 107:4f6c30876dfa 730 * @arg UART_FLAG_LBD: LIN Break detection flag
Kojto 107:4f6c30876dfa 731 * @arg UART_FLAG_TXE: Transmit data register empty flag
Kojto 107:4f6c30876dfa 732 * @arg UART_FLAG_TC: Transmission Complete flag
Kojto 107:4f6c30876dfa 733 * @arg UART_FLAG_RXNE: Receive data register not empty flag
Kojto 107:4f6c30876dfa 734 * @arg UART_FLAG_IDLE: Idle Line detection flag
Kojto 107:4f6c30876dfa 735 * @arg UART_FLAG_ORE: OverRun Error flag
Kojto 107:4f6c30876dfa 736 * @arg UART_FLAG_NE: Noise Error flag
Kojto 107:4f6c30876dfa 737 * @arg UART_FLAG_FE: Framing Error flag
Kojto 107:4f6c30876dfa 738 * @arg UART_FLAG_PE: Parity Error flag
Kojto 107:4f6c30876dfa 739 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 740 */
Kojto 107:4f6c30876dfa 741 #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
Kojto 107:4f6c30876dfa 742
Kojto 107:4f6c30876dfa 743 /** @brief Enable the specified UART interrupt.
Kojto 107:4f6c30876dfa 744 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 745 * @param __INTERRUPT__: specifies the UART interrupt source to enable.
Kojto 107:4f6c30876dfa 746 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 747 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
Kojto 107:4f6c30876dfa 748 * @arg UART_IT_CM: Character match interrupt
Kojto 107:4f6c30876dfa 749 * @arg UART_IT_CTS: CTS change interrupt
Kojto 107:4f6c30876dfa 750 * @arg UART_IT_LBD: LIN Break detection interrupt
Kojto 107:4f6c30876dfa 751 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
Kojto 107:4f6c30876dfa 752 * @arg UART_IT_TC: Transmission complete interrupt
Kojto 107:4f6c30876dfa 753 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
Kojto 107:4f6c30876dfa 754 * @arg UART_IT_IDLE: Idle line detection interrupt
Kojto 107:4f6c30876dfa 755 * @arg UART_IT_PE: Parity Error interrupt
Kojto 107:4f6c30876dfa 756 * @arg UART_IT_ERR: Error interrupt (Frame error, noise error, overrun error)
Kojto 107:4f6c30876dfa 757 * @retval None
Kojto 107:4f6c30876dfa 758 */
Kojto 107:4f6c30876dfa 759 #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
Kojto 107:4f6c30876dfa 760 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
Kojto 107:4f6c30876dfa 761 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))))
Kojto 107:4f6c30876dfa 762
Kojto 107:4f6c30876dfa 763
Kojto 107:4f6c30876dfa 764 /** @brief Disable the specified UART interrupt.
Kojto 107:4f6c30876dfa 765 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 766 * @param __INTERRUPT__: specifies the UART interrupt source to disable.
Kojto 107:4f6c30876dfa 767 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 768 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
Kojto 107:4f6c30876dfa 769 * @arg UART_IT_CM: Character match interrupt
Kojto 107:4f6c30876dfa 770 * @arg UART_IT_CTS: CTS change interrupt
Kojto 107:4f6c30876dfa 771 * @arg UART_IT_LBD: LIN Break detection interrupt
Kojto 107:4f6c30876dfa 772 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
Kojto 107:4f6c30876dfa 773 * @arg UART_IT_TC: Transmission complete interrupt
Kojto 107:4f6c30876dfa 774 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
Kojto 107:4f6c30876dfa 775 * @arg UART_IT_IDLE: Idle line detection interrupt
Kojto 107:4f6c30876dfa 776 * @arg UART_IT_PE: Parity Error interrupt
Kojto 107:4f6c30876dfa 777 * @arg UART_IT_ERR: Error interrupt (Frame error, noise error, overrun error)
Kojto 107:4f6c30876dfa 778 * @retval None
Kojto 107:4f6c30876dfa 779 */
Kojto 107:4f6c30876dfa 780 #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
Kojto 107:4f6c30876dfa 781 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
Kojto 107:4f6c30876dfa 782 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))))
Kojto 107:4f6c30876dfa 783
Kojto 107:4f6c30876dfa 784 /** @brief Check whether the specified UART interrupt has occurred or not.
Kojto 107:4f6c30876dfa 785 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 786 * @param __IT__: specifies the UART interrupt to check.
Kojto 107:4f6c30876dfa 787 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 788 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
Kojto 107:4f6c30876dfa 789 * @arg UART_IT_CM: Character match interrupt
Kojto 107:4f6c30876dfa 790 * @arg UART_IT_CTS: CTS change interrupt
Kojto 107:4f6c30876dfa 791 * @arg UART_IT_LBD: LIN Break detection interrupt
Kojto 107:4f6c30876dfa 792 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
Kojto 107:4f6c30876dfa 793 * @arg UART_IT_TC: Transmission complete interrupt
Kojto 107:4f6c30876dfa 794 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
Kojto 107:4f6c30876dfa 795 * @arg UART_IT_IDLE: Idle line detection interrupt
Kojto 107:4f6c30876dfa 796 * @arg UART_IT_ORE: OverRun Error interrupt
Kojto 107:4f6c30876dfa 797 * @arg UART_IT_NE: Noise Error interrupt
Kojto 107:4f6c30876dfa 798 * @arg UART_IT_FE: Framing Error interrupt
Kojto 107:4f6c30876dfa 799 * @arg UART_IT_PE: Parity Error interrupt
Kojto 107:4f6c30876dfa 800 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 801 */
Kojto 107:4f6c30876dfa 802 #define __HAL_UART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08)))
Kojto 107:4f6c30876dfa 803
Kojto 107:4f6c30876dfa 804 /** @brief Check whether the specified UART interrupt source is enabled or not.
Kojto 107:4f6c30876dfa 805 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 806 * @param __IT__: specifies the UART interrupt source to check.
Kojto 107:4f6c30876dfa 807 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 808 * @arg UART_IT_WUF: Wakeup from stop mode interrupt
Kojto 107:4f6c30876dfa 809 * @arg UART_IT_CM: Character match interrupt
Kojto 107:4f6c30876dfa 810 * @arg UART_IT_CTS: CTS change interrupt
Kojto 107:4f6c30876dfa 811 * @arg UART_IT_LBD: LIN Break detection interrupt
Kojto 107:4f6c30876dfa 812 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
Kojto 107:4f6c30876dfa 813 * @arg UART_IT_TC: Transmission complete interrupt
Kojto 107:4f6c30876dfa 814 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
Kojto 107:4f6c30876dfa 815 * @arg UART_IT_IDLE: Idle line detection interrupt
Kojto 107:4f6c30876dfa 816 * @arg UART_IT_ORE: OverRun Error interrupt
Kojto 107:4f6c30876dfa 817 * @arg UART_IT_NE: Noise Error interrupt
Kojto 107:4f6c30876dfa 818 * @arg UART_IT_FE: Framing Error interrupt
Kojto 107:4f6c30876dfa 819 * @arg UART_IT_PE: Parity Error interrupt
Kojto 107:4f6c30876dfa 820 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 821 */
Kojto 107:4f6c30876dfa 822 #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2)? \
Kojto 107:4f6c30876dfa 823 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & UART_IT_MASK)))
Kojto 107:4f6c30876dfa 824
Kojto 107:4f6c30876dfa 825 /** @brief Clear the specified UART ISR flag, in setting the proper ICR register flag.
Kojto 107:4f6c30876dfa 826 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 827 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
Kojto 107:4f6c30876dfa 828 * to clear the corresponding interrupt
Kojto 107:4f6c30876dfa 829 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 830 * @arg UART_CLEAR_PEF: Parity Error Clear Flag
Kojto 107:4f6c30876dfa 831 * @arg UART_CLEAR_FEF: Framing Error Clear Flag
Kojto 107:4f6c30876dfa 832 * @arg UART_CLEAR_NEF: Noise detected Clear Flag
Kojto 107:4f6c30876dfa 833 * @arg UART_CLEAR_OREF: OverRun Error Clear Flag
Kojto 107:4f6c30876dfa 834 * @arg UART_CLEAR_IDLEF: IDLE line detected Clear Flag
Kojto 107:4f6c30876dfa 835 * @arg UART_CLEAR_TCF: Transmission Complete Clear Flag
Kojto 107:4f6c30876dfa 836 * @arg UART_CLEAR_LBDF: LIN Break Detection Clear Flag
Kojto 107:4f6c30876dfa 837 * @arg UART_CLEAR_CTSF: CTS Interrupt Clear Flag
Kojto 107:4f6c30876dfa 838 * @arg UART_CLEAR_RTOF: Receiver Time Out Clear Flag
Kojto 107:4f6c30876dfa 839 * @arg UART_CLEAR_EOBF: End Of Block Clear Flag
Kojto 107:4f6c30876dfa 840 * @arg UART_CLEAR_CMF: Character Match Clear Flag
Kojto 107:4f6c30876dfa 841 * @arg UART_CLEAR_WUF: Wake Up from stop mode Clear Flag
Kojto 107:4f6c30876dfa 842 * @retval None
Kojto 107:4f6c30876dfa 843 */
Kojto 107:4f6c30876dfa 844 #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
Kojto 107:4f6c30876dfa 845
Kojto 107:4f6c30876dfa 846 /** @brief Set a specific UART request flag.
Kojto 107:4f6c30876dfa 847 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 848 * @param __REQ__: specifies the request flag to set
Kojto 107:4f6c30876dfa 849 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 850 * @arg UART_AUTOBAUD_REQUEST: Auto-Baud Rate Request
Kojto 107:4f6c30876dfa 851 * @arg UART_SENDBREAK_REQUEST: Send Break Request
Kojto 107:4f6c30876dfa 852 * @arg UART_MUTE_MODE_REQUEST: Mute Mode Request
Kojto 107:4f6c30876dfa 853 * @arg UART_RXDATA_FLUSH_REQUEST: Receive Data flush Request
Kojto 107:4f6c30876dfa 854 * @arg UART_TXDATA_FLUSH_REQUEST: Transmit data flush Request
Kojto 107:4f6c30876dfa 855 * @retval None
Kojto 107:4f6c30876dfa 856 */
Kojto 107:4f6c30876dfa 857 #define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint32_t)(__REQ__))
Kojto 107:4f6c30876dfa 858
Kojto 107:4f6c30876dfa 859 /** @brief Enable the UART one bit sample method.
Kojto 107:4f6c30876dfa 860 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 861 * @retval None
Kojto 107:4f6c30876dfa 862 */
Kojto 107:4f6c30876dfa 863 #define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
Kojto 107:4f6c30876dfa 864
Kojto 107:4f6c30876dfa 865 /** @brief Disable the UART one bit sample method.
Kojto 107:4f6c30876dfa 866 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 867 * @retval None
Kojto 107:4f6c30876dfa 868 */
Kojto 107:4f6c30876dfa 869 #define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT))
Kojto 107:4f6c30876dfa 870
Kojto 107:4f6c30876dfa 871 /** @brief Enable UART.
Kojto 107:4f6c30876dfa 872 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 873 * @retval None
Kojto 107:4f6c30876dfa 874 */
Kojto 107:4f6c30876dfa 875 #define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
Kojto 107:4f6c30876dfa 876
Kojto 107:4f6c30876dfa 877 /** @brief Disable UART.
Kojto 107:4f6c30876dfa 878 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 879 * @retval None
Kojto 107:4f6c30876dfa 880 */
Kojto 107:4f6c30876dfa 881 #define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
Kojto 107:4f6c30876dfa 882
Kojto 107:4f6c30876dfa 883 /** @brief Enable CTS flow control.
Kojto 107:4f6c30876dfa 884 * @note This macro allows to enable CTS hardware flow control for a given UART instance,
Kojto 107:4f6c30876dfa 885 * without need to call HAL_UART_Init() function.
Kojto 107:4f6c30876dfa 886 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
Kojto 107:4f6c30876dfa 887 * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
Kojto 107:4f6c30876dfa 888 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
Kojto 107:4f6c30876dfa 889 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
Kojto 107:4f6c30876dfa 890 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
Kojto 107:4f6c30876dfa 891 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
Kojto 107:4f6c30876dfa 892 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 893 * @retval None
Kojto 107:4f6c30876dfa 894 */
Kojto 107:4f6c30876dfa 895 #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 896 do{ \
Kojto 107:4f6c30876dfa 897 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
Kojto 107:4f6c30876dfa 898 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
Kojto 107:4f6c30876dfa 899 } while(0)
Kojto 107:4f6c30876dfa 900
Kojto 107:4f6c30876dfa 901 /** @brief Disable CTS flow control.
Kojto 107:4f6c30876dfa 902 * @note This macro allows to disable CTS hardware flow control for a given UART instance,
Kojto 107:4f6c30876dfa 903 * without need to call HAL_UART_Init() function.
Kojto 107:4f6c30876dfa 904 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
Kojto 107:4f6c30876dfa 905 * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
Kojto 107:4f6c30876dfa 906 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
Kojto 107:4f6c30876dfa 907 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
Kojto 107:4f6c30876dfa 908 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
Kojto 107:4f6c30876dfa 909 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
Kojto 107:4f6c30876dfa 910 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 911 * @retval None
Kojto 107:4f6c30876dfa 912 */
Kojto 107:4f6c30876dfa 913 #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 914 do{ \
Kojto 107:4f6c30876dfa 915 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
Kojto 107:4f6c30876dfa 916 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
Kojto 107:4f6c30876dfa 917 } while(0)
Kojto 107:4f6c30876dfa 918
Kojto 107:4f6c30876dfa 919 /** @brief Enable RTS flow control.
Kojto 107:4f6c30876dfa 920 * @note This macro allows to enable RTS hardware flow control for a given UART instance,
Kojto 107:4f6c30876dfa 921 * without need to call HAL_UART_Init() function.
Kojto 107:4f6c30876dfa 922 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
Kojto 107:4f6c30876dfa 923 * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
Kojto 107:4f6c30876dfa 924 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
Kojto 107:4f6c30876dfa 925 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
Kojto 107:4f6c30876dfa 926 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
Kojto 107:4f6c30876dfa 927 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
Kojto 107:4f6c30876dfa 928 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 929 * @retval None
Kojto 107:4f6c30876dfa 930 */
Kojto 107:4f6c30876dfa 931 #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 932 do{ \
Kojto 107:4f6c30876dfa 933 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
Kojto 107:4f6c30876dfa 934 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
Kojto 107:4f6c30876dfa 935 } while(0)
Kojto 107:4f6c30876dfa 936
Kojto 107:4f6c30876dfa 937 /** @brief Disable RTS flow control.
Kojto 107:4f6c30876dfa 938 * @note This macro allows to disable RTS hardware flow control for a given UART instance,
Kojto 107:4f6c30876dfa 939 * without need to call HAL_UART_Init() function.
Kojto 107:4f6c30876dfa 940 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
Kojto 107:4f6c30876dfa 941 * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
Kojto 107:4f6c30876dfa 942 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
Kojto 107:4f6c30876dfa 943 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
Kojto 107:4f6c30876dfa 944 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
Kojto 107:4f6c30876dfa 945 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
Kojto 107:4f6c30876dfa 946 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 947 * @retval None
Kojto 107:4f6c30876dfa 948 */
Kojto 107:4f6c30876dfa 949 #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 950 do{ \
Kojto 107:4f6c30876dfa 951 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
Kojto 107:4f6c30876dfa 952 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
Kojto 107:4f6c30876dfa 953 } while(0)
Kojto 107:4f6c30876dfa 954
Kojto 107:4f6c30876dfa 955 /**
Kojto 107:4f6c30876dfa 956 * @}
Kojto 107:4f6c30876dfa 957 */
Kojto 107:4f6c30876dfa 958
Kojto 107:4f6c30876dfa 959 /* Private macros --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 960 /** @defgroup UART_Private_Macros UART Private Macros
Kojto 107:4f6c30876dfa 961 * @{
Kojto 107:4f6c30876dfa 962 */
Kojto 107:4f6c30876dfa 963 /** @brief BRR division operation to set BRR register with LPUART.
Kojto 107:4f6c30876dfa 964 * @param __PCLK__: LPUART clock.
Kojto 107:4f6c30876dfa 965 * @param __BAUD__: Baud rate set by the user.
Kojto 107:4f6c30876dfa 966 * @retval Division result
Kojto 107:4f6c30876dfa 967 */
Kojto 107:4f6c30876dfa 968 #define UART_DIV_LPUART(__PCLK__, __BAUD__) (((uint64_t)(__PCLK__)*256)/((__BAUD__)))
Kojto 107:4f6c30876dfa 969
Kojto 107:4f6c30876dfa 970 /** @brief BRR division operation to set BRR register in 8-bit oversampling mode.
Kojto 107:4f6c30876dfa 971 * @param __PCLK__: UART clock.
Kojto 107:4f6c30876dfa 972 * @param __BAUD__: Baud rate set by the user.
Kojto 107:4f6c30876dfa 973 * @retval Division result
Kojto 107:4f6c30876dfa 974 */
Kojto 107:4f6c30876dfa 975 #define UART_DIV_SAMPLING8(__PCLK__, __BAUD__) (((__PCLK__)*2)/((__BAUD__)))
Kojto 107:4f6c30876dfa 976
Kojto 107:4f6c30876dfa 977 /** @brief BRR division operation to set BRR register in 16-bit oversampling mode.
Kojto 107:4f6c30876dfa 978 * @param __PCLK__: UART clock.
Kojto 107:4f6c30876dfa 979 * @param __BAUD__: Baud rate set by the user.
Kojto 107:4f6c30876dfa 980 * @retval Division result
Kojto 107:4f6c30876dfa 981 */
Kojto 107:4f6c30876dfa 982 #define UART_DIV_SAMPLING16(__PCLK__, __BAUD__) (((__PCLK__))/((__BAUD__)))
Kojto 107:4f6c30876dfa 983
Kojto 107:4f6c30876dfa 984 /** @brief Check whether or not UART instance is Low Power UART.
Kojto 107:4f6c30876dfa 985 * @param __HANDLE__: specifies the UART Handle.
Kojto 107:4f6c30876dfa 986 * @retval SET (instance is LPUART) or RESET (instance isn't LPUART)
Kojto 107:4f6c30876dfa 987 */
Kojto 107:4f6c30876dfa 988 #define UART_INSTANCE_LOWPOWER(__HANDLE__) (((__HANDLE__)->Instance == LPUART1) ? SET : RESET )
Kojto 107:4f6c30876dfa 989
Kojto 107:4f6c30876dfa 990 /** @brief Check UART Baud rate.
Kojto 107:4f6c30876dfa 991 * @param __BAUDRATE__: Baudrate specified by the user.
Kojto 107:4f6c30876dfa 992 * The maximum Baud Rate is derived from the maximum clock on L4 (i.e. 80 MHz)
Kojto 107:4f6c30876dfa 993 * divided by the smallest oversampling used on the USART (i.e. 8)
Kojto 107:4f6c30876dfa 994 * @retval SET (__BAUDRATE__ is valid) or RESET (__BAUDRATE__ is invalid)
Kojto 107:4f6c30876dfa 995 */
Kojto 107:4f6c30876dfa 996 #define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 10000001)
Kojto 107:4f6c30876dfa 997
Kojto 107:4f6c30876dfa 998 /** @brief Check UART assertion time.
Kojto 107:4f6c30876dfa 999 * @param __TIME__: 5-bit value assertion time.
Kojto 107:4f6c30876dfa 1000 * @retval Test result (TRUE or FALSE).
Kojto 107:4f6c30876dfa 1001 */
Kojto 107:4f6c30876dfa 1002 #define IS_UART_ASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1F)
Kojto 107:4f6c30876dfa 1003
Kojto 107:4f6c30876dfa 1004 /** @brief Check UART deassertion time.
Kojto 107:4f6c30876dfa 1005 * @param __TIME__: 5-bit value deassertion time.
Kojto 107:4f6c30876dfa 1006 * @retval Test result (TRUE or FALSE).
Kojto 107:4f6c30876dfa 1007 */
Kojto 107:4f6c30876dfa 1008 #define IS_UART_DEASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1F)
Kojto 107:4f6c30876dfa 1009
Kojto 107:4f6c30876dfa 1010 /**
Kojto 107:4f6c30876dfa 1011 * @brief Ensure that UART frame number of stop bits is valid.
Kojto 107:4f6c30876dfa 1012 * @param __STOPBITS__: UART frame number of stop bits.
Kojto 107:4f6c30876dfa 1013 * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)
Kojto 107:4f6c30876dfa 1014 */
Kojto 107:4f6c30876dfa 1015 #define IS_UART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_1) || \
Kojto 107:4f6c30876dfa 1016 ((__STOPBITS__) == UART_STOPBITS_2) || \
Kojto 107:4f6c30876dfa 1017 ((__STOPBITS__) == UART_STOPBITS_1_5))
Kojto 107:4f6c30876dfa 1018
Kojto 107:4f6c30876dfa 1019 /**
Kojto 107:4f6c30876dfa 1020 * @brief Ensure that UART frame parity is valid.
Kojto 107:4f6c30876dfa 1021 * @param __PARITY__: UART frame parity.
Kojto 107:4f6c30876dfa 1022 * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid)
Kojto 107:4f6c30876dfa 1023 */
Kojto 107:4f6c30876dfa 1024 #define IS_UART_PARITY(__PARITY__) (((__PARITY__) == UART_PARITY_NONE) || \
Kojto 107:4f6c30876dfa 1025 ((__PARITY__) == UART_PARITY_EVEN) || \
Kojto 107:4f6c30876dfa 1026 ((__PARITY__) == UART_PARITY_ODD))
Kojto 107:4f6c30876dfa 1027
Kojto 107:4f6c30876dfa 1028 /**
Kojto 107:4f6c30876dfa 1029 * @brief Ensure that UART hardware flow control is valid.
Kojto 107:4f6c30876dfa 1030 * @param __CONTROL__: UART hardware flow control.
Kojto 107:4f6c30876dfa 1031 * @retval SET (__CONTROL__ is valid) or RESET (__CONTROL__ is invalid)
Kojto 107:4f6c30876dfa 1032 */
Kojto 107:4f6c30876dfa 1033 #define IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)\
Kojto 107:4f6c30876dfa 1034 (((__CONTROL__) == UART_HWCONTROL_NONE) || \
Kojto 107:4f6c30876dfa 1035 ((__CONTROL__) == UART_HWCONTROL_RTS) || \
Kojto 107:4f6c30876dfa 1036 ((__CONTROL__) == UART_HWCONTROL_CTS) || \
Kojto 107:4f6c30876dfa 1037 ((__CONTROL__) == UART_HWCONTROL_RTS_CTS))
Kojto 107:4f6c30876dfa 1038
Kojto 107:4f6c30876dfa 1039 /**
Kojto 107:4f6c30876dfa 1040 * @brief Ensure that UART communication mode is valid.
Kojto 107:4f6c30876dfa 1041 * @param __MODE__: UART communication mode.
Kojto 107:4f6c30876dfa 1042 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 107:4f6c30876dfa 1043 */
Kojto 107:4f6c30876dfa 1044 #define IS_UART_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(UART_MODE_TX_RX)))) == (uint32_t)0x00) && ((__MODE__) != (uint32_t)0x00))
Kojto 107:4f6c30876dfa 1045
Kojto 107:4f6c30876dfa 1046 /**
Kojto 107:4f6c30876dfa 1047 * @brief Ensure that UART state is valid.
Kojto 107:4f6c30876dfa 1048 * @param __STATE__: UART state.
Kojto 107:4f6c30876dfa 1049 * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid)
Kojto 107:4f6c30876dfa 1050 */
Kojto 107:4f6c30876dfa 1051 #define IS_UART_STATE(__STATE__) (((__STATE__) == UART_STATE_DISABLE) || \
Kojto 107:4f6c30876dfa 1052 ((__STATE__) == UART_STATE_ENABLE))
Kojto 107:4f6c30876dfa 1053
Kojto 107:4f6c30876dfa 1054 /**
Kojto 107:4f6c30876dfa 1055 * @brief Ensure that UART oversampling is valid.
Kojto 107:4f6c30876dfa 1056 * @param __SAMPLING__: UART oversampling.
Kojto 107:4f6c30876dfa 1057 * @retval SET (__SAMPLING__ is valid) or RESET (__SAMPLING__ is invalid)
Kojto 107:4f6c30876dfa 1058 */
Kojto 107:4f6c30876dfa 1059 #define IS_UART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == UART_OVERSAMPLING_16) || \
Kojto 107:4f6c30876dfa 1060 ((__SAMPLING__) == UART_OVERSAMPLING_8))
Kojto 107:4f6c30876dfa 1061
Kojto 107:4f6c30876dfa 1062 /**
Kojto 107:4f6c30876dfa 1063 * @brief Ensure that UART frame sampling is valid.
Kojto 107:4f6c30876dfa 1064 * @param __ONEBIT__: UART frame sampling.
Kojto 107:4f6c30876dfa 1065 * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid)
Kojto 107:4f6c30876dfa 1066 */
Kojto 107:4f6c30876dfa 1067 #define IS_UART_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == UART_ONE_BIT_SAMPLE_DISABLE) || \
Kojto 107:4f6c30876dfa 1068 ((__ONEBIT__) == UART_ONE_BIT_SAMPLE_ENABLE))
Kojto 107:4f6c30876dfa 1069
Kojto 107:4f6c30876dfa 1070 /**
Kojto 107:4f6c30876dfa 1071 * @brief Ensure that UART auto Baud rate detection mode is valid.
Kojto 107:4f6c30876dfa 1072 * @param __MODE__: UART auto Baud rate detection mode.
Kojto 107:4f6c30876dfa 1073 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 107:4f6c30876dfa 1074 */
Kojto 107:4f6c30876dfa 1075 #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(__MODE__) (((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
Kojto 107:4f6c30876dfa 1076 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \
Kojto 107:4f6c30876dfa 1077 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \
Kojto 107:4f6c30876dfa 1078 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME))
Kojto 107:4f6c30876dfa 1079
Kojto 107:4f6c30876dfa 1080 /**
Kojto 107:4f6c30876dfa 1081 * @brief Ensure that UART receiver timeout setting is valid.
Kojto 107:4f6c30876dfa 1082 * @param __TIMEOUT__: UART receiver timeout setting.
Kojto 107:4f6c30876dfa 1083 * @retval SET (__TIMEOUT__ is valid) or RESET (__TIMEOUT__ is invalid)
Kojto 107:4f6c30876dfa 1084 */
Kojto 107:4f6c30876dfa 1085 #define IS_UART_RECEIVER_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_DISABLE) || \
Kojto 107:4f6c30876dfa 1086 ((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_ENABLE))
Kojto 107:4f6c30876dfa 1087
Kojto 107:4f6c30876dfa 1088 /**
Kojto 107:4f6c30876dfa 1089 * @brief Ensure that UART LIN state is valid.
Kojto 107:4f6c30876dfa 1090 * @param __LIN__: UART LIN state.
Kojto 107:4f6c30876dfa 1091 * @retval SET (__LIN__ is valid) or RESET (__LIN__ is invalid)
Kojto 107:4f6c30876dfa 1092 */
Kojto 107:4f6c30876dfa 1093 #define IS_UART_LIN(__LIN__) (((__LIN__) == UART_LIN_DISABLE) || \
Kojto 107:4f6c30876dfa 1094 ((__LIN__) == UART_LIN_ENABLE))
Kojto 107:4f6c30876dfa 1095
Kojto 107:4f6c30876dfa 1096 /**
Kojto 107:4f6c30876dfa 1097 * @brief Ensure that UART LIN break detection length is valid.
Kojto 107:4f6c30876dfa 1098 * @param __LENGTH__: UART LIN break detection length.
Kojto 107:4f6c30876dfa 1099 * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
Kojto 107:4f6c30876dfa 1100 */
Kojto 107:4f6c30876dfa 1101 #define IS_UART_LIN_BREAK_DETECT_LENGTH(__LENGTH__) (((__LENGTH__) == UART_LINBREAKDETECTLENGTH_10B) || \
Kojto 107:4f6c30876dfa 1102 ((__LENGTH__) == UART_LINBREAKDETECTLENGTH_11B))
Kojto 107:4f6c30876dfa 1103
Kojto 107:4f6c30876dfa 1104 /**
Kojto 107:4f6c30876dfa 1105 * @brief Ensure that UART DMA TX state is valid.
Kojto 107:4f6c30876dfa 1106 * @param __DMATX__: UART DMA TX state.
Kojto 107:4f6c30876dfa 1107 * @retval SET (__DMATX__ is valid) or RESET (__DMATX__ is invalid)
Kojto 107:4f6c30876dfa 1108 */
Kojto 107:4f6c30876dfa 1109 #define IS_UART_DMA_TX(__DMATX__) (((__DMATX__) == UART_DMA_TX_DISABLE) || \
Kojto 107:4f6c30876dfa 1110 ((__DMATX__) == UART_DMA_TX_ENABLE))
Kojto 107:4f6c30876dfa 1111
Kojto 107:4f6c30876dfa 1112 /**
Kojto 107:4f6c30876dfa 1113 * @brief Ensure that UART DMA RX state is valid.
Kojto 107:4f6c30876dfa 1114 * @param __DMARX__: UART DMA RX state.
Kojto 107:4f6c30876dfa 1115 * @retval SET (__DMARX__ is valid) or RESET (__DMARX__ is invalid)
Kojto 107:4f6c30876dfa 1116 */
Kojto 107:4f6c30876dfa 1117 #define IS_UART_DMA_RX(__DMARX__) (((__DMARX__) == UART_DMA_RX_DISABLE) || \
Kojto 107:4f6c30876dfa 1118 ((__DMARX__) == UART_DMA_RX_ENABLE))
Kojto 107:4f6c30876dfa 1119
Kojto 107:4f6c30876dfa 1120 /**
Kojto 107:4f6c30876dfa 1121 * @brief Ensure that UART half-duplex state is valid.
Kojto 107:4f6c30876dfa 1122 * @param __HDSEL__: UART half-duplex state.
Kojto 107:4f6c30876dfa 1123 * @retval SET (__HDSEL__ is valid) or RESET (__HDSEL__ is invalid)
Kojto 107:4f6c30876dfa 1124 */
Kojto 107:4f6c30876dfa 1125 #define IS_UART_HALF_DUPLEX(__HDSEL__) (((__HDSEL__) == UART_HALF_DUPLEX_DISABLE) || \
Kojto 107:4f6c30876dfa 1126 ((__HDSEL__) == UART_HALF_DUPLEX_ENABLE))
Kojto 107:4f6c30876dfa 1127
Kojto 107:4f6c30876dfa 1128 /**
Kojto 107:4f6c30876dfa 1129 * @brief Ensure that UART wake-up method is valid.
Kojto 107:4f6c30876dfa 1130 * @param __WAKEUP__: UART wake-up method .
Kojto 107:4f6c30876dfa 1131 * @retval SET (__WAKEUP__ is valid) or RESET (__WAKEUP__ is invalid)
Kojto 107:4f6c30876dfa 1132 */
Kojto 107:4f6c30876dfa 1133 #define IS_UART_WAKEUPMETHOD(__WAKEUP__) (((__WAKEUP__) == UART_WAKEUPMETHOD_IDLELINE) || \
Kojto 107:4f6c30876dfa 1134 ((__WAKEUP__) == UART_WAKEUPMETHOD_ADDRESSMARK))
Kojto 107:4f6c30876dfa 1135
Kojto 107:4f6c30876dfa 1136 /**
Kojto 107:4f6c30876dfa 1137 * @brief Ensure that UART request parameter is valid.
Kojto 107:4f6c30876dfa 1138 * @param __PARAM__: UART request parameter.
Kojto 107:4f6c30876dfa 1139 * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid)
Kojto 107:4f6c30876dfa 1140 */
Kojto 107:4f6c30876dfa 1141 #define IS_UART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == UART_AUTOBAUD_REQUEST) || \
Kojto 107:4f6c30876dfa 1142 ((__PARAM__) == UART_SENDBREAK_REQUEST) || \
Kojto 107:4f6c30876dfa 1143 ((__PARAM__) == UART_MUTE_MODE_REQUEST) || \
Kojto 107:4f6c30876dfa 1144 ((__PARAM__) == UART_RXDATA_FLUSH_REQUEST) || \
Kojto 107:4f6c30876dfa 1145 ((__PARAM__) == UART_TXDATA_FLUSH_REQUEST))
Kojto 107:4f6c30876dfa 1146
Kojto 107:4f6c30876dfa 1147 /**
Kojto 107:4f6c30876dfa 1148 * @brief Ensure that UART advanced features initialization is valid.
Kojto 107:4f6c30876dfa 1149 * @param __INIT__: UART advanced features initialization.
Kojto 107:4f6c30876dfa 1150 * @retval SET (__INIT__ is valid) or RESET (__INIT__ is invalid)
Kojto 107:4f6c30876dfa 1151 */
Kojto 107:4f6c30876dfa 1152 #define IS_UART_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (UART_ADVFEATURE_NO_INIT | \
Kojto 107:4f6c30876dfa 1153 UART_ADVFEATURE_TXINVERT_INIT | \
Kojto 107:4f6c30876dfa 1154 UART_ADVFEATURE_RXINVERT_INIT | \
Kojto 107:4f6c30876dfa 1155 UART_ADVFEATURE_DATAINVERT_INIT | \
Kojto 107:4f6c30876dfa 1156 UART_ADVFEATURE_SWAP_INIT | \
Kojto 107:4f6c30876dfa 1157 UART_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
Kojto 107:4f6c30876dfa 1158 UART_ADVFEATURE_DMADISABLEONERROR_INIT | \
Kojto 107:4f6c30876dfa 1159 UART_ADVFEATURE_AUTOBAUDRATE_INIT | \
Kojto 107:4f6c30876dfa 1160 UART_ADVFEATURE_MSBFIRST_INIT))
Kojto 107:4f6c30876dfa 1161
Kojto 107:4f6c30876dfa 1162 /**
Kojto 107:4f6c30876dfa 1163 * @brief Ensure that UART frame TX inversion setting is valid.
Kojto 107:4f6c30876dfa 1164 * @param __TXINV__: UART frame TX inversion setting.
Kojto 107:4f6c30876dfa 1165 * @retval SET (__TXINV__ is valid) or RESET (__TXINV__ is invalid)
Kojto 107:4f6c30876dfa 1166 */
Kojto 107:4f6c30876dfa 1167 #define IS_UART_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == UART_ADVFEATURE_TXINV_DISABLE) || \
Kojto 107:4f6c30876dfa 1168 ((__TXINV__) == UART_ADVFEATURE_TXINV_ENABLE))
Kojto 107:4f6c30876dfa 1169
Kojto 107:4f6c30876dfa 1170 /**
Kojto 107:4f6c30876dfa 1171 * @brief Ensure that UART frame RX inversion setting is valid.
Kojto 107:4f6c30876dfa 1172 * @param __RXINV__: UART frame RX inversion setting.
Kojto 107:4f6c30876dfa 1173 * @retval SET (__RXINV__ is valid) or RESET (__RXINV__ is invalid)
Kojto 107:4f6c30876dfa 1174 */
Kojto 107:4f6c30876dfa 1175 #define IS_UART_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == UART_ADVFEATURE_RXINV_DISABLE) || \
Kojto 107:4f6c30876dfa 1176 ((__RXINV__) == UART_ADVFEATURE_RXINV_ENABLE))
Kojto 107:4f6c30876dfa 1177
Kojto 107:4f6c30876dfa 1178 /**
Kojto 107:4f6c30876dfa 1179 * @brief Ensure that UART frame data inversion setting is valid.
Kojto 107:4f6c30876dfa 1180 * @param __DATAINV__: UART frame data inversion setting.
Kojto 107:4f6c30876dfa 1181 * @retval SET (__DATAINV__ is valid) or RESET (__DATAINV__ is invalid)
Kojto 107:4f6c30876dfa 1182 */
Kojto 107:4f6c30876dfa 1183 #define IS_UART_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == UART_ADVFEATURE_DATAINV_DISABLE) || \
Kojto 107:4f6c30876dfa 1184 ((__DATAINV__) == UART_ADVFEATURE_DATAINV_ENABLE))
Kojto 107:4f6c30876dfa 1185
Kojto 107:4f6c30876dfa 1186 /**
Kojto 107:4f6c30876dfa 1187 * @brief Ensure that UART frame RX/TX pins swap setting is valid.
Kojto 107:4f6c30876dfa 1188 * @param __SWAP__: UART frame RX/TX pins swap setting.
Kojto 107:4f6c30876dfa 1189 * @retval SET (__SWAP__ is valid) or RESET (__SWAP__ is invalid)
Kojto 107:4f6c30876dfa 1190 */
Kojto 107:4f6c30876dfa 1191 #define IS_UART_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == UART_ADVFEATURE_SWAP_DISABLE) || \
Kojto 107:4f6c30876dfa 1192 ((__SWAP__) == UART_ADVFEATURE_SWAP_ENABLE))
Kojto 107:4f6c30876dfa 1193
Kojto 107:4f6c30876dfa 1194 /**
Kojto 107:4f6c30876dfa 1195 * @brief Ensure that UART frame overrun setting is valid.
Kojto 107:4f6c30876dfa 1196 * @param __OVERRUN__: UART frame overrun setting.
Kojto 107:4f6c30876dfa 1197 * @retval SET (__OVERRUN__ is valid) or RESET (__OVERRUN__ is invalid)
Kojto 107:4f6c30876dfa 1198 */
Kojto 107:4f6c30876dfa 1199 #define IS_UART_OVERRUN(__OVERRUN__) (((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
Kojto 107:4f6c30876dfa 1200 ((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_DISABLE))
Kojto 107:4f6c30876dfa 1201
Kojto 107:4f6c30876dfa 1202 /**
Kojto 107:4f6c30876dfa 1203 * @brief Ensure that UART auto Baud rate state is valid.
Kojto 107:4f6c30876dfa 1204 * @param __AUTOBAUDRATE__: UART auto Baud rate state.
Kojto 107:4f6c30876dfa 1205 * @retval SET (__AUTOBAUDRATE__ is valid) or RESET (__AUTOBAUDRATE__ is invalid)
Kojto 107:4f6c30876dfa 1206 */
Kojto 107:4f6c30876dfa 1207 #define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__) (((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
Kojto 107:4f6c30876dfa 1208 ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))
Kojto 107:4f6c30876dfa 1209
Kojto 107:4f6c30876dfa 1210 /**
Kojto 107:4f6c30876dfa 1211 * @brief Ensure that UART DMA enabling or disabling on error setting is valid.
Kojto 107:4f6c30876dfa 1212 * @param __DMA__: UART DMA enabling or disabling on error setting.
Kojto 107:4f6c30876dfa 1213 * @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid)
Kojto 107:4f6c30876dfa 1214 */
Kojto 107:4f6c30876dfa 1215 #define IS_UART_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == UART_ADVFEATURE_DMA_ENABLEONRXERROR) || \
Kojto 107:4f6c30876dfa 1216 ((__DMA__) == UART_ADVFEATURE_DMA_DISABLEONRXERROR))
Kojto 107:4f6c30876dfa 1217
Kojto 107:4f6c30876dfa 1218 /**
Kojto 107:4f6c30876dfa 1219 * @brief Ensure that UART frame MSB first setting is valid.
Kojto 107:4f6c30876dfa 1220 * @param __MSBFIRST__: UART frame MSB first setting.
Kojto 107:4f6c30876dfa 1221 * @retval SET (__MSBFIRST__ is valid) or RESET (__MSBFIRST__ is invalid)
Kojto 107:4f6c30876dfa 1222 */
Kojto 107:4f6c30876dfa 1223 #define IS_UART_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
Kojto 107:4f6c30876dfa 1224 ((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_ENABLE))
Kojto 107:4f6c30876dfa 1225
Kojto 107:4f6c30876dfa 1226 /**
Kojto 107:4f6c30876dfa 1227 * @brief Ensure that UART stop mode state is valid.
Kojto 107:4f6c30876dfa 1228 * @param __STOPMODE__: UART stop mode state.
Kojto 107:4f6c30876dfa 1229 * @retval SET (__STOPMODE__ is valid) or RESET (__STOPMODE__ is invalid)
Kojto 107:4f6c30876dfa 1230 */
Kojto 107:4f6c30876dfa 1231 #define IS_UART_ADVFEATURE_STOPMODE(__STOPMODE__) (((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_DISABLE) || \
Kojto 107:4f6c30876dfa 1232 ((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_ENABLE))
Kojto 107:4f6c30876dfa 1233
Kojto 107:4f6c30876dfa 1234 /**
Kojto 107:4f6c30876dfa 1235 * @brief Ensure that UART mute mode state is valid.
Kojto 107:4f6c30876dfa 1236 * @param __MUTE__: UART mute mode state.
Kojto 107:4f6c30876dfa 1237 * @retval SET (__MUTE__ is valid) or RESET (__MUTE__ is invalid)
Kojto 107:4f6c30876dfa 1238 */
Kojto 107:4f6c30876dfa 1239 #define IS_UART_MUTE_MODE(__MUTE__) (((__MUTE__) == UART_ADVFEATURE_MUTEMODE_DISABLE) || \
Kojto 107:4f6c30876dfa 1240 ((__MUTE__) == UART_ADVFEATURE_MUTEMODE_ENABLE))
Kojto 107:4f6c30876dfa 1241
Kojto 107:4f6c30876dfa 1242 /**
Kojto 107:4f6c30876dfa 1243 * @brief Ensure that UART wake-up selection is valid.
Kojto 107:4f6c30876dfa 1244 * @param __WAKE__: UART wake-up selection.
Kojto 107:4f6c30876dfa 1245 * @retval SET (__WAKE__ is valid) or RESET (__WAKE__ is invalid)
Kojto 107:4f6c30876dfa 1246 */
Kojto 107:4f6c30876dfa 1247 #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \
Kojto 107:4f6c30876dfa 1248 ((__WAKE__) == UART_WAKEUP_ON_STARTBIT) || \
Kojto 107:4f6c30876dfa 1249 ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY))
Kojto 107:4f6c30876dfa 1250
Kojto 107:4f6c30876dfa 1251 /**
Kojto 107:4f6c30876dfa 1252 * @brief Ensure that UART driver enable polarity is valid.
Kojto 107:4f6c30876dfa 1253 * @param __POLARITY__: UART driver enable polarity.
Kojto 107:4f6c30876dfa 1254 * @retval SET (__POLARITY__ is valid) or RESET (__POLARITY__ is invalid)
Kojto 107:4f6c30876dfa 1255 */
Kojto 107:4f6c30876dfa 1256 #define IS_UART_DE_POLARITY(__POLARITY__) (((__POLARITY__) == UART_DE_POLARITY_HIGH) || \
Kojto 107:4f6c30876dfa 1257 ((__POLARITY__) == UART_DE_POLARITY_LOW))
Kojto 107:4f6c30876dfa 1258
Kojto 107:4f6c30876dfa 1259 /**
Kojto 107:4f6c30876dfa 1260 * @brief Ensure that LPUART frame number of stop bits is valid.
Kojto 107:4f6c30876dfa 1261 * @param __STOPBITS__: LPUART frame number of stop bits.
Kojto 107:4f6c30876dfa 1262 * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)
Kojto 107:4f6c30876dfa 1263 */
Kojto 107:4f6c30876dfa 1264 #define IS_LPUART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_1) || \
Kojto 107:4f6c30876dfa 1265 ((__STOPBITS__) == UART_STOPBITS_2))
Kojto 107:4f6c30876dfa 1266
Kojto 107:4f6c30876dfa 1267 /**
Kojto 107:4f6c30876dfa 1268 * @}
Kojto 107:4f6c30876dfa 1269 */
Kojto 107:4f6c30876dfa 1270
Kojto 107:4f6c30876dfa 1271 /* Include UART HAL Extended module */
Kojto 107:4f6c30876dfa 1272 #include "stm32l4xx_hal_uart_ex.h"
Kojto 107:4f6c30876dfa 1273
Kojto 107:4f6c30876dfa 1274 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 1275 /** @addtogroup UART_Exported_Functions UART Exported Functions
Kojto 107:4f6c30876dfa 1276 * @{
Kojto 107:4f6c30876dfa 1277 */
Kojto 107:4f6c30876dfa 1278
Kojto 107:4f6c30876dfa 1279 /** @addtogroup UART_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 107:4f6c30876dfa 1280 * @{
Kojto 107:4f6c30876dfa 1281 */
Kojto 107:4f6c30876dfa 1282
Kojto 107:4f6c30876dfa 1283 /* Initialization and de-initialization functions ****************************/
Kojto 107:4f6c30876dfa 1284 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1285 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1286 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
Kojto 107:4f6c30876dfa 1287 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
Kojto 107:4f6c30876dfa 1288 HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1289 void HAL_UART_MspInit(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1290 void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1291
Kojto 107:4f6c30876dfa 1292 /**
Kojto 107:4f6c30876dfa 1293 * @}
Kojto 107:4f6c30876dfa 1294 */
Kojto 107:4f6c30876dfa 1295
Kojto 107:4f6c30876dfa 1296 /** @addtogroup UART_Exported_Functions_Group2 IO operation functions
Kojto 107:4f6c30876dfa 1297 * @{
Kojto 107:4f6c30876dfa 1298 */
Kojto 107:4f6c30876dfa 1299
Kojto 107:4f6c30876dfa 1300 /* IO operation functions *****************************************************/
Kojto 107:4f6c30876dfa 1301 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
Kojto 107:4f6c30876dfa 1302 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
Kojto 107:4f6c30876dfa 1303 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
Kojto 107:4f6c30876dfa 1304 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
Kojto 107:4f6c30876dfa 1305 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
Kojto 107:4f6c30876dfa 1306 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
Kojto 107:4f6c30876dfa 1307 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1308 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1309 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1310 void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1311 void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1312 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1313 void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1314 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1315 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1316
Kojto 107:4f6c30876dfa 1317 /**
Kojto 107:4f6c30876dfa 1318 * @}
Kojto 107:4f6c30876dfa 1319 */
Kojto 107:4f6c30876dfa 1320
Kojto 107:4f6c30876dfa 1321 /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions
Kojto 107:4f6c30876dfa 1322 * @{
Kojto 107:4f6c30876dfa 1323 */
Kojto 107:4f6c30876dfa 1324
Kojto 107:4f6c30876dfa 1325 /* Peripheral Control functions ************************************************/
Kojto 107:4f6c30876dfa 1326 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1327 HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1328 HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1329 void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1330 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1331 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1332
Kojto 107:4f6c30876dfa 1333 /**
Kojto 107:4f6c30876dfa 1334 * @}
Kojto 107:4f6c30876dfa 1335 */
Kojto 107:4f6c30876dfa 1336
Kojto 107:4f6c30876dfa 1337 /** @addtogroup UART_Exported_Functions_Group4 Peripheral State and Error functions
Kojto 107:4f6c30876dfa 1338 * @{
Kojto 107:4f6c30876dfa 1339 */
Kojto 107:4f6c30876dfa 1340
Kojto 107:4f6c30876dfa 1341 /* Peripheral State and Errors functions **************************************************/
Kojto 107:4f6c30876dfa 1342 HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1343 uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1344
Kojto 107:4f6c30876dfa 1345 /**
Kojto 107:4f6c30876dfa 1346 * @}
Kojto 107:4f6c30876dfa 1347 */
Kojto 107:4f6c30876dfa 1348
Kojto 107:4f6c30876dfa 1349 /**
Kojto 107:4f6c30876dfa 1350 * @}
Kojto 107:4f6c30876dfa 1351 */
Kojto 107:4f6c30876dfa 1352
Kojto 107:4f6c30876dfa 1353 /* Private functions -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 1354 /** @addtogroup UART_Private_Functions UART Private Functions
Kojto 107:4f6c30876dfa 1355 * @{
Kojto 107:4f6c30876dfa 1356 */
Kojto 107:4f6c30876dfa 1357
Kojto 107:4f6c30876dfa 1358 HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1359 HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1360 HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Timeout);
Kojto 107:4f6c30876dfa 1361 void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
Kojto 107:4f6c30876dfa 1362
Kojto 107:4f6c30876dfa 1363 /**
Kojto 107:4f6c30876dfa 1364 * @}
Kojto 107:4f6c30876dfa 1365 */
Kojto 107:4f6c30876dfa 1366
Kojto 107:4f6c30876dfa 1367 /**
Kojto 107:4f6c30876dfa 1368 * @}
Kojto 107:4f6c30876dfa 1369 */
Kojto 107:4f6c30876dfa 1370
Kojto 107:4f6c30876dfa 1371 /**
Kojto 107:4f6c30876dfa 1372 * @}
Kojto 107:4f6c30876dfa 1373 */
Kojto 107:4f6c30876dfa 1374
Kojto 107:4f6c30876dfa 1375 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 1376 }
Kojto 107:4f6c30876dfa 1377 #endif
Kojto 107:4f6c30876dfa 1378
Kojto 107:4f6c30876dfa 1379 #endif /* __STM32L4xx_HAL_UART_H */
Kojto 107:4f6c30876dfa 1380
Kojto 107:4f6c30876dfa 1381 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/