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