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_L476RG/stm32l4xx_hal_usart.h@121:672067c3ada4, 2016-04-14 (annotated)
- Committer:
- elijahorr
- Date:
- Thu Apr 14 07:28:54 2016 +0000
- Revision:
- 121:672067c3ada4
- Parent:
- 107:4f6c30876dfa
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 107:4f6c30876dfa | 1 | /** |
Kojto | 107:4f6c30876dfa | 2 | ****************************************************************************** |
Kojto | 107:4f6c30876dfa | 3 | * @file stm32l4xx_hal_usart.h |
Kojto | 107:4f6c30876dfa | 4 | * @author MCD Application Team |
Kojto | 107:4f6c30876dfa | 5 | * @version V1.0.0 |
Kojto | 107:4f6c30876dfa | 6 | * @date 26-June-2015 |
Kojto | 107:4f6c30876dfa | 7 | * @brief Header file of USART HAL module. |
Kojto | 107:4f6c30876dfa | 8 | ****************************************************************************** |
Kojto | 107:4f6c30876dfa | 9 | * @attention |
Kojto | 107:4f6c30876dfa | 10 | * |
Kojto | 107:4f6c30876dfa | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 107:4f6c30876dfa | 12 | * |
Kojto | 107:4f6c30876dfa | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 107:4f6c30876dfa | 14 | * are permitted provided that the following conditions are met: |
Kojto | 107:4f6c30876dfa | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 107:4f6c30876dfa | 16 | * this list of conditions and the following disclaimer. |
Kojto | 107:4f6c30876dfa | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 107:4f6c30876dfa | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 107:4f6c30876dfa | 19 | * and/or other materials provided with the distribution. |
Kojto | 107:4f6c30876dfa | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 107:4f6c30876dfa | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 107:4f6c30876dfa | 22 | * without specific prior written permission. |
Kojto | 107:4f6c30876dfa | 23 | * |
Kojto | 107:4f6c30876dfa | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 107:4f6c30876dfa | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 107:4f6c30876dfa | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 107:4f6c30876dfa | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 107:4f6c30876dfa | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 107:4f6c30876dfa | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 107:4f6c30876dfa | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 107:4f6c30876dfa | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 107:4f6c30876dfa | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 107:4f6c30876dfa | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 107:4f6c30876dfa | 34 | * |
Kojto | 107:4f6c30876dfa | 35 | ****************************************************************************** |
Kojto | 107:4f6c30876dfa | 36 | */ |
Kojto | 107:4f6c30876dfa | 37 | |
Kojto | 107:4f6c30876dfa | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 39 | #ifndef __STM32L4xx_HAL_USART_H |
Kojto | 107:4f6c30876dfa | 40 | #define __STM32L4xx_HAL_USART_H |
Kojto | 107:4f6c30876dfa | 41 | |
Kojto | 107:4f6c30876dfa | 42 | #ifdef __cplusplus |
Kojto | 107:4f6c30876dfa | 43 | extern "C" { |
Kojto | 107:4f6c30876dfa | 44 | #endif |
Kojto | 107:4f6c30876dfa | 45 | |
Kojto | 107:4f6c30876dfa | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 47 | #include "stm32l4xx_hal_def.h" |
Kojto | 107:4f6c30876dfa | 48 | |
Kojto | 107:4f6c30876dfa | 49 | /** @addtogroup STM32L4xx_HAL_Driver |
Kojto | 107:4f6c30876dfa | 50 | * @{ |
Kojto | 107:4f6c30876dfa | 51 | */ |
Kojto | 107:4f6c30876dfa | 52 | |
Kojto | 107:4f6c30876dfa | 53 | /** @addtogroup USART |
Kojto | 107:4f6c30876dfa | 54 | * @{ |
Kojto | 107:4f6c30876dfa | 55 | */ |
Kojto | 107:4f6c30876dfa | 56 | |
Kojto | 107:4f6c30876dfa | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 58 | /** @defgroup USART_Exported_Types USART Exported Types |
Kojto | 107:4f6c30876dfa | 59 | * @{ |
Kojto | 107:4f6c30876dfa | 60 | */ |
Kojto | 107:4f6c30876dfa | 61 | |
Kojto | 107:4f6c30876dfa | 62 | /** |
Kojto | 107:4f6c30876dfa | 63 | * @brief USART Init Structure definition |
Kojto | 107:4f6c30876dfa | 64 | */ |
Kojto | 107:4f6c30876dfa | 65 | typedef struct |
Kojto | 107:4f6c30876dfa | 66 | { |
Kojto | 107:4f6c30876dfa | 67 | uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. |
Kojto | 107:4f6c30876dfa | 68 | The baud rate is computed using the following formula: |
Kojto | 107:4f6c30876dfa | 69 | Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate))). */ |
Kojto | 107:4f6c30876dfa | 70 | |
Kojto | 107:4f6c30876dfa | 71 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
Kojto | 107:4f6c30876dfa | 72 | This parameter can be a value of @ref USARTEx_Word_Length. */ |
Kojto | 107:4f6c30876dfa | 73 | |
Kojto | 107:4f6c30876dfa | 74 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
Kojto | 107:4f6c30876dfa | 75 | This parameter can be a value of @ref USART_Stop_Bits. */ |
Kojto | 107:4f6c30876dfa | 76 | |
Kojto | 107:4f6c30876dfa | 77 | uint32_t Parity; /*!< Specifies the parity mode. |
Kojto | 107:4f6c30876dfa | 78 | This parameter can be a value of @ref USART_Parity |
Kojto | 107:4f6c30876dfa | 79 | @note When parity is enabled, the computed parity is inserted |
Kojto | 107:4f6c30876dfa | 80 | at the MSB position of the transmitted data (9th bit when |
Kojto | 107:4f6c30876dfa | 81 | the word length is set to 9 data bits; 8th bit when the |
Kojto | 107:4f6c30876dfa | 82 | word length is set to 8 data bits). */ |
Kojto | 107:4f6c30876dfa | 83 | |
Kojto | 107:4f6c30876dfa | 84 | uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
Kojto | 107:4f6c30876dfa | 85 | This parameter can be a value of @ref USART_Mode. */ |
Kojto | 107:4f6c30876dfa | 86 | |
Kojto | 107:4f6c30876dfa | 87 | uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
Kojto | 107:4f6c30876dfa | 88 | This parameter can be a value of @ref USART_Clock_Polarity. */ |
Kojto | 107:4f6c30876dfa | 89 | |
Kojto | 107:4f6c30876dfa | 90 | uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
Kojto | 107:4f6c30876dfa | 91 | This parameter can be a value of @ref USART_Clock_Phase. */ |
Kojto | 107:4f6c30876dfa | 92 | |
Kojto | 107:4f6c30876dfa | 93 | uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
Kojto | 107:4f6c30876dfa | 94 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
Kojto | 107:4f6c30876dfa | 95 | This parameter can be a value of @ref USART_Last_Bit. */ |
Kojto | 107:4f6c30876dfa | 96 | }USART_InitTypeDef; |
Kojto | 107:4f6c30876dfa | 97 | |
Kojto | 107:4f6c30876dfa | 98 | /** |
Kojto | 107:4f6c30876dfa | 99 | * @brief HAL USART State structures definition |
Kojto | 107:4f6c30876dfa | 100 | */ |
Kojto | 107:4f6c30876dfa | 101 | typedef enum |
Kojto | 107:4f6c30876dfa | 102 | { |
Kojto | 107:4f6c30876dfa | 103 | HAL_USART_STATE_RESET = 0x00, /*!< Peripheral is not initialized */ |
Kojto | 107:4f6c30876dfa | 104 | HAL_USART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 107:4f6c30876dfa | 105 | HAL_USART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 107:4f6c30876dfa | 106 | HAL_USART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 107:4f6c30876dfa | 107 | HAL_USART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 107:4f6c30876dfa | 108 | HAL_USART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission Reception process is ongoing */ |
Kojto | 107:4f6c30876dfa | 109 | HAL_USART_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 107:4f6c30876dfa | 110 | HAL_USART_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 107:4f6c30876dfa | 111 | }HAL_USART_StateTypeDef; |
Kojto | 107:4f6c30876dfa | 112 | |
Kojto | 107:4f6c30876dfa | 113 | /** |
Kojto | 107:4f6c30876dfa | 114 | * @brief HAL USART Error Code structure definition |
Kojto | 107:4f6c30876dfa | 115 | */ |
Kojto | 107:4f6c30876dfa | 116 | typedef enum |
Kojto | 107:4f6c30876dfa | 117 | { |
Kojto | 107:4f6c30876dfa | 118 | HAL_USART_ERROR_NONE = 0x00, /*!< No error */ |
Kojto | 107:4f6c30876dfa | 119 | HAL_USART_ERROR_PE = 0x01, /*!< Parity error */ |
Kojto | 107:4f6c30876dfa | 120 | HAL_USART_ERROR_NE = 0x02, /*!< Noise error */ |
Kojto | 107:4f6c30876dfa | 121 | HAL_USART_ERROR_FE = 0x04, /*!< frame error */ |
Kojto | 107:4f6c30876dfa | 122 | HAL_USART_ERROR_ORE = 0x08, /*!< Overrun error */ |
Kojto | 107:4f6c30876dfa | 123 | HAL_USART_ERROR_DMA = 0x10 /*!< DMA transfer error */ |
Kojto | 107:4f6c30876dfa | 124 | }HAL_USART_ErrorTypeDef; |
Kojto | 107:4f6c30876dfa | 125 | |
Kojto | 107:4f6c30876dfa | 126 | /** |
Kojto | 107:4f6c30876dfa | 127 | * @brief USART clock sources definitions |
Kojto | 107:4f6c30876dfa | 128 | */ |
Kojto | 107:4f6c30876dfa | 129 | typedef enum |
Kojto | 107:4f6c30876dfa | 130 | { |
Kojto | 107:4f6c30876dfa | 131 | USART_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
Kojto | 107:4f6c30876dfa | 132 | USART_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */ |
Kojto | 107:4f6c30876dfa | 133 | USART_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
Kojto | 107:4f6c30876dfa | 134 | USART_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
Kojto | 107:4f6c30876dfa | 135 | USART_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */ |
Kojto | 107:4f6c30876dfa | 136 | USART_CLOCKSOURCE_UNDEFINED = 0x10 /*!< Undefined clock source */ |
Kojto | 107:4f6c30876dfa | 137 | }USART_ClockSourceTypeDef; |
Kojto | 107:4f6c30876dfa | 138 | |
Kojto | 107:4f6c30876dfa | 139 | |
Kojto | 107:4f6c30876dfa | 140 | /** |
Kojto | 107:4f6c30876dfa | 141 | * @brief USART handle Structure definition |
Kojto | 107:4f6c30876dfa | 142 | */ |
Kojto | 107:4f6c30876dfa | 143 | typedef struct |
Kojto | 107:4f6c30876dfa | 144 | { |
Kojto | 107:4f6c30876dfa | 145 | USART_TypeDef *Instance; /*!< USART registers base address */ |
Kojto | 107:4f6c30876dfa | 146 | |
Kojto | 107:4f6c30876dfa | 147 | USART_InitTypeDef Init; /*!< USART communication parameters */ |
Kojto | 107:4f6c30876dfa | 148 | |
Kojto | 107:4f6c30876dfa | 149 | uint8_t *pTxBuffPtr; /*!< Pointer to USART Tx transfer Buffer */ |
Kojto | 107:4f6c30876dfa | 150 | |
Kojto | 107:4f6c30876dfa | 151 | uint16_t TxXferSize; /*!< USART Tx Transfer size */ |
Kojto | 107:4f6c30876dfa | 152 | |
Kojto | 107:4f6c30876dfa | 153 | uint16_t TxXferCount; /*!< USART Tx Transfer Counter */ |
Kojto | 107:4f6c30876dfa | 154 | |
Kojto | 107:4f6c30876dfa | 155 | uint8_t *pRxBuffPtr; /*!< Pointer to USART Rx transfer Buffer */ |
Kojto | 107:4f6c30876dfa | 156 | |
Kojto | 107:4f6c30876dfa | 157 | uint16_t RxXferSize; /*!< USART Rx Transfer size */ |
Kojto | 107:4f6c30876dfa | 158 | |
Kojto | 107:4f6c30876dfa | 159 | uint16_t RxXferCount; /*!< USART Rx Transfer Counter */ |
Kojto | 107:4f6c30876dfa | 160 | |
Kojto | 107:4f6c30876dfa | 161 | uint16_t Mask; /*!< USART Rx RDR register mask */ |
Kojto | 107:4f6c30876dfa | 162 | |
Kojto | 107:4f6c30876dfa | 163 | DMA_HandleTypeDef *hdmatx; /*!< USART Tx DMA Handle parameters */ |
Kojto | 107:4f6c30876dfa | 164 | |
Kojto | 107:4f6c30876dfa | 165 | DMA_HandleTypeDef *hdmarx; /*!< USART Rx DMA Handle parameters */ |
Kojto | 107:4f6c30876dfa | 166 | |
Kojto | 107:4f6c30876dfa | 167 | HAL_LockTypeDef Lock; /*!< Locking object */ |
Kojto | 107:4f6c30876dfa | 168 | |
Kojto | 107:4f6c30876dfa | 169 | __IO HAL_USART_StateTypeDef State; /*!< USART communication state */ |
Kojto | 107:4f6c30876dfa | 170 | |
Kojto | 107:4f6c30876dfa | 171 | __IO uint32_t ErrorCode; /*!< USART Error code */ |
Kojto | 107:4f6c30876dfa | 172 | |
Kojto | 107:4f6c30876dfa | 173 | }USART_HandleTypeDef; |
Kojto | 107:4f6c30876dfa | 174 | |
Kojto | 107:4f6c30876dfa | 175 | /** |
Kojto | 107:4f6c30876dfa | 176 | * @} |
Kojto | 107:4f6c30876dfa | 177 | */ |
Kojto | 107:4f6c30876dfa | 178 | |
Kojto | 107:4f6c30876dfa | 179 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 180 | /** @defgroup USART_Exported_Constants USART Exported Constants |
Kojto | 107:4f6c30876dfa | 181 | * @{ |
Kojto | 107:4f6c30876dfa | 182 | */ |
Kojto | 107:4f6c30876dfa | 183 | |
Kojto | 107:4f6c30876dfa | 184 | /** @defgroup USART_Stop_Bits USART Number of Stop Bits |
Kojto | 107:4f6c30876dfa | 185 | * @{ |
Kojto | 107:4f6c30876dfa | 186 | */ |
Kojto | 107:4f6c30876dfa | 187 | #define USART_STOPBITS_1 ((uint32_t)0x00000000) /*!< USART frame with 1 stop bit */ |
Kojto | 107:4f6c30876dfa | 188 | #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) /*!< USART frame with 1.5 stop bits */ |
Kojto | 107:4f6c30876dfa | 189 | #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) /*!< USART frame with 2 stop bits */ |
Kojto | 107:4f6c30876dfa | 190 | /** |
Kojto | 107:4f6c30876dfa | 191 | * @} |
Kojto | 107:4f6c30876dfa | 192 | */ |
Kojto | 107:4f6c30876dfa | 193 | |
Kojto | 107:4f6c30876dfa | 194 | /** @defgroup USART_Parity USART Parity |
Kojto | 107:4f6c30876dfa | 195 | * @{ |
Kojto | 107:4f6c30876dfa | 196 | */ |
Kojto | 107:4f6c30876dfa | 197 | #define USART_PARITY_NONE ((uint32_t)0x00000000) /*!< No parity */ |
Kojto | 107:4f6c30876dfa | 198 | #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) /*!< Even parity */ |
Kojto | 107:4f6c30876dfa | 199 | #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) /*!< Odd parity */ |
Kojto | 107:4f6c30876dfa | 200 | /** |
Kojto | 107:4f6c30876dfa | 201 | * @} |
Kojto | 107:4f6c30876dfa | 202 | */ |
Kojto | 107:4f6c30876dfa | 203 | |
Kojto | 107:4f6c30876dfa | 204 | /** @defgroup USART_Mode USART Mode |
Kojto | 107:4f6c30876dfa | 205 | * @{ |
Kojto | 107:4f6c30876dfa | 206 | */ |
Kojto | 107:4f6c30876dfa | 207 | #define USART_MODE_RX ((uint32_t)USART_CR1_RE) /*!< RX mode */ |
Kojto | 107:4f6c30876dfa | 208 | #define USART_MODE_TX ((uint32_t)USART_CR1_TE) /*!< TX mode */ |
Kojto | 107:4f6c30876dfa | 209 | #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) /*!< RX and TX mode */ |
Kojto | 107:4f6c30876dfa | 210 | /** |
Kojto | 107:4f6c30876dfa | 211 | * @} |
Kojto | 107:4f6c30876dfa | 212 | */ |
Kojto | 107:4f6c30876dfa | 213 | |
Kojto | 107:4f6c30876dfa | 214 | /** @defgroup USART_Over_Sampling USART Over Sampling |
Kojto | 107:4f6c30876dfa | 215 | * @{ |
Kojto | 107:4f6c30876dfa | 216 | */ |
Kojto | 107:4f6c30876dfa | 217 | #define USART_OVERSAMPLING_16 ((uint32_t)0x00000000) /*!< Oversampling by 16 */ |
Kojto | 107:4f6c30876dfa | 218 | #define USART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8) /*!< Oversampling by 8 */ |
Kojto | 107:4f6c30876dfa | 219 | /** |
Kojto | 107:4f6c30876dfa | 220 | * @} |
Kojto | 107:4f6c30876dfa | 221 | */ |
Kojto | 107:4f6c30876dfa | 222 | |
Kojto | 107:4f6c30876dfa | 223 | /** @defgroup USART_Clock USART Clock |
Kojto | 107:4f6c30876dfa | 224 | * @{ |
Kojto | 107:4f6c30876dfa | 225 | */ |
Kojto | 107:4f6c30876dfa | 226 | #define USART_CLOCK_DISABLE ((uint32_t)0x00000000) /*!< USART clock disable */ |
Kojto | 107:4f6c30876dfa | 227 | #define USART_CLOCK_ENABLE ((uint32_t)USART_CR2_CLKEN) /*!< USART clock enable */ |
Kojto | 107:4f6c30876dfa | 228 | /** |
Kojto | 107:4f6c30876dfa | 229 | * @} |
Kojto | 107:4f6c30876dfa | 230 | */ |
Kojto | 107:4f6c30876dfa | 231 | |
Kojto | 107:4f6c30876dfa | 232 | /** @defgroup USART_Clock_Polarity USART Clock Polarity |
Kojto | 107:4f6c30876dfa | 233 | * @{ |
Kojto | 107:4f6c30876dfa | 234 | */ |
Kojto | 107:4f6c30876dfa | 235 | #define USART_POLARITY_LOW ((uint32_t)0x00000000) /*!< Driver enable signal is active high */ |
Kojto | 107:4f6c30876dfa | 236 | #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) /*!< Driver enable signal is active low */ |
Kojto | 107:4f6c30876dfa | 237 | /** |
Kojto | 107:4f6c30876dfa | 238 | * @} |
Kojto | 107:4f6c30876dfa | 239 | */ |
Kojto | 107:4f6c30876dfa | 240 | |
Kojto | 107:4f6c30876dfa | 241 | /** @defgroup USART_Clock_Phase USART Clock Phase |
Kojto | 107:4f6c30876dfa | 242 | * @{ |
Kojto | 107:4f6c30876dfa | 243 | */ |
Kojto | 107:4f6c30876dfa | 244 | #define USART_PHASE_1EDGE ((uint32_t)0x00000000) /*!< USART frame phase on first clock transition */ |
Kojto | 107:4f6c30876dfa | 245 | #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) /*!< USART frame phase on second clock transition */ |
Kojto | 107:4f6c30876dfa | 246 | /** |
Kojto | 107:4f6c30876dfa | 247 | * @} |
Kojto | 107:4f6c30876dfa | 248 | */ |
Kojto | 107:4f6c30876dfa | 249 | |
Kojto | 107:4f6c30876dfa | 250 | /** @defgroup USART_Last_Bit USART Last Bit |
Kojto | 107:4f6c30876dfa | 251 | * @{ |
Kojto | 107:4f6c30876dfa | 252 | */ |
Kojto | 107:4f6c30876dfa | 253 | #define USART_LASTBIT_DISABLE ((uint32_t)0x00000000) /*!< USART frame last data bit clock pulse not output to SCLK pin */ |
Kojto | 107:4f6c30876dfa | 254 | #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) /*!< USART frame last data bit clock pulse output to SCLK pin */ |
Kojto | 107:4f6c30876dfa | 255 | /** |
Kojto | 107:4f6c30876dfa | 256 | * @} |
Kojto | 107:4f6c30876dfa | 257 | */ |
Kojto | 107:4f6c30876dfa | 258 | |
Kojto | 107:4f6c30876dfa | 259 | /** @defgroup USART_Request_Parameters USART Request Parameters |
Kojto | 107:4f6c30876dfa | 260 | * @{ |
Kojto | 107:4f6c30876dfa | 261 | */ |
Kojto | 107:4f6c30876dfa | 262 | #define USART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
Kojto | 107:4f6c30876dfa | 263 | #define USART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
Kojto | 107:4f6c30876dfa | 264 | /** |
Kojto | 107:4f6c30876dfa | 265 | * @} |
Kojto | 107:4f6c30876dfa | 266 | */ |
Kojto | 107:4f6c30876dfa | 267 | |
Kojto | 107:4f6c30876dfa | 268 | /** @defgroup USART_Flags USART Flags |
Kojto | 107:4f6c30876dfa | 269 | * Elements values convention: 0xXXXX |
Kojto | 107:4f6c30876dfa | 270 | * - 0xXXXX : Flag mask in the ISR register |
Kojto | 107:4f6c30876dfa | 271 | * @{ |
Kojto | 107:4f6c30876dfa | 272 | */ |
Kojto | 107:4f6c30876dfa | 273 | #define USART_FLAG_REACK ((uint32_t)0x00400000) /*!< USART receive enable acknowledge flag */ |
Kojto | 107:4f6c30876dfa | 274 | #define USART_FLAG_TEACK ((uint32_t)0x00200000) /*!< USART transmit enable acknowledge flag */ |
Kojto | 107:4f6c30876dfa | 275 | #define USART_FLAG_BUSY ((uint32_t)0x00010000) /*!< USART busy flag */ |
Kojto | 107:4f6c30876dfa | 276 | #define USART_FLAG_CTS ((uint32_t)0x00000400) /*!< USART clear to send flag */ |
Kojto | 107:4f6c30876dfa | 277 | #define USART_FLAG_CTSIF ((uint32_t)0x00000200) /*!< USART clear to send interrupt flag */ |
Kojto | 107:4f6c30876dfa | 278 | #define USART_FLAG_LBDF ((uint32_t)0x00000100) /*!< USART LIN break detection flag */ |
Kojto | 107:4f6c30876dfa | 279 | #define USART_FLAG_TXE ((uint32_t)0x00000080) /*!< USART transmit data register empty */ |
Kojto | 107:4f6c30876dfa | 280 | #define USART_FLAG_TC ((uint32_t)0x00000040) /*!< USART transmission complete */ |
Kojto | 107:4f6c30876dfa | 281 | #define USART_FLAG_RXNE ((uint32_t)0x00000020) /*!< USART read data register not empty */ |
Kojto | 107:4f6c30876dfa | 282 | #define USART_FLAG_IDLE ((uint32_t)0x00000010) /*!< USART idle flag */ |
Kojto | 107:4f6c30876dfa | 283 | #define USART_FLAG_ORE ((uint32_t)0x00000008) /*!< USART overrun error */ |
Kojto | 107:4f6c30876dfa | 284 | #define USART_FLAG_NE ((uint32_t)0x00000004) /*!< USART noise error */ |
Kojto | 107:4f6c30876dfa | 285 | #define USART_FLAG_FE ((uint32_t)0x00000002) /*!< USART frame error */ |
Kojto | 107:4f6c30876dfa | 286 | #define USART_FLAG_PE ((uint32_t)0x00000001) /*!< USART parity error */ |
Kojto | 107:4f6c30876dfa | 287 | /** |
Kojto | 107:4f6c30876dfa | 288 | * @} |
Kojto | 107:4f6c30876dfa | 289 | */ |
Kojto | 107:4f6c30876dfa | 290 | |
Kojto | 107:4f6c30876dfa | 291 | /** @defgroup USART_Interrupt_definition USART Interrupts Definition |
Kojto | 107:4f6c30876dfa | 292 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
Kojto | 107:4f6c30876dfa | 293 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 107:4f6c30876dfa | 294 | * - XX : Interrupt source register (2bits) |
Kojto | 107:4f6c30876dfa | 295 | * - 01: CR1 register |
Kojto | 107:4f6c30876dfa | 296 | * - 10: CR2 register |
Kojto | 107:4f6c30876dfa | 297 | * - 11: CR3 register |
Kojto | 107:4f6c30876dfa | 298 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 107:4f6c30876dfa | 299 | * @{ |
Kojto | 107:4f6c30876dfa | 300 | */ |
Kojto | 107:4f6c30876dfa | 301 | |
Kojto | 107:4f6c30876dfa | 302 | #define USART_IT_PE ((uint16_t)0x0028) /*!< USART parity error interruption */ |
Kojto | 107:4f6c30876dfa | 303 | #define USART_IT_TXE ((uint16_t)0x0727) /*!< USART transmit data register empty interruption */ |
Kojto | 107:4f6c30876dfa | 304 | #define USART_IT_TC ((uint16_t)0x0626) /*!< USART transmission complete interruption */ |
Kojto | 107:4f6c30876dfa | 305 | #define USART_IT_RXNE ((uint16_t)0x0525) /*!< USART read data register not empty interruption */ |
Kojto | 107:4f6c30876dfa | 306 | #define USART_IT_IDLE ((uint16_t)0x0424) /*!< USART idle interruption */ |
Kojto | 107:4f6c30876dfa | 307 | #define USART_IT_ERR ((uint16_t)0x0060) /*!< USART error interruption */ |
Kojto | 107:4f6c30876dfa | 308 | #define USART_IT_ORE ((uint16_t)0x0300) /*!< USART overrun error interruption */ |
Kojto | 107:4f6c30876dfa | 309 | #define USART_IT_NE ((uint16_t)0x0200) /*!< USART noise error interruption */ |
Kojto | 107:4f6c30876dfa | 310 | #define USART_IT_FE ((uint16_t)0x0100) /*!< USART frame error interruption */ |
Kojto | 107:4f6c30876dfa | 311 | /** |
Kojto | 107:4f6c30876dfa | 312 | * @} |
Kojto | 107:4f6c30876dfa | 313 | */ |
Kojto | 107:4f6c30876dfa | 314 | |
Kojto | 107:4f6c30876dfa | 315 | /** @defgroup USART_IT_CLEAR_Flags USART Interruption Clear Flags |
Kojto | 107:4f6c30876dfa | 316 | * @{ |
Kojto | 107:4f6c30876dfa | 317 | */ |
Kojto | 107:4f6c30876dfa | 318 | #define USART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
Kojto | 107:4f6c30876dfa | 319 | #define USART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
Kojto | 107:4f6c30876dfa | 320 | #define USART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
Kojto | 107:4f6c30876dfa | 321 | #define USART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
Kojto | 107:4f6c30876dfa | 322 | #define USART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
Kojto | 107:4f6c30876dfa | 323 | #define USART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
Kojto | 107:4f6c30876dfa | 324 | #define USART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
Kojto | 107:4f6c30876dfa | 325 | /** |
Kojto | 107:4f6c30876dfa | 326 | * @} |
Kojto | 107:4f6c30876dfa | 327 | */ |
Kojto | 107:4f6c30876dfa | 328 | |
Kojto | 107:4f6c30876dfa | 329 | /** @defgroup USART_Interruption_Mask USART Interruption Flags Mask |
Kojto | 107:4f6c30876dfa | 330 | * @{ |
Kojto | 107:4f6c30876dfa | 331 | */ |
Kojto | 107:4f6c30876dfa | 332 | #define USART_IT_MASK ((uint16_t)0x001F) /*!< USART interruptions flags mask */ |
Kojto | 107:4f6c30876dfa | 333 | /** |
Kojto | 107:4f6c30876dfa | 334 | * @} |
Kojto | 107:4f6c30876dfa | 335 | */ |
Kojto | 107:4f6c30876dfa | 336 | |
Kojto | 107:4f6c30876dfa | 337 | /** |
Kojto | 107:4f6c30876dfa | 338 | * @} |
Kojto | 107:4f6c30876dfa | 339 | */ |
Kojto | 107:4f6c30876dfa | 340 | |
Kojto | 107:4f6c30876dfa | 341 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 342 | /** @defgroup USART_Exported_Macros USART Exported Macros |
Kojto | 107:4f6c30876dfa | 343 | * @{ |
Kojto | 107:4f6c30876dfa | 344 | */ |
Kojto | 107:4f6c30876dfa | 345 | |
Kojto | 107:4f6c30876dfa | 346 | /** @brief Reset USART handle state. |
Kojto | 107:4f6c30876dfa | 347 | * @param __HANDLE__: USART handle. |
Kojto | 107:4f6c30876dfa | 348 | * @retval None |
Kojto | 107:4f6c30876dfa | 349 | */ |
Kojto | 107:4f6c30876dfa | 350 | #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET) |
Kojto | 107:4f6c30876dfa | 351 | |
Kojto | 107:4f6c30876dfa | 352 | /** @brief Check whether the specified USART flag is set or not. |
Kojto | 107:4f6c30876dfa | 353 | * @param __HANDLE__: specifies the USART Handle |
Kojto | 107:4f6c30876dfa | 354 | * @param __FLAG__: specifies the flag to check. |
Kojto | 107:4f6c30876dfa | 355 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 356 | * @arg USART_FLAG_REACK: Receive enable acknowledge flag |
Kojto | 107:4f6c30876dfa | 357 | * @arg USART_FLAG_TEACK: Transmit enable acknowledge flag |
Kojto | 107:4f6c30876dfa | 358 | * @arg USART_FLAG_BUSY: Busy flag |
Kojto | 107:4f6c30876dfa | 359 | * @arg USART_FLAG_CTS: CTS Change flag |
Kojto | 107:4f6c30876dfa | 360 | * @arg USART_FLAG_TXE: Transmit data register empty flag |
Kojto | 107:4f6c30876dfa | 361 | * @arg USART_FLAG_TC: Transmission Complete flag |
Kojto | 107:4f6c30876dfa | 362 | * @arg USART_FLAG_RXNE: Receive data register not empty flag |
Kojto | 107:4f6c30876dfa | 363 | * @arg USART_FLAG_IDLE: Idle Line detection flag |
Kojto | 107:4f6c30876dfa | 364 | * @arg USART_FLAG_ORE: OverRun Error flag |
Kojto | 107:4f6c30876dfa | 365 | * @arg USART_FLAG_NE: Noise Error flag |
Kojto | 107:4f6c30876dfa | 366 | * @arg USART_FLAG_FE: Framing Error flag |
Kojto | 107:4f6c30876dfa | 367 | * @arg USART_FLAG_PE: Parity Error flag |
Kojto | 107:4f6c30876dfa | 368 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 107:4f6c30876dfa | 369 | */ |
Kojto | 107:4f6c30876dfa | 370 | #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
Kojto | 107:4f6c30876dfa | 371 | |
Kojto | 107:4f6c30876dfa | 372 | /** @brief Clear the specified USART pending flag. |
Kojto | 107:4f6c30876dfa | 373 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 374 | * @param __FLAG__: specifies the flag to check. |
Kojto | 107:4f6c30876dfa | 375 | * This parameter can be any combination of the following values: |
Kojto | 107:4f6c30876dfa | 376 | * @arg USART_CLEAR_PEF |
Kojto | 107:4f6c30876dfa | 377 | * @arg USART_CLEAR_FEF |
Kojto | 107:4f6c30876dfa | 378 | * @arg USART_CLEAR_NEF |
Kojto | 107:4f6c30876dfa | 379 | * @arg USART_CLEAR_OREF |
Kojto | 107:4f6c30876dfa | 380 | * @arg USART_CLEAR_IDLEF |
Kojto | 107:4f6c30876dfa | 381 | * @arg USART_CLEAR_TCF |
Kojto | 107:4f6c30876dfa | 382 | * @arg USART_CLEAR_LBDF |
Kojto | 107:4f6c30876dfa | 383 | * @arg USART_CLEAR_CTSF |
Kojto | 107:4f6c30876dfa | 384 | * @arg USART_CLEAR_RTOF |
Kojto | 107:4f6c30876dfa | 385 | * @arg USART_CLEAR_EOBF |
Kojto | 107:4f6c30876dfa | 386 | * @arg USART_CLEAR_CMF |
Kojto | 107:4f6c30876dfa | 387 | * @arg USART_CLEAR_WUF |
Kojto | 107:4f6c30876dfa | 388 | * @retval None |
Kojto | 107:4f6c30876dfa | 389 | */ |
Kojto | 107:4f6c30876dfa | 390 | #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
Kojto | 107:4f6c30876dfa | 391 | |
Kojto | 107:4f6c30876dfa | 392 | /** @brief Clear the USART PE pending flag. |
Kojto | 107:4f6c30876dfa | 393 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 394 | * @retval None |
Kojto | 107:4f6c30876dfa | 395 | */ |
Kojto | 107:4f6c30876dfa | 396 | #define __HAL_USART_CLEAR_PEFLAG(__HANDLE__) __HAL_USART_CLEAR_FLAG((__HANDLE__), USART_CLEAR_PEF) |
Kojto | 107:4f6c30876dfa | 397 | |
Kojto | 107:4f6c30876dfa | 398 | /** @brief Clear the USART FE pending flag. |
Kojto | 107:4f6c30876dfa | 399 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 400 | * @retval None |
Kojto | 107:4f6c30876dfa | 401 | */ |
Kojto | 107:4f6c30876dfa | 402 | #define __HAL_USART_CLEAR_FEFLAG(__HANDLE__) __HAL_USART_CLEAR_FLAG((__HANDLE__), USART_CLEAR_FEF) |
Kojto | 107:4f6c30876dfa | 403 | |
Kojto | 107:4f6c30876dfa | 404 | /** @brief Clear the USART NE pending flag. |
Kojto | 107:4f6c30876dfa | 405 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 406 | * @retval None |
Kojto | 107:4f6c30876dfa | 407 | */ |
Kojto | 107:4f6c30876dfa | 408 | #define __HAL_USART_CLEAR_NEFLAG(__HANDLE__) __HAL_USART_CLEAR_FLAG((__HANDLE__), USART_CLEAR_NEF) |
Kojto | 107:4f6c30876dfa | 409 | |
Kojto | 107:4f6c30876dfa | 410 | /** @brief Clear the USART ORE pending flag. |
Kojto | 107:4f6c30876dfa | 411 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 412 | * @retval None |
Kojto | 107:4f6c30876dfa | 413 | */ |
Kojto | 107:4f6c30876dfa | 414 | #define __HAL_USART_CLEAR_OREFLAG(__HANDLE__) __HAL_USART_CLEAR_FLAG((__HANDLE__), USART_CLEAR_OREF) |
Kojto | 107:4f6c30876dfa | 415 | |
Kojto | 107:4f6c30876dfa | 416 | /** @brief Clear the USART IDLE pending flag. |
Kojto | 107:4f6c30876dfa | 417 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 418 | * @retval None |
Kojto | 107:4f6c30876dfa | 419 | */ |
Kojto | 107:4f6c30876dfa | 420 | #define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_USART_CLEAR_FLAG((__HANDLE__), USART_CLEAR_IDLEF) |
Kojto | 107:4f6c30876dfa | 421 | |
Kojto | 107:4f6c30876dfa | 422 | /** @brief Enable the specified USART interrupt. |
Kojto | 107:4f6c30876dfa | 423 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 424 | * @param __INTERRUPT__: specifies the USART interrupt source to enable. |
Kojto | 107:4f6c30876dfa | 425 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 426 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 107:4f6c30876dfa | 427 | * @arg USART_IT_TC: Transmission complete interrupt |
Kojto | 107:4f6c30876dfa | 428 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 107:4f6c30876dfa | 429 | * @arg USART_IT_IDLE: Idle line detection interrupt |
Kojto | 107:4f6c30876dfa | 430 | * @arg USART_IT_PE: Parity Error interrupt |
Kojto | 107:4f6c30876dfa | 431 | * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 107:4f6c30876dfa | 432 | * @retval None |
Kojto | 107:4f6c30876dfa | 433 | */ |
Kojto | 107:4f6c30876dfa | 434 | #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
Kojto | 107:4f6c30876dfa | 435 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
Kojto | 107:4f6c30876dfa | 436 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
Kojto | 107:4f6c30876dfa | 437 | |
Kojto | 107:4f6c30876dfa | 438 | /** @brief Disable the specified USART interrupt. |
Kojto | 107:4f6c30876dfa | 439 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 440 | * @param __INTERRUPT__: specifies the USART interrupt source to disable. |
Kojto | 107:4f6c30876dfa | 441 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 442 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 107:4f6c30876dfa | 443 | * @arg USART_IT_TC: Transmission complete interrupt |
Kojto | 107:4f6c30876dfa | 444 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 107:4f6c30876dfa | 445 | * @arg USART_IT_IDLE: Idle line detection interrupt |
Kojto | 107:4f6c30876dfa | 446 | * @arg USART_IT_PE: Parity Error interrupt |
Kojto | 107:4f6c30876dfa | 447 | * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 107:4f6c30876dfa | 448 | * @retval None |
Kojto | 107:4f6c30876dfa | 449 | */ |
Kojto | 107:4f6c30876dfa | 450 | #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
Kojto | 107:4f6c30876dfa | 451 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
Kojto | 107:4f6c30876dfa | 452 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
Kojto | 107:4f6c30876dfa | 453 | |
Kojto | 107:4f6c30876dfa | 454 | |
Kojto | 107:4f6c30876dfa | 455 | /** @brief Check whether the specified USART interrupt has occurred or not. |
Kojto | 107:4f6c30876dfa | 456 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 457 | * @param __IT__: specifies the USART interrupt source to check. |
Kojto | 107:4f6c30876dfa | 458 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 459 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 107:4f6c30876dfa | 460 | * @arg USART_IT_TC: Transmission complete interrupt |
Kojto | 107:4f6c30876dfa | 461 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 107:4f6c30876dfa | 462 | * @arg USART_IT_IDLE: Idle line detection interrupt |
Kojto | 107:4f6c30876dfa | 463 | * @arg USART_IT_ORE: OverRun Error interrupt |
Kojto | 107:4f6c30876dfa | 464 | * @arg USART_IT_NE: Noise Error interrupt |
Kojto | 107:4f6c30876dfa | 465 | * @arg USART_IT_FE: Framing Error interrupt |
Kojto | 107:4f6c30876dfa | 466 | * @arg USART_IT_PE: Parity Error interrupt |
Kojto | 107:4f6c30876dfa | 467 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 107:4f6c30876dfa | 468 | */ |
Kojto | 107:4f6c30876dfa | 469 | #define __HAL_USART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08))) |
Kojto | 107:4f6c30876dfa | 470 | |
Kojto | 107:4f6c30876dfa | 471 | /** @brief Check whether the specified USART interrupt source is enabled or not. |
Kojto | 107:4f6c30876dfa | 472 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 473 | * @param __IT__: specifies the USART interrupt source to check. |
Kojto | 107:4f6c30876dfa | 474 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 475 | * @arg USART_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 107:4f6c30876dfa | 476 | * @arg USART_IT_TC: Transmission complete interrupt |
Kojto | 107:4f6c30876dfa | 477 | * @arg USART_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 107:4f6c30876dfa | 478 | * @arg USART_IT_IDLE: Idle line detection interrupt |
Kojto | 107:4f6c30876dfa | 479 | * @arg USART_IT_ORE: OverRun Error interrupt |
Kojto | 107:4f6c30876dfa | 480 | * @arg USART_IT_NE: Noise Error interrupt |
Kojto | 107:4f6c30876dfa | 481 | * @arg USART_IT_FE: Framing Error interrupt |
Kojto | 107:4f6c30876dfa | 482 | * @arg USART_IT_PE: Parity Error interrupt |
Kojto | 107:4f6c30876dfa | 483 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 107:4f6c30876dfa | 484 | */ |
Kojto | 107:4f6c30876dfa | 485 | #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5) == 2)? \ |
Kojto | 107:4f6c30876dfa | 486 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \ |
Kojto | 107:4f6c30876dfa | 487 | (((uint16_t)(__IT__)) & USART_IT_MASK))) |
Kojto | 107:4f6c30876dfa | 488 | |
Kojto | 107:4f6c30876dfa | 489 | |
Kojto | 107:4f6c30876dfa | 490 | /** @brief Clear the specified USART ISR flag, in setting the proper ICR register flag. |
Kojto | 107:4f6c30876dfa | 491 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 492 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
Kojto | 107:4f6c30876dfa | 493 | * to clear the corresponding interrupt. |
Kojto | 107:4f6c30876dfa | 494 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 495 | * @arg USART_CLEAR_PEF: Parity Error Clear Flag |
Kojto | 107:4f6c30876dfa | 496 | * @arg USART_CLEAR_FEF: Framing Error Clear Flag |
Kojto | 107:4f6c30876dfa | 497 | * @arg USART_CLEAR_NEF: Noise detected Clear Flag |
Kojto | 107:4f6c30876dfa | 498 | * @arg USART_CLEAR_OREF: OverRun Error Clear Flag |
Kojto | 107:4f6c30876dfa | 499 | * @arg USART_CLEAR_IDLEF: IDLE line detected Clear Flag |
Kojto | 107:4f6c30876dfa | 500 | * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag |
Kojto | 107:4f6c30876dfa | 501 | * @arg USART_CLEAR_CTSF: CTS Interrupt Clear Flag |
Kojto | 107:4f6c30876dfa | 502 | * @retval None |
Kojto | 107:4f6c30876dfa | 503 | */ |
Kojto | 107:4f6c30876dfa | 504 | #define __HAL_USART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
Kojto | 107:4f6c30876dfa | 505 | |
Kojto | 107:4f6c30876dfa | 506 | /** @brief Set a specific USART request flag. |
Kojto | 107:4f6c30876dfa | 507 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 508 | * @param __REQ__: specifies the request flag to set. |
Kojto | 107:4f6c30876dfa | 509 | * This parameter can be one of the following values: |
Kojto | 107:4f6c30876dfa | 510 | * @arg USART_RXDATA_FLUSH_REQUEST: Receive Data flush Request |
Kojto | 107:4f6c30876dfa | 511 | * @arg USART_TXDATA_FLUSH_REQUEST: Transmit data flush Request |
Kojto | 107:4f6c30876dfa | 512 | * |
Kojto | 107:4f6c30876dfa | 513 | * @retval None |
Kojto | 107:4f6c30876dfa | 514 | */ |
Kojto | 107:4f6c30876dfa | 515 | #define __HAL_USART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (__REQ__)) |
Kojto | 107:4f6c30876dfa | 516 | |
Kojto | 107:4f6c30876dfa | 517 | /** @brief Enable the USART one bit sample method. |
Kojto | 107:4f6c30876dfa | 518 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 519 | * @retval None |
Kojto | 107:4f6c30876dfa | 520 | */ |
Kojto | 107:4f6c30876dfa | 521 | #define __HAL_USART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) |
Kojto | 107:4f6c30876dfa | 522 | |
Kojto | 107:4f6c30876dfa | 523 | /** @brief Disable the USART one bit sample method. |
Kojto | 107:4f6c30876dfa | 524 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 525 | * @retval None |
Kojto | 107:4f6c30876dfa | 526 | */ |
Kojto | 107:4f6c30876dfa | 527 | #define __HAL_USART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT)) |
Kojto | 107:4f6c30876dfa | 528 | |
Kojto | 107:4f6c30876dfa | 529 | /** @brief Enable USART. |
Kojto | 107:4f6c30876dfa | 530 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 531 | * @retval None |
Kojto | 107:4f6c30876dfa | 532 | */ |
Kojto | 107:4f6c30876dfa | 533 | #define __HAL_USART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 107:4f6c30876dfa | 534 | |
Kojto | 107:4f6c30876dfa | 535 | /** @brief Disable USART. |
Kojto | 107:4f6c30876dfa | 536 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 537 | * @retval None |
Kojto | 107:4f6c30876dfa | 538 | */ |
Kojto | 107:4f6c30876dfa | 539 | #define __HAL_USART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 107:4f6c30876dfa | 540 | |
Kojto | 107:4f6c30876dfa | 541 | /** |
Kojto | 107:4f6c30876dfa | 542 | * @} |
Kojto | 107:4f6c30876dfa | 543 | */ |
Kojto | 107:4f6c30876dfa | 544 | |
Kojto | 107:4f6c30876dfa | 545 | /* Private macros --------------------------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 546 | /** @defgroup USART_Private_Macros USART Private Macros |
Kojto | 107:4f6c30876dfa | 547 | * @{ |
Kojto | 107:4f6c30876dfa | 548 | */ |
Kojto | 107:4f6c30876dfa | 549 | |
Kojto | 107:4f6c30876dfa | 550 | /** @brief Report the USART clock source. |
Kojto | 107:4f6c30876dfa | 551 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 107:4f6c30876dfa | 552 | * @param __CLOCKSOURCE__: output variable. |
Kojto | 107:4f6c30876dfa | 553 | * @retval the USART clocking source, written in __CLOCKSOURCE__. |
Kojto | 107:4f6c30876dfa | 554 | */ |
Kojto | 107:4f6c30876dfa | 555 | #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
Kojto | 107:4f6c30876dfa | 556 | do { \ |
Kojto | 107:4f6c30876dfa | 557 | if((__HANDLE__)->Instance == USART1) \ |
Kojto | 107:4f6c30876dfa | 558 | { \ |
Kojto | 107:4f6c30876dfa | 559 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
Kojto | 107:4f6c30876dfa | 560 | { \ |
Kojto | 107:4f6c30876dfa | 561 | case RCC_USART1CLKSOURCE_PCLK2: \ |
Kojto | 107:4f6c30876dfa | 562 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK2; \ |
Kojto | 107:4f6c30876dfa | 563 | break; \ |
Kojto | 107:4f6c30876dfa | 564 | case RCC_USART1CLKSOURCE_HSI: \ |
Kojto | 107:4f6c30876dfa | 565 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \ |
Kojto | 107:4f6c30876dfa | 566 | break; \ |
Kojto | 107:4f6c30876dfa | 567 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
Kojto | 107:4f6c30876dfa | 568 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \ |
Kojto | 107:4f6c30876dfa | 569 | break; \ |
Kojto | 107:4f6c30876dfa | 570 | case RCC_USART1CLKSOURCE_LSE: \ |
Kojto | 107:4f6c30876dfa | 571 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \ |
Kojto | 107:4f6c30876dfa | 572 | break; \ |
Kojto | 107:4f6c30876dfa | 573 | default: \ |
Kojto | 107:4f6c30876dfa | 574 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \ |
Kojto | 107:4f6c30876dfa | 575 | break; \ |
Kojto | 107:4f6c30876dfa | 576 | } \ |
Kojto | 107:4f6c30876dfa | 577 | } \ |
Kojto | 107:4f6c30876dfa | 578 | else if((__HANDLE__)->Instance == USART2) \ |
Kojto | 107:4f6c30876dfa | 579 | { \ |
Kojto | 107:4f6c30876dfa | 580 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
Kojto | 107:4f6c30876dfa | 581 | { \ |
Kojto | 107:4f6c30876dfa | 582 | case RCC_USART2CLKSOURCE_PCLK1: \ |
Kojto | 107:4f6c30876dfa | 583 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \ |
Kojto | 107:4f6c30876dfa | 584 | break; \ |
Kojto | 107:4f6c30876dfa | 585 | case RCC_USART2CLKSOURCE_HSI: \ |
Kojto | 107:4f6c30876dfa | 586 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \ |
Kojto | 107:4f6c30876dfa | 587 | break; \ |
Kojto | 107:4f6c30876dfa | 588 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
Kojto | 107:4f6c30876dfa | 589 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \ |
Kojto | 107:4f6c30876dfa | 590 | break; \ |
Kojto | 107:4f6c30876dfa | 591 | case RCC_USART2CLKSOURCE_LSE: \ |
Kojto | 107:4f6c30876dfa | 592 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \ |
Kojto | 107:4f6c30876dfa | 593 | break; \ |
Kojto | 107:4f6c30876dfa | 594 | default: \ |
Kojto | 107:4f6c30876dfa | 595 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \ |
Kojto | 107:4f6c30876dfa | 596 | break; \ |
Kojto | 107:4f6c30876dfa | 597 | } \ |
Kojto | 107:4f6c30876dfa | 598 | } \ |
Kojto | 107:4f6c30876dfa | 599 | else if((__HANDLE__)->Instance == USART3) \ |
Kojto | 107:4f6c30876dfa | 600 | { \ |
Kojto | 107:4f6c30876dfa | 601 | switch(__HAL_RCC_GET_USART3_SOURCE()) \ |
Kojto | 107:4f6c30876dfa | 602 | { \ |
Kojto | 107:4f6c30876dfa | 603 | case RCC_USART3CLKSOURCE_PCLK1: \ |
Kojto | 107:4f6c30876dfa | 604 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \ |
Kojto | 107:4f6c30876dfa | 605 | break; \ |
Kojto | 107:4f6c30876dfa | 606 | case RCC_USART3CLKSOURCE_HSI: \ |
Kojto | 107:4f6c30876dfa | 607 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \ |
Kojto | 107:4f6c30876dfa | 608 | break; \ |
Kojto | 107:4f6c30876dfa | 609 | case RCC_USART3CLKSOURCE_SYSCLK: \ |
Kojto | 107:4f6c30876dfa | 610 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \ |
Kojto | 107:4f6c30876dfa | 611 | break; \ |
Kojto | 107:4f6c30876dfa | 612 | case RCC_USART3CLKSOURCE_LSE: \ |
Kojto | 107:4f6c30876dfa | 613 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \ |
Kojto | 107:4f6c30876dfa | 614 | break; \ |
Kojto | 107:4f6c30876dfa | 615 | default: \ |
Kojto | 107:4f6c30876dfa | 616 | (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \ |
Kojto | 107:4f6c30876dfa | 617 | break; \ |
Kojto | 107:4f6c30876dfa | 618 | } \ |
Kojto | 107:4f6c30876dfa | 619 | } \ |
Kojto | 107:4f6c30876dfa | 620 | } while(0) |
Kojto | 107:4f6c30876dfa | 621 | |
Kojto | 107:4f6c30876dfa | 622 | /** @brief Check USART Baud rate. |
Kojto | 107:4f6c30876dfa | 623 | * @param __BAUDRATE__: Baudrate specified by the user. |
Kojto | 107:4f6c30876dfa | 624 | * The maximum Baud Rate is derived from the maximum clock on L4 (i.e. 80 MHz) |
Kojto | 107:4f6c30876dfa | 625 | * divided by the smallest oversampling used on the USART (i.e. 8). |
Kojto | 107:4f6c30876dfa | 626 | * @retval Test result (TRUE or FALSE). |
Kojto | 107:4f6c30876dfa | 627 | */ |
Kojto | 107:4f6c30876dfa | 628 | #define IS_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 10000001) |
Kojto | 107:4f6c30876dfa | 629 | |
Kojto | 107:4f6c30876dfa | 630 | /** |
Kojto | 107:4f6c30876dfa | 631 | * @brief Ensure that USART frame number of stop bits is valid. |
Kojto | 107:4f6c30876dfa | 632 | * @param __STOPBITS__: USART frame number of stop bits. |
Kojto | 107:4f6c30876dfa | 633 | * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid) |
Kojto | 107:4f6c30876dfa | 634 | */ |
Kojto | 107:4f6c30876dfa | 635 | #define IS_USART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == USART_STOPBITS_1) || \ |
Kojto | 107:4f6c30876dfa | 636 | ((__STOPBITS__) == USART_STOPBITS_1_5) || \ |
Kojto | 107:4f6c30876dfa | 637 | ((__STOPBITS__) == USART_STOPBITS_2)) |
Kojto | 107:4f6c30876dfa | 638 | |
Kojto | 107:4f6c30876dfa | 639 | /** |
Kojto | 107:4f6c30876dfa | 640 | * @brief Ensure that USART frame parity is valid. |
Kojto | 107:4f6c30876dfa | 641 | * @param __PARITY__: USART frame parity. |
Kojto | 107:4f6c30876dfa | 642 | * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid) |
Kojto | 107:4f6c30876dfa | 643 | */ |
Kojto | 107:4f6c30876dfa | 644 | #define IS_USART_PARITY(__PARITY__) (((__PARITY__) == USART_PARITY_NONE) || \ |
Kojto | 107:4f6c30876dfa | 645 | ((__PARITY__) == USART_PARITY_EVEN) || \ |
Kojto | 107:4f6c30876dfa | 646 | ((__PARITY__) == USART_PARITY_ODD)) |
Kojto | 107:4f6c30876dfa | 647 | |
Kojto | 107:4f6c30876dfa | 648 | /** |
Kojto | 107:4f6c30876dfa | 649 | * @brief Ensure that USART communication mode is valid. |
Kojto | 107:4f6c30876dfa | 650 | * @param __MODE__: USART communication mode. |
Kojto | 107:4f6c30876dfa | 651 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
Kojto | 107:4f6c30876dfa | 652 | */ |
Kojto | 107:4f6c30876dfa | 653 | #define IS_USART_MODE(__MODE__) ((((__MODE__) & (uint32_t)0xFFFFFFF3) == 0x00) && ((__MODE__) != (uint32_t)0x00)) |
Kojto | 107:4f6c30876dfa | 654 | |
Kojto | 107:4f6c30876dfa | 655 | /** |
Kojto | 107:4f6c30876dfa | 656 | * @brief Ensure that USART oversampling is valid. |
Kojto | 107:4f6c30876dfa | 657 | * @param __SAMPLING__: USART oversampling. |
Kojto | 107:4f6c30876dfa | 658 | * @retval SET (__SAMPLING__ is valid) or RESET (__SAMPLING__ is invalid) |
Kojto | 107:4f6c30876dfa | 659 | */ |
Kojto | 107:4f6c30876dfa | 660 | #define IS_USART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == USART_OVERSAMPLING_16) || \ |
Kojto | 107:4f6c30876dfa | 661 | ((__SAMPLING__) == USART_OVERSAMPLING_8)) |
Kojto | 107:4f6c30876dfa | 662 | |
Kojto | 107:4f6c30876dfa | 663 | /** |
Kojto | 107:4f6c30876dfa | 664 | * @brief Ensure that USART clock state is valid. |
Kojto | 107:4f6c30876dfa | 665 | * @param __CLOCK__: USART clock state. |
Kojto | 107:4f6c30876dfa | 666 | * @retval SET (__CLOCK__ is valid) or RESET (__CLOCK__ is invalid) |
Kojto | 107:4f6c30876dfa | 667 | */ |
Kojto | 107:4f6c30876dfa | 668 | #define IS_USART_CLOCK(__CLOCK__) (((__CLOCK__) == USART_CLOCK_DISABLE) || \ |
Kojto | 107:4f6c30876dfa | 669 | ((__CLOCK__) == USART_CLOCK_ENABLE)) |
Kojto | 107:4f6c30876dfa | 670 | |
Kojto | 107:4f6c30876dfa | 671 | /** |
Kojto | 107:4f6c30876dfa | 672 | * @brief Ensure that USART frame polarity is valid. |
Kojto | 107:4f6c30876dfa | 673 | * @param __CPOL__: USART frame polarity. |
Kojto | 107:4f6c30876dfa | 674 | * @retval SET (__CPOL__ is valid) or RESET (__CPOL__ is invalid) |
Kojto | 107:4f6c30876dfa | 675 | */ |
Kojto | 107:4f6c30876dfa | 676 | #define IS_USART_POLARITY(__CPOL__) (((__CPOL__) == USART_POLARITY_LOW) || ((__CPOL__) == USART_POLARITY_HIGH)) |
Kojto | 107:4f6c30876dfa | 677 | |
Kojto | 107:4f6c30876dfa | 678 | /** |
Kojto | 107:4f6c30876dfa | 679 | * @brief Ensure that USART frame phase is valid. |
Kojto | 107:4f6c30876dfa | 680 | * @param __CPHA__: USART frame phase. |
Kojto | 107:4f6c30876dfa | 681 | * @retval SET (__CPHA__ is valid) or RESET (__CPHA__ is invalid) |
Kojto | 107:4f6c30876dfa | 682 | */ |
Kojto | 107:4f6c30876dfa | 683 | #define IS_USART_PHASE(__CPHA__) (((__CPHA__) == USART_PHASE_1EDGE) || ((__CPHA__) == USART_PHASE_2EDGE)) |
Kojto | 107:4f6c30876dfa | 684 | |
Kojto | 107:4f6c30876dfa | 685 | /** |
Kojto | 107:4f6c30876dfa | 686 | * @brief Ensure that USART frame last bit clock pulse setting is valid. |
Kojto | 107:4f6c30876dfa | 687 | * @param __LASTBIT__: USART frame last bit clock pulse setting. |
Kojto | 107:4f6c30876dfa | 688 | * @retval SET (__LASTBIT__ is valid) or RESET (__LASTBIT__ is invalid) |
Kojto | 107:4f6c30876dfa | 689 | */ |
Kojto | 107:4f6c30876dfa | 690 | #define IS_USART_LASTBIT(__LASTBIT__) (((__LASTBIT__) == USART_LASTBIT_DISABLE) || \ |
Kojto | 107:4f6c30876dfa | 691 | ((__LASTBIT__) == USART_LASTBIT_ENABLE)) |
Kojto | 107:4f6c30876dfa | 692 | |
Kojto | 107:4f6c30876dfa | 693 | /** |
Kojto | 107:4f6c30876dfa | 694 | * @brief Ensure that USART request parameter is valid. |
Kojto | 107:4f6c30876dfa | 695 | * @param __PARAM__: USART request parameter. |
Kojto | 107:4f6c30876dfa | 696 | * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid) |
Kojto | 107:4f6c30876dfa | 697 | */ |
Kojto | 107:4f6c30876dfa | 698 | #define IS_USART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == USART_RXDATA_FLUSH_REQUEST) || \ |
Kojto | 107:4f6c30876dfa | 699 | ((__PARAM__) == USART_TXDATA_FLUSH_REQUEST)) |
Kojto | 107:4f6c30876dfa | 700 | |
Kojto | 107:4f6c30876dfa | 701 | /** |
Kojto | 107:4f6c30876dfa | 702 | * @} |
Kojto | 107:4f6c30876dfa | 703 | */ |
Kojto | 107:4f6c30876dfa | 704 | |
Kojto | 107:4f6c30876dfa | 705 | /* Include USART HAL Extended module */ |
Kojto | 107:4f6c30876dfa | 706 | #include "stm32l4xx_hal_usart_ex.h" |
Kojto | 107:4f6c30876dfa | 707 | |
Kojto | 107:4f6c30876dfa | 708 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 107:4f6c30876dfa | 709 | /** @addtogroup USART_Exported_Functions USART Exported Functions |
Kojto | 107:4f6c30876dfa | 710 | * @{ |
Kojto | 107:4f6c30876dfa | 711 | */ |
Kojto | 107:4f6c30876dfa | 712 | |
Kojto | 107:4f6c30876dfa | 713 | /** @addtogroup USART_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 107:4f6c30876dfa | 714 | * @{ |
Kojto | 107:4f6c30876dfa | 715 | */ |
Kojto | 107:4f6c30876dfa | 716 | |
Kojto | 107:4f6c30876dfa | 717 | /* Initialization and de-initialization functions ****************************/ |
Kojto | 107:4f6c30876dfa | 718 | HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 719 | HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 720 | void HAL_USART_MspInit(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 721 | void HAL_USART_MspDeInit(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 722 | |
Kojto | 107:4f6c30876dfa | 723 | /** |
Kojto | 107:4f6c30876dfa | 724 | * @} |
Kojto | 107:4f6c30876dfa | 725 | */ |
Kojto | 107:4f6c30876dfa | 726 | |
Kojto | 107:4f6c30876dfa | 727 | /** @addtogroup USART_Exported_Functions_Group2 IO operation functions |
Kojto | 107:4f6c30876dfa | 728 | * @{ |
Kojto | 107:4f6c30876dfa | 729 | */ |
Kojto | 107:4f6c30876dfa | 730 | |
Kojto | 107:4f6c30876dfa | 731 | /* IO operation functions *****************************************************/ |
Kojto | 107:4f6c30876dfa | 732 | HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout); |
Kojto | 107:4f6c30876dfa | 733 | HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
Kojto | 107:4f6c30876dfa | 734 | HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); |
Kojto | 107:4f6c30876dfa | 735 | HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); |
Kojto | 107:4f6c30876dfa | 736 | HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
Kojto | 107:4f6c30876dfa | 737 | HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); |
Kojto | 107:4f6c30876dfa | 738 | HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); |
Kojto | 107:4f6c30876dfa | 739 | HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); |
Kojto | 107:4f6c30876dfa | 740 | HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); |
Kojto | 107:4f6c30876dfa | 741 | HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 742 | HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 743 | HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 744 | void HAL_USART_IRQHandler(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 745 | void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 746 | void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 747 | void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 748 | void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 749 | void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 750 | void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 751 | |
Kojto | 107:4f6c30876dfa | 752 | /** |
Kojto | 107:4f6c30876dfa | 753 | * @} |
Kojto | 107:4f6c30876dfa | 754 | */ |
Kojto | 107:4f6c30876dfa | 755 | |
Kojto | 107:4f6c30876dfa | 756 | /* Peripheral Control functions ***********************************************/ |
Kojto | 107:4f6c30876dfa | 757 | |
Kojto | 107:4f6c30876dfa | 758 | /** @addtogroup USART_Exported_Functions_Group4 Peripheral State and Error functions |
Kojto | 107:4f6c30876dfa | 759 | * @{ |
Kojto | 107:4f6c30876dfa | 760 | */ |
Kojto | 107:4f6c30876dfa | 761 | |
Kojto | 107:4f6c30876dfa | 762 | /* Peripheral State and Error functions ***************************************/ |
Kojto | 107:4f6c30876dfa | 763 | HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 764 | uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart); |
Kojto | 107:4f6c30876dfa | 765 | |
Kojto | 107:4f6c30876dfa | 766 | /** |
Kojto | 107:4f6c30876dfa | 767 | * @} |
Kojto | 107:4f6c30876dfa | 768 | */ |
Kojto | 107:4f6c30876dfa | 769 | |
Kojto | 107:4f6c30876dfa | 770 | /** |
Kojto | 107:4f6c30876dfa | 771 | * @} |
Kojto | 107:4f6c30876dfa | 772 | */ |
Kojto | 107:4f6c30876dfa | 773 | |
Kojto | 107:4f6c30876dfa | 774 | /** |
Kojto | 107:4f6c30876dfa | 775 | * @} |
Kojto | 107:4f6c30876dfa | 776 | */ |
Kojto | 107:4f6c30876dfa | 777 | |
Kojto | 107:4f6c30876dfa | 778 | /** |
Kojto | 107:4f6c30876dfa | 779 | * @} |
Kojto | 107:4f6c30876dfa | 780 | */ |
Kojto | 107:4f6c30876dfa | 781 | |
Kojto | 107:4f6c30876dfa | 782 | #ifdef __cplusplus |
Kojto | 107:4f6c30876dfa | 783 | } |
Kojto | 107:4f6c30876dfa | 784 | #endif |
Kojto | 107:4f6c30876dfa | 785 | |
Kojto | 107:4f6c30876dfa | 786 | #endif /* __STM32L4xx_HAL_USART_H */ |
Kojto | 107:4f6c30876dfa | 787 | |
Kojto | 107:4f6c30876dfa | 788 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |