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