提交 | 用户 | age
|
bfc108
|
1 |
/**
|
Q |
2 |
******************************************************************************
|
|
3 |
* @file stm32f0xx_ll_usart.h
|
|
4 |
* @author MCD Application Team
|
|
5 |
* @brief Header file of USART LL module.
|
|
6 |
******************************************************************************
|
|
7 |
* @attention
|
|
8 |
*
|
|
9 |
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
10 |
*
|
|
11 |
* Redistribution and use in source and binary forms, with or without modification,
|
|
12 |
* are permitted provided that the following conditions are met:
|
|
13 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
14 |
* this list of conditions and the following disclaimer.
|
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
16 |
* this list of conditions and the following disclaimer in the documentation
|
|
17 |
* and/or other materials provided with the distribution.
|
|
18 |
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
19 |
* may be used to endorse or promote products derived from this software
|
|
20 |
* without specific prior written permission.
|
|
21 |
*
|
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
23 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
25 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
26 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
27 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
28 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
29 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
30 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32 |
*
|
|
33 |
******************************************************************************
|
|
34 |
*/
|
|
35 |
|
|
36 |
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
37 |
#ifndef __STM32F0xx_LL_USART_H
|
|
38 |
#define __STM32F0xx_LL_USART_H
|
|
39 |
|
|
40 |
#ifdef __cplusplus
|
|
41 |
extern "C" {
|
|
42 |
#endif
|
|
43 |
|
|
44 |
/* Includes ------------------------------------------------------------------*/
|
|
45 |
#include "stm32f0xx.h"
|
|
46 |
|
|
47 |
/** @addtogroup STM32F0xx_LL_Driver
|
|
48 |
* @{
|
|
49 |
*/
|
|
50 |
|
|
51 |
#if defined (USART1) || defined (USART2) || defined (USART3) || defined (USART4) || defined (USART5) || defined (USART6) || defined (USART7) || defined (USART8)
|
|
52 |
|
|
53 |
/** @defgroup USART_LL USART
|
|
54 |
* @{
|
|
55 |
*/
|
|
56 |
|
|
57 |
/* Private types -------------------------------------------------------------*/
|
|
58 |
/* Private variables ---------------------------------------------------------*/
|
|
59 |
|
|
60 |
/* Private constants ---------------------------------------------------------*/
|
|
61 |
/** @defgroup USART_LL_Private_Constants USART Private Constants
|
|
62 |
* @{
|
|
63 |
*/
|
|
64 |
/**
|
|
65 |
* @}
|
|
66 |
*/
|
|
67 |
|
|
68 |
/* Private macros ------------------------------------------------------------*/
|
|
69 |
#if defined(USE_FULL_LL_DRIVER)
|
|
70 |
/** @defgroup USART_LL_Private_Macros USART Private Macros
|
|
71 |
* @{
|
|
72 |
*/
|
|
73 |
/**
|
|
74 |
* @}
|
|
75 |
*/
|
|
76 |
#endif /*USE_FULL_LL_DRIVER*/
|
|
77 |
|
|
78 |
/* Exported types ------------------------------------------------------------*/
|
|
79 |
#if defined(USE_FULL_LL_DRIVER)
|
|
80 |
/** @defgroup USART_LL_ES_INIT USART Exported Init structures
|
|
81 |
* @{
|
|
82 |
*/
|
|
83 |
|
|
84 |
/**
|
|
85 |
* @brief LL USART Init Structure definition
|
|
86 |
*/
|
|
87 |
typedef struct
|
|
88 |
{
|
|
89 |
uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate.
|
|
90 |
|
|
91 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/
|
|
92 |
|
|
93 |
uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame.
|
|
94 |
This parameter can be a value of @ref USART_LL_EC_DATAWIDTH.
|
|
95 |
|
|
96 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/
|
|
97 |
|
|
98 |
uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
|
|
99 |
This parameter can be a value of @ref USART_LL_EC_STOPBITS.
|
|
100 |
|
|
101 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/
|
|
102 |
|
|
103 |
uint32_t Parity; /*!< Specifies the parity mode.
|
|
104 |
This parameter can be a value of @ref USART_LL_EC_PARITY.
|
|
105 |
|
|
106 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/
|
|
107 |
|
|
108 |
uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled.
|
|
109 |
This parameter can be a value of @ref USART_LL_EC_DIRECTION.
|
|
110 |
|
|
111 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/
|
|
112 |
|
|
113 |
uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled.
|
|
114 |
This parameter can be a value of @ref USART_LL_EC_HWCONTROL.
|
|
115 |
|
|
116 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/
|
|
117 |
|
|
118 |
uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8.
|
|
119 |
This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING.
|
|
120 |
|
|
121 |
This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/
|
|
122 |
|
|
123 |
} LL_USART_InitTypeDef;
|
|
124 |
|
|
125 |
/**
|
|
126 |
* @brief LL USART Clock Init Structure definition
|
|
127 |
*/
|
|
128 |
typedef struct
|
|
129 |
{
|
|
130 |
uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled.
|
|
131 |
This parameter can be a value of @ref USART_LL_EC_CLOCK.
|
|
132 |
|
|
133 |
USART HW configuration can be modified afterwards using unitary functions
|
|
134 |
@ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput().
|
|
135 |
For more details, refer to description of this function. */
|
|
136 |
|
|
137 |
uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock.
|
|
138 |
This parameter can be a value of @ref USART_LL_EC_POLARITY.
|
|
139 |
|
|
140 |
USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity().
|
|
141 |
For more details, refer to description of this function. */
|
|
142 |
|
|
143 |
uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made.
|
|
144 |
This parameter can be a value of @ref USART_LL_EC_PHASE.
|
|
145 |
|
|
146 |
USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase().
|
|
147 |
For more details, refer to description of this function. */
|
|
148 |
|
|
149 |
uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted
|
|
150 |
data bit (MSB) has to be output on the SCLK pin in synchronous mode.
|
|
151 |
This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE.
|
|
152 |
|
|
153 |
USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput().
|
|
154 |
For more details, refer to description of this function. */
|
|
155 |
|
|
156 |
} LL_USART_ClockInitTypeDef;
|
|
157 |
|
|
158 |
/**
|
|
159 |
* @}
|
|
160 |
*/
|
|
161 |
#endif /* USE_FULL_LL_DRIVER */
|
|
162 |
|
|
163 |
/* Exported constants --------------------------------------------------------*/
|
|
164 |
/** @defgroup USART_LL_Exported_Constants USART Exported Constants
|
|
165 |
* @{
|
|
166 |
*/
|
|
167 |
|
|
168 |
/** @defgroup USART_LL_EC_CLEAR_FLAG Clear Flags Defines
|
|
169 |
* @brief Flags defines which can be used with LL_USART_WriteReg function
|
|
170 |
* @{
|
|
171 |
*/
|
|
172 |
#define LL_USART_ICR_PECF USART_ICR_PECF /*!< Parity error flag */
|
|
173 |
#define LL_USART_ICR_FECF USART_ICR_FECF /*!< Framing error flag */
|
|
174 |
#define LL_USART_ICR_NCF USART_ICR_NCF /*!< Noise detected flag */
|
|
175 |
#define LL_USART_ICR_ORECF USART_ICR_ORECF /*!< Overrun error flag */
|
|
176 |
#define LL_USART_ICR_IDLECF USART_ICR_IDLECF /*!< Idle line detected flag */
|
|
177 |
#define LL_USART_ICR_TCCF USART_ICR_TCCF /*!< Transmission complete flag */
|
|
178 |
#if defined(USART_LIN_SUPPORT)
|
|
179 |
#define LL_USART_ICR_LBDCF USART_ICR_LBDCF /*!< LIN break detection flag */
|
|
180 |
#endif
|
|
181 |
#define LL_USART_ICR_CTSCF USART_ICR_CTSCF /*!< CTS flag */
|
|
182 |
#define LL_USART_ICR_RTOCF USART_ICR_RTOCF /*!< Receiver timeout flag */
|
|
183 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
184 |
#define LL_USART_ICR_EOBCF USART_ICR_EOBCF /*!< End of block flag */
|
|
185 |
#endif
|
|
186 |
#define LL_USART_ICR_CMCF USART_ICR_CMCF /*!< Character match flag */
|
|
187 |
#if defined(USART_WUSM_SUPPORT)
|
|
188 |
#define LL_USART_ICR_WUCF USART_ICR_WUCF /*!< Wakeup from Stop mode flag */
|
|
189 |
#endif
|
|
190 |
/**
|
|
191 |
* @}
|
|
192 |
*/
|
|
193 |
|
|
194 |
/** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines
|
|
195 |
* @brief Flags defines which can be used with LL_USART_ReadReg function
|
|
196 |
* @{
|
|
197 |
*/
|
|
198 |
#define LL_USART_ISR_PE USART_ISR_PE /*!< Parity error flag */
|
|
199 |
#define LL_USART_ISR_FE USART_ISR_FE /*!< Framing error flag */
|
|
200 |
#define LL_USART_ISR_NE USART_ISR_NE /*!< Noise detected flag */
|
|
201 |
#define LL_USART_ISR_ORE USART_ISR_ORE /*!< Overrun error flag */
|
|
202 |
#define LL_USART_ISR_IDLE USART_ISR_IDLE /*!< Idle line detected flag */
|
|
203 |
#define LL_USART_ISR_RXNE USART_ISR_RXNE /*!< Read data register not empty flag */
|
|
204 |
#define LL_USART_ISR_TC USART_ISR_TC /*!< Transmission complete flag */
|
|
205 |
#define LL_USART_ISR_TXE USART_ISR_TXE /*!< Transmit data register empty flag */
|
|
206 |
#if defined(USART_LIN_SUPPORT)
|
|
207 |
#define LL_USART_ISR_LBDF USART_ISR_LBDF /*!< LIN break detection flag */
|
|
208 |
#endif
|
|
209 |
#define LL_USART_ISR_CTSIF USART_ISR_CTSIF /*!< CTS interrupt flag */
|
|
210 |
#define LL_USART_ISR_CTS USART_ISR_CTS /*!< CTS flag */
|
|
211 |
#define LL_USART_ISR_RTOF USART_ISR_RTOF /*!< Receiver timeout flag */
|
|
212 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
213 |
#define LL_USART_ISR_EOBF USART_ISR_EOBF /*!< End of block flag */
|
|
214 |
#endif
|
|
215 |
#define LL_USART_ISR_ABRE USART_ISR_ABRE /*!< Auto baud rate error flag */
|
|
216 |
#define LL_USART_ISR_ABRF USART_ISR_ABRF /*!< Auto baud rate flag */
|
|
217 |
#define LL_USART_ISR_BUSY USART_ISR_BUSY /*!< Busy flag */
|
|
218 |
#define LL_USART_ISR_CMF USART_ISR_CMF /*!< Character match flag */
|
|
219 |
#define LL_USART_ISR_SBKF USART_ISR_SBKF /*!< Send break flag */
|
|
220 |
#define LL_USART_ISR_RWU USART_ISR_RWU /*!< Receiver wakeup from Mute mode flag */
|
|
221 |
#if defined(USART_WUSM_SUPPORT)
|
|
222 |
#define LL_USART_ISR_WUF USART_ISR_WUF /*!< Wakeup from Stop mode flag */
|
|
223 |
#define LL_USART_ISR_TEACK USART_ISR_TEACK /*!< Transmit enable acknowledge flag */
|
|
224 |
#define LL_USART_ISR_REACK USART_ISR_REACK /*!< Receive enable acknowledge flag */
|
|
225 |
#endif
|
|
226 |
/**
|
|
227 |
* @}
|
|
228 |
*/
|
|
229 |
|
|
230 |
/** @defgroup USART_LL_EC_IT IT Defines
|
|
231 |
* @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions
|
|
232 |
* @{
|
|
233 |
*/
|
|
234 |
#define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */
|
|
235 |
#define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */
|
|
236 |
#define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */
|
|
237 |
#define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */
|
|
238 |
#define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */
|
|
239 |
#define LL_USART_CR1_CMIE USART_CR1_CMIE /*!< Character match interrupt enable */
|
|
240 |
#define LL_USART_CR1_RTOIE USART_CR1_RTOIE /*!< Receiver timeout interrupt enable */
|
|
241 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
242 |
#define LL_USART_CR1_EOBIE USART_CR1_EOBIE /*!< End of Block interrupt enable */
|
|
243 |
#endif
|
|
244 |
#if defined(USART_LIN_SUPPORT)
|
|
245 |
#define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */
|
|
246 |
#endif
|
|
247 |
#define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */
|
|
248 |
#define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */
|
|
249 |
#if defined(USART_WUSM_SUPPORT)
|
|
250 |
#define LL_USART_CR3_WUFIE USART_CR3_WUFIE /*!< Wakeup from Stop mode interrupt enable */
|
|
251 |
#endif
|
|
252 |
/**
|
|
253 |
* @}
|
|
254 |
*/
|
|
255 |
|
|
256 |
/** @defgroup USART_LL_EC_DIRECTION Communication Direction
|
|
257 |
* @{
|
|
258 |
*/
|
|
259 |
#define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */
|
|
260 |
#define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */
|
|
261 |
#define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */
|
|
262 |
#define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */
|
|
263 |
/**
|
|
264 |
* @}
|
|
265 |
*/
|
|
266 |
|
|
267 |
/** @defgroup USART_LL_EC_PARITY Parity Control
|
|
268 |
* @{
|
|
269 |
*/
|
|
270 |
#define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */
|
|
271 |
#define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */
|
|
272 |
#define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */
|
|
273 |
/**
|
|
274 |
* @}
|
|
275 |
*/
|
|
276 |
|
|
277 |
/** @defgroup USART_LL_EC_WAKEUP Wakeup
|
|
278 |
* @{
|
|
279 |
*/
|
|
280 |
#define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */
|
|
281 |
#define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */
|
|
282 |
/**
|
|
283 |
* @}
|
|
284 |
*/
|
|
285 |
|
|
286 |
/** @defgroup USART_LL_EC_DATAWIDTH Datawidth
|
|
287 |
* @{
|
|
288 |
*/
|
|
289 |
#if defined(USART_7BITS_SUPPORT)
|
|
290 |
#define LL_USART_DATAWIDTH_7B USART_CR1_M1 /*!< 7 bits word length : Start bit, 7 data bits, n stop bits */
|
|
291 |
#define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */
|
|
292 |
#define LL_USART_DATAWIDTH_9B USART_CR1_M0 /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */
|
|
293 |
#else
|
|
294 |
#define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */
|
|
295 |
#define LL_USART_DATAWIDTH_9B USART_CR1_M /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */
|
|
296 |
#endif
|
|
297 |
/**
|
|
298 |
* @}
|
|
299 |
*/
|
|
300 |
|
|
301 |
/** @defgroup USART_LL_EC_OVERSAMPLING Oversampling
|
|
302 |
* @{
|
|
303 |
*/
|
|
304 |
#define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */
|
|
305 |
#define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */
|
|
306 |
/**
|
|
307 |
* @}
|
|
308 |
*/
|
|
309 |
|
|
310 |
#if defined(USE_FULL_LL_DRIVER)
|
|
311 |
/** @defgroup USART_LL_EC_CLOCK Clock Signal
|
|
312 |
* @{
|
|
313 |
*/
|
|
314 |
|
|
315 |
#define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */
|
|
316 |
#define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */
|
|
317 |
/**
|
|
318 |
* @}
|
|
319 |
*/
|
|
320 |
#endif /*USE_FULL_LL_DRIVER*/
|
|
321 |
|
|
322 |
/** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse
|
|
323 |
* @{
|
|
324 |
*/
|
|
325 |
#define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */
|
|
326 |
#define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */
|
|
327 |
/**
|
|
328 |
* @}
|
|
329 |
*/
|
|
330 |
|
|
331 |
/** @defgroup USART_LL_EC_PHASE Clock Phase
|
|
332 |
* @{
|
|
333 |
*/
|
|
334 |
#define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */
|
|
335 |
#define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */
|
|
336 |
/**
|
|
337 |
* @}
|
|
338 |
*/
|
|
339 |
|
|
340 |
/** @defgroup USART_LL_EC_POLARITY Clock Polarity
|
|
341 |
* @{
|
|
342 |
*/
|
|
343 |
#define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/
|
|
344 |
#define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */
|
|
345 |
/**
|
|
346 |
* @}
|
|
347 |
*/
|
|
348 |
|
|
349 |
/** @defgroup USART_LL_EC_STOPBITS Stop Bits
|
|
350 |
* @{
|
|
351 |
*/
|
|
352 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
353 |
#define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */
|
|
354 |
#endif
|
|
355 |
#define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */
|
|
356 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
357 |
#define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */
|
|
358 |
#endif
|
|
359 |
#define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */
|
|
360 |
/**
|
|
361 |
* @}
|
|
362 |
*/
|
|
363 |
|
|
364 |
/** @defgroup USART_LL_EC_TXRX TX RX Pins Swap
|
|
365 |
* @{
|
|
366 |
*/
|
|
367 |
#define LL_USART_TXRX_STANDARD 0x00000000U /*!< TX/RX pins are used as defined in standard pinout */
|
|
368 |
#define LL_USART_TXRX_SWAPPED (USART_CR2_SWAP) /*!< TX and RX pins functions are swapped. */
|
|
369 |
/**
|
|
370 |
* @}
|
|
371 |
*/
|
|
372 |
|
|
373 |
/** @defgroup USART_LL_EC_RXPIN_LEVEL RX Pin Active Level Inversion
|
|
374 |
* @{
|
|
375 |
*/
|
|
376 |
#define LL_USART_RXPIN_LEVEL_STANDARD 0x00000000U /*!< RX pin signal works using the standard logic levels */
|
|
377 |
#define LL_USART_RXPIN_LEVEL_INVERTED (USART_CR2_RXINV) /*!< RX pin signal values are inverted. */
|
|
378 |
/**
|
|
379 |
* @}
|
|
380 |
*/
|
|
381 |
|
|
382 |
/** @defgroup USART_LL_EC_TXPIN_LEVEL TX Pin Active Level Inversion
|
|
383 |
* @{
|
|
384 |
*/
|
|
385 |
#define LL_USART_TXPIN_LEVEL_STANDARD 0x00000000U /*!< TX pin signal works using the standard logic levels */
|
|
386 |
#define LL_USART_TXPIN_LEVEL_INVERTED (USART_CR2_TXINV) /*!< TX pin signal values are inverted. */
|
|
387 |
/**
|
|
388 |
* @}
|
|
389 |
*/
|
|
390 |
|
|
391 |
/** @defgroup USART_LL_EC_BINARY_LOGIC Binary Data Inversion
|
|
392 |
* @{
|
|
393 |
*/
|
|
394 |
#define LL_USART_BINARY_LOGIC_POSITIVE 0x00000000U /*!< Logical data from the data register are send/received in positive/direct logic. (1=H, 0=L) */
|
|
395 |
#define LL_USART_BINARY_LOGIC_NEGATIVE USART_CR2_DATAINV /*!< Logical data from the data register are send/received in negative/inverse logic. (1=L, 0=H). The parity bit is also inverted. */
|
|
396 |
/**
|
|
397 |
* @}
|
|
398 |
*/
|
|
399 |
|
|
400 |
/** @defgroup USART_LL_EC_BITORDER Bit Order
|
|
401 |
* @{
|
|
402 |
*/
|
|
403 |
#define LL_USART_BITORDER_LSBFIRST 0x00000000U /*!< data is transmitted/received with data bit 0 first, following the start bit */
|
|
404 |
#define LL_USART_BITORDER_MSBFIRST USART_CR2_MSBFIRST /*!< data is transmitted/received with the MSB first, following the start bit */
|
|
405 |
/**
|
|
406 |
* @}
|
|
407 |
*/
|
|
408 |
|
|
409 |
/** @defgroup USART_LL_EC_AUTOBAUD_DETECT_ON Autobaud Detection
|
|
410 |
* @{
|
|
411 |
*/
|
|
412 |
#define LL_USART_AUTOBAUD_DETECT_ON_STARTBIT 0x00000000U /*!< Measurement of the start bit is used to detect the baud rate */
|
|
413 |
#define LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE USART_CR2_ABRMODE_0 /*!< Falling edge to falling edge measurement. Received frame must start with a single bit = 1 -> Frame = Start10xxxxxx */
|
|
414 |
#if defined(USART_FABR_SUPPORT)
|
|
415 |
#define LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME USART_CR2_ABRMODE_1 /*!< 0x7F frame detection */
|
|
416 |
#define LL_USART_AUTOBAUD_DETECT_ON_55_FRAME (USART_CR2_ABRMODE_1 | USART_CR2_ABRMODE_0) /*!< 0x55 frame detection */
|
|
417 |
#endif
|
|
418 |
/**
|
|
419 |
* @}
|
|
420 |
*/
|
|
421 |
|
|
422 |
/** @defgroup USART_LL_EC_ADDRESS_DETECT Address Length Detection
|
|
423 |
* @{
|
|
424 |
*/
|
|
425 |
#define LL_USART_ADDRESS_DETECT_4B 0x00000000U /*!< 4-bit address detection method selected */
|
|
426 |
#define LL_USART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit address detection (in 8-bit data mode) method selected */
|
|
427 |
/**
|
|
428 |
* @}
|
|
429 |
*/
|
|
430 |
|
|
431 |
/** @defgroup USART_LL_EC_HWCONTROL Hardware Control
|
|
432 |
* @{
|
|
433 |
*/
|
|
434 |
#define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */
|
|
435 |
#define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */
|
|
436 |
#define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */
|
|
437 |
#define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */
|
|
438 |
/**
|
|
439 |
* @}
|
|
440 |
*/
|
|
441 |
|
|
442 |
#if defined(USART_WUSM_SUPPORT)
|
|
443 |
/** @defgroup USART_LL_EC_WAKEUP_ON Wakeup Activation
|
|
444 |
* @{
|
|
445 |
*/
|
|
446 |
#define LL_USART_WAKEUP_ON_ADDRESS 0x00000000U /*!< Wake up active on address match */
|
|
447 |
#define LL_USART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< Wake up active on Start bit detection */
|
|
448 |
#define LL_USART_WAKEUP_ON_RXNE (USART_CR3_WUS_0 | USART_CR3_WUS_1) /*!< Wake up active on RXNE */
|
|
449 |
/**
|
|
450 |
* @}
|
|
451 |
*/
|
|
452 |
#endif
|
|
453 |
|
|
454 |
#if defined(USART_IRDA_SUPPORT)
|
|
455 |
/** @defgroup USART_LL_EC_IRDA_POWER IrDA Power
|
|
456 |
* @{
|
|
457 |
*/
|
|
458 |
#define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */
|
|
459 |
#define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */
|
|
460 |
/**
|
|
461 |
* @}
|
|
462 |
*/
|
|
463 |
#endif
|
|
464 |
|
|
465 |
#if defined(USART_LIN_SUPPORT)
|
|
466 |
/** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length
|
|
467 |
* @{
|
|
468 |
*/
|
|
469 |
#define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */
|
|
470 |
#define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */
|
|
471 |
/**
|
|
472 |
* @}
|
|
473 |
*/
|
|
474 |
#endif
|
|
475 |
|
|
476 |
/** @defgroup USART_LL_EC_DE_POLARITY Driver Enable Polarity
|
|
477 |
* @{
|
|
478 |
*/
|
|
479 |
#define LL_USART_DE_POLARITY_HIGH 0x00000000U /*!< DE signal is active high */
|
|
480 |
#define LL_USART_DE_POLARITY_LOW USART_CR3_DEP /*!< DE signal is active low */
|
|
481 |
/**
|
|
482 |
* @}
|
|
483 |
*/
|
|
484 |
|
|
485 |
/** @defgroup USART_LL_EC_DMA_REG_DATA DMA Register Data
|
|
486 |
* @{
|
|
487 |
*/
|
|
488 |
#define LL_USART_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for transmission */
|
|
489 |
#define LL_USART_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for reception */
|
|
490 |
/**
|
|
491 |
* @}
|
|
492 |
*/
|
|
493 |
|
|
494 |
/**
|
|
495 |
* @}
|
|
496 |
*/
|
|
497 |
|
|
498 |
/* Exported macro ------------------------------------------------------------*/
|
|
499 |
/** @defgroup USART_LL_Exported_Macros USART Exported Macros
|
|
500 |
* @{
|
|
501 |
*/
|
|
502 |
|
|
503 |
/** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros
|
|
504 |
* @{
|
|
505 |
*/
|
|
506 |
|
|
507 |
/**
|
|
508 |
* @brief Write a value in USART register
|
|
509 |
* @param __INSTANCE__ USART Instance
|
|
510 |
* @param __REG__ Register to be written
|
|
511 |
* @param __VALUE__ Value to be written in the register
|
|
512 |
* @retval None
|
|
513 |
*/
|
|
514 |
#define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
|
|
515 |
|
|
516 |
/**
|
|
517 |
* @brief Read a value in USART register
|
|
518 |
* @param __INSTANCE__ USART Instance
|
|
519 |
* @param __REG__ Register to be read
|
|
520 |
* @retval Register value
|
|
521 |
*/
|
|
522 |
#define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
|
|
523 |
/**
|
|
524 |
* @}
|
|
525 |
*/
|
|
526 |
|
|
527 |
/** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper
|
|
528 |
* @{
|
|
529 |
*/
|
|
530 |
|
|
531 |
/**
|
|
532 |
* @brief Compute USARTDIV value according to Peripheral Clock and
|
|
533 |
* expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned)
|
|
534 |
* @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
|
|
535 |
* @param __BAUDRATE__ Baud rate value to achieve
|
|
536 |
* @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case
|
|
537 |
*/
|
|
538 |
#define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) ((((__PERIPHCLK__)*2) + ((__BAUDRATE__)/2))/(__BAUDRATE__))
|
|
539 |
|
|
540 |
/**
|
|
541 |
* @brief Compute USARTDIV value according to Peripheral Clock and
|
|
542 |
* expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned)
|
|
543 |
* @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
|
|
544 |
* @param __BAUDRATE__ Baud rate value to achieve
|
|
545 |
* @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case
|
|
546 |
*/
|
|
547 |
#define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__) + ((__BAUDRATE__)/2))/(__BAUDRATE__))
|
|
548 |
|
|
549 |
/**
|
|
550 |
* @}
|
|
551 |
*/
|
|
552 |
|
|
553 |
/**
|
|
554 |
* @}
|
|
555 |
*/
|
|
556 |
|
|
557 |
/* Exported functions --------------------------------------------------------*/
|
|
558 |
|
|
559 |
/** @defgroup USART_LL_Exported_Functions USART Exported Functions
|
|
560 |
* @{
|
|
561 |
*/
|
|
562 |
|
|
563 |
/** @defgroup USART_LL_EF_Configuration Configuration functions
|
|
564 |
* @{
|
|
565 |
*/
|
|
566 |
|
|
567 |
/**
|
|
568 |
* @brief USART Enable
|
|
569 |
* @rmtoll CR1 UE LL_USART_Enable
|
|
570 |
* @param USARTx USART Instance
|
|
571 |
* @retval None
|
|
572 |
*/
|
|
573 |
__STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx)
|
|
574 |
{
|
|
575 |
SET_BIT(USARTx->CR1, USART_CR1_UE);
|
|
576 |
}
|
|
577 |
|
|
578 |
/**
|
|
579 |
* @brief USART Disable (all USART prescalers and outputs are disabled)
|
|
580 |
* @note When USART is disabled, USART prescalers and outputs are stopped immediately,
|
|
581 |
* and current operations are discarded. The configuration of the USART is kept, but all the status
|
|
582 |
* flags, in the USARTx_ISR are set to their default values.
|
|
583 |
* @rmtoll CR1 UE LL_USART_Disable
|
|
584 |
* @param USARTx USART Instance
|
|
585 |
* @retval None
|
|
586 |
*/
|
|
587 |
__STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx)
|
|
588 |
{
|
|
589 |
CLEAR_BIT(USARTx->CR1, USART_CR1_UE);
|
|
590 |
}
|
|
591 |
|
|
592 |
/**
|
|
593 |
* @brief Indicate if USART is enabled
|
|
594 |
* @rmtoll CR1 UE LL_USART_IsEnabled
|
|
595 |
* @param USARTx USART Instance
|
|
596 |
* @retval State of bit (1 or 0).
|
|
597 |
*/
|
|
598 |
__STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx)
|
|
599 |
{
|
|
600 |
return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE));
|
|
601 |
}
|
|
602 |
|
|
603 |
#if defined(USART_WUSM_SUPPORT)
|
|
604 |
/**
|
|
605 |
* @brief USART enabled in STOP Mode.
|
|
606 |
* @note When this function is enabled, USART is able to wake up the MCU from Stop mode, provided that
|
|
607 |
* USART clock selection is HSI or LSE in RCC.
|
|
608 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
609 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
610 |
* @rmtoll CR1 UESM LL_USART_EnableInStopMode
|
|
611 |
* @param USARTx USART Instance
|
|
612 |
* @retval None
|
|
613 |
*/
|
|
614 |
__STATIC_INLINE void LL_USART_EnableInStopMode(USART_TypeDef *USARTx)
|
|
615 |
{
|
|
616 |
SET_BIT(USARTx->CR1, USART_CR1_UESM);
|
|
617 |
}
|
|
618 |
|
|
619 |
/**
|
|
620 |
* @brief USART disabled in STOP Mode.
|
|
621 |
* @note When this function is disabled, USART is not able to wake up the MCU from Stop mode
|
|
622 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
623 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
624 |
* @rmtoll CR1 UESM LL_USART_DisableInStopMode
|
|
625 |
* @param USARTx USART Instance
|
|
626 |
* @retval None
|
|
627 |
*/
|
|
628 |
__STATIC_INLINE void LL_USART_DisableInStopMode(USART_TypeDef *USARTx)
|
|
629 |
{
|
|
630 |
CLEAR_BIT(USARTx->CR1, USART_CR1_UESM);
|
|
631 |
}
|
|
632 |
|
|
633 |
/**
|
|
634 |
* @brief Indicate if USART is enabled in STOP Mode (able to wake up MCU from Stop mode or not)
|
|
635 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
636 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
637 |
* @rmtoll CR1 UESM LL_USART_IsEnabledInStopMode
|
|
638 |
* @param USARTx USART Instance
|
|
639 |
* @retval State of bit (1 or 0).
|
|
640 |
*/
|
|
641 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledInStopMode(USART_TypeDef *USARTx)
|
|
642 |
{
|
|
643 |
return (READ_BIT(USARTx->CR1, USART_CR1_UESM) == (USART_CR1_UESM));
|
|
644 |
}
|
|
645 |
#endif
|
|
646 |
|
|
647 |
/**
|
|
648 |
* @brief Receiver Enable (Receiver is enabled and begins searching for a start bit)
|
|
649 |
* @rmtoll CR1 RE LL_USART_EnableDirectionRx
|
|
650 |
* @param USARTx USART Instance
|
|
651 |
* @retval None
|
|
652 |
*/
|
|
653 |
__STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx)
|
|
654 |
{
|
|
655 |
SET_BIT(USARTx->CR1, USART_CR1_RE);
|
|
656 |
}
|
|
657 |
|
|
658 |
/**
|
|
659 |
* @brief Receiver Disable
|
|
660 |
* @rmtoll CR1 RE LL_USART_DisableDirectionRx
|
|
661 |
* @param USARTx USART Instance
|
|
662 |
* @retval None
|
|
663 |
*/
|
|
664 |
__STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx)
|
|
665 |
{
|
|
666 |
CLEAR_BIT(USARTx->CR1, USART_CR1_RE);
|
|
667 |
}
|
|
668 |
|
|
669 |
/**
|
|
670 |
* @brief Transmitter Enable
|
|
671 |
* @rmtoll CR1 TE LL_USART_EnableDirectionTx
|
|
672 |
* @param USARTx USART Instance
|
|
673 |
* @retval None
|
|
674 |
*/
|
|
675 |
__STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx)
|
|
676 |
{
|
|
677 |
SET_BIT(USARTx->CR1, USART_CR1_TE);
|
|
678 |
}
|
|
679 |
|
|
680 |
/**
|
|
681 |
* @brief Transmitter Disable
|
|
682 |
* @rmtoll CR1 TE LL_USART_DisableDirectionTx
|
|
683 |
* @param USARTx USART Instance
|
|
684 |
* @retval None
|
|
685 |
*/
|
|
686 |
__STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx)
|
|
687 |
{
|
|
688 |
CLEAR_BIT(USARTx->CR1, USART_CR1_TE);
|
|
689 |
}
|
|
690 |
|
|
691 |
/**
|
|
692 |
* @brief Configure simultaneously enabled/disabled states
|
|
693 |
* of Transmitter and Receiver
|
|
694 |
* @rmtoll CR1 RE LL_USART_SetTransferDirection\n
|
|
695 |
* CR1 TE LL_USART_SetTransferDirection
|
|
696 |
* @param USARTx USART Instance
|
|
697 |
* @param TransferDirection This parameter can be one of the following values:
|
|
698 |
* @arg @ref LL_USART_DIRECTION_NONE
|
|
699 |
* @arg @ref LL_USART_DIRECTION_RX
|
|
700 |
* @arg @ref LL_USART_DIRECTION_TX
|
|
701 |
* @arg @ref LL_USART_DIRECTION_TX_RX
|
|
702 |
* @retval None
|
|
703 |
*/
|
|
704 |
__STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection)
|
|
705 |
{
|
|
706 |
MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection);
|
|
707 |
}
|
|
708 |
|
|
709 |
/**
|
|
710 |
* @brief Return enabled/disabled states of Transmitter and Receiver
|
|
711 |
* @rmtoll CR1 RE LL_USART_GetTransferDirection\n
|
|
712 |
* CR1 TE LL_USART_GetTransferDirection
|
|
713 |
* @param USARTx USART Instance
|
|
714 |
* @retval Returned value can be one of the following values:
|
|
715 |
* @arg @ref LL_USART_DIRECTION_NONE
|
|
716 |
* @arg @ref LL_USART_DIRECTION_RX
|
|
717 |
* @arg @ref LL_USART_DIRECTION_TX
|
|
718 |
* @arg @ref LL_USART_DIRECTION_TX_RX
|
|
719 |
*/
|
|
720 |
__STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx)
|
|
721 |
{
|
|
722 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE));
|
|
723 |
}
|
|
724 |
|
|
725 |
/**
|
|
726 |
* @brief Configure Parity (enabled/disabled and parity mode if enabled).
|
|
727 |
* @note This function selects if hardware parity control (generation and detection) is enabled or disabled.
|
|
728 |
* When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position
|
|
729 |
* (9th or 8th bit depending on data width) and parity is checked on the received data.
|
|
730 |
* @rmtoll CR1 PS LL_USART_SetParity\n
|
|
731 |
* CR1 PCE LL_USART_SetParity
|
|
732 |
* @param USARTx USART Instance
|
|
733 |
* @param Parity This parameter can be one of the following values:
|
|
734 |
* @arg @ref LL_USART_PARITY_NONE
|
|
735 |
* @arg @ref LL_USART_PARITY_EVEN
|
|
736 |
* @arg @ref LL_USART_PARITY_ODD
|
|
737 |
* @retval None
|
|
738 |
*/
|
|
739 |
__STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity)
|
|
740 |
{
|
|
741 |
MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity);
|
|
742 |
}
|
|
743 |
|
|
744 |
/**
|
|
745 |
* @brief Return Parity configuration (enabled/disabled and parity mode if enabled)
|
|
746 |
* @rmtoll CR1 PS LL_USART_GetParity\n
|
|
747 |
* CR1 PCE LL_USART_GetParity
|
|
748 |
* @param USARTx USART Instance
|
|
749 |
* @retval Returned value can be one of the following values:
|
|
750 |
* @arg @ref LL_USART_PARITY_NONE
|
|
751 |
* @arg @ref LL_USART_PARITY_EVEN
|
|
752 |
* @arg @ref LL_USART_PARITY_ODD
|
|
753 |
*/
|
|
754 |
__STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx)
|
|
755 |
{
|
|
756 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE));
|
|
757 |
}
|
|
758 |
|
|
759 |
/**
|
|
760 |
* @brief Set Receiver Wake Up method from Mute mode.
|
|
761 |
* @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod
|
|
762 |
* @param USARTx USART Instance
|
|
763 |
* @param Method This parameter can be one of the following values:
|
|
764 |
* @arg @ref LL_USART_WAKEUP_IDLELINE
|
|
765 |
* @arg @ref LL_USART_WAKEUP_ADDRESSMARK
|
|
766 |
* @retval None
|
|
767 |
*/
|
|
768 |
__STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method)
|
|
769 |
{
|
|
770 |
MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method);
|
|
771 |
}
|
|
772 |
|
|
773 |
/**
|
|
774 |
* @brief Return Receiver Wake Up method from Mute mode
|
|
775 |
* @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod
|
|
776 |
* @param USARTx USART Instance
|
|
777 |
* @retval Returned value can be one of the following values:
|
|
778 |
* @arg @ref LL_USART_WAKEUP_IDLELINE
|
|
779 |
* @arg @ref LL_USART_WAKEUP_ADDRESSMARK
|
|
780 |
*/
|
|
781 |
__STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx)
|
|
782 |
{
|
|
783 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE));
|
|
784 |
}
|
|
785 |
|
|
786 |
/**
|
|
787 |
* @brief Set Word length (i.e. nb of data bits, excluding start and stop bits)
|
|
788 |
* @rmtoll CR1 M0 LL_USART_SetDataWidth\n
|
|
789 |
* CR1 M1 LL_USART_SetDataWidth
|
|
790 |
* @param USARTx USART Instance
|
|
791 |
* @param DataWidth This parameter can be one of the following values:
|
|
792 |
* @arg @ref LL_USART_DATAWIDTH_7B (*)
|
|
793 |
* @arg @ref LL_USART_DATAWIDTH_8B
|
|
794 |
* @arg @ref LL_USART_DATAWIDTH_9B
|
|
795 |
*
|
|
796 |
* (*) Values not available on all devices
|
|
797 |
* @retval None
|
|
798 |
*/
|
|
799 |
__STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth)
|
|
800 |
{
|
|
801 |
MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth);
|
|
802 |
}
|
|
803 |
|
|
804 |
/**
|
|
805 |
* @brief Return Word length (i.e. nb of data bits, excluding start and stop bits)
|
|
806 |
* @rmtoll CR1 M0 LL_USART_GetDataWidth\n
|
|
807 |
* CR1 M1 LL_USART_GetDataWidth
|
|
808 |
* @param USARTx USART Instance
|
|
809 |
* @retval Returned value can be one of the following values:
|
|
810 |
* @arg @ref LL_USART_DATAWIDTH_7B (*)
|
|
811 |
* @arg @ref LL_USART_DATAWIDTH_8B
|
|
812 |
* @arg @ref LL_USART_DATAWIDTH_9B
|
|
813 |
*
|
|
814 |
* (*) Values not available on all devices
|
|
815 |
*/
|
|
816 |
__STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx)
|
|
817 |
{
|
|
818 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M));
|
|
819 |
}
|
|
820 |
|
|
821 |
/**
|
|
822 |
* @brief Allow switch between Mute Mode and Active mode
|
|
823 |
* @rmtoll CR1 MME LL_USART_EnableMuteMode
|
|
824 |
* @param USARTx USART Instance
|
|
825 |
* @retval None
|
|
826 |
*/
|
|
827 |
__STATIC_INLINE void LL_USART_EnableMuteMode(USART_TypeDef *USARTx)
|
|
828 |
{
|
|
829 |
SET_BIT(USARTx->CR1, USART_CR1_MME);
|
|
830 |
}
|
|
831 |
|
|
832 |
/**
|
|
833 |
* @brief Prevent Mute Mode use. Set Receiver in active mode permanently.
|
|
834 |
* @rmtoll CR1 MME LL_USART_DisableMuteMode
|
|
835 |
* @param USARTx USART Instance
|
|
836 |
* @retval None
|
|
837 |
*/
|
|
838 |
__STATIC_INLINE void LL_USART_DisableMuteMode(USART_TypeDef *USARTx)
|
|
839 |
{
|
|
840 |
CLEAR_BIT(USARTx->CR1, USART_CR1_MME);
|
|
841 |
}
|
|
842 |
|
|
843 |
/**
|
|
844 |
* @brief Indicate if switch between Mute Mode and Active mode is allowed
|
|
845 |
* @rmtoll CR1 MME LL_USART_IsEnabledMuteMode
|
|
846 |
* @param USARTx USART Instance
|
|
847 |
* @retval State of bit (1 or 0).
|
|
848 |
*/
|
|
849 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledMuteMode(USART_TypeDef *USARTx)
|
|
850 |
{
|
|
851 |
return (READ_BIT(USARTx->CR1, USART_CR1_MME) == (USART_CR1_MME));
|
|
852 |
}
|
|
853 |
|
|
854 |
/**
|
|
855 |
* @brief Set Oversampling to 8-bit or 16-bit mode
|
|
856 |
* @rmtoll CR1 OVER8 LL_USART_SetOverSampling
|
|
857 |
* @param USARTx USART Instance
|
|
858 |
* @param OverSampling This parameter can be one of the following values:
|
|
859 |
* @arg @ref LL_USART_OVERSAMPLING_16
|
|
860 |
* @arg @ref LL_USART_OVERSAMPLING_8
|
|
861 |
* @retval None
|
|
862 |
*/
|
|
863 |
__STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling)
|
|
864 |
{
|
|
865 |
MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling);
|
|
866 |
}
|
|
867 |
|
|
868 |
/**
|
|
869 |
* @brief Return Oversampling mode
|
|
870 |
* @rmtoll CR1 OVER8 LL_USART_GetOverSampling
|
|
871 |
* @param USARTx USART Instance
|
|
872 |
* @retval Returned value can be one of the following values:
|
|
873 |
* @arg @ref LL_USART_OVERSAMPLING_16
|
|
874 |
* @arg @ref LL_USART_OVERSAMPLING_8
|
|
875 |
*/
|
|
876 |
__STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx)
|
|
877 |
{
|
|
878 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8));
|
|
879 |
}
|
|
880 |
|
|
881 |
/**
|
|
882 |
* @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not
|
|
883 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
884 |
* Synchronous mode is supported by the USARTx instance.
|
|
885 |
* @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput
|
|
886 |
* @param USARTx USART Instance
|
|
887 |
* @param LastBitClockPulse This parameter can be one of the following values:
|
|
888 |
* @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
|
|
889 |
* @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
|
|
890 |
* @retval None
|
|
891 |
*/
|
|
892 |
__STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse)
|
|
893 |
{
|
|
894 |
MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse);
|
|
895 |
}
|
|
896 |
|
|
897 |
/**
|
|
898 |
* @brief Retrieve Clock pulse of the last data bit output configuration
|
|
899 |
* (Last bit Clock pulse output to the SCLK pin or not)
|
|
900 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
901 |
* Synchronous mode is supported by the USARTx instance.
|
|
902 |
* @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput
|
|
903 |
* @param USARTx USART Instance
|
|
904 |
* @retval Returned value can be one of the following values:
|
|
905 |
* @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
|
|
906 |
* @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
|
|
907 |
*/
|
|
908 |
__STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx)
|
|
909 |
{
|
|
910 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL));
|
|
911 |
}
|
|
912 |
|
|
913 |
/**
|
|
914 |
* @brief Select the phase of the clock output on the SCLK pin in synchronous mode
|
|
915 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
916 |
* Synchronous mode is supported by the USARTx instance.
|
|
917 |
* @rmtoll CR2 CPHA LL_USART_SetClockPhase
|
|
918 |
* @param USARTx USART Instance
|
|
919 |
* @param ClockPhase This parameter can be one of the following values:
|
|
920 |
* @arg @ref LL_USART_PHASE_1EDGE
|
|
921 |
* @arg @ref LL_USART_PHASE_2EDGE
|
|
922 |
* @retval None
|
|
923 |
*/
|
|
924 |
__STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase)
|
|
925 |
{
|
|
926 |
MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase);
|
|
927 |
}
|
|
928 |
|
|
929 |
/**
|
|
930 |
* @brief Return phase of the clock output on the SCLK pin in synchronous mode
|
|
931 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
932 |
* Synchronous mode is supported by the USARTx instance.
|
|
933 |
* @rmtoll CR2 CPHA LL_USART_GetClockPhase
|
|
934 |
* @param USARTx USART Instance
|
|
935 |
* @retval Returned value can be one of the following values:
|
|
936 |
* @arg @ref LL_USART_PHASE_1EDGE
|
|
937 |
* @arg @ref LL_USART_PHASE_2EDGE
|
|
938 |
*/
|
|
939 |
__STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx)
|
|
940 |
{
|
|
941 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA));
|
|
942 |
}
|
|
943 |
|
|
944 |
/**
|
|
945 |
* @brief Select the polarity of the clock output on the SCLK pin in synchronous mode
|
|
946 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
947 |
* Synchronous mode is supported by the USARTx instance.
|
|
948 |
* @rmtoll CR2 CPOL LL_USART_SetClockPolarity
|
|
949 |
* @param USARTx USART Instance
|
|
950 |
* @param ClockPolarity This parameter can be one of the following values:
|
|
951 |
* @arg @ref LL_USART_POLARITY_LOW
|
|
952 |
* @arg @ref LL_USART_POLARITY_HIGH
|
|
953 |
* @retval None
|
|
954 |
*/
|
|
955 |
__STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity)
|
|
956 |
{
|
|
957 |
MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity);
|
|
958 |
}
|
|
959 |
|
|
960 |
/**
|
|
961 |
* @brief Return polarity of the clock output on the SCLK pin in synchronous mode
|
|
962 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
963 |
* Synchronous mode is supported by the USARTx instance.
|
|
964 |
* @rmtoll CR2 CPOL LL_USART_GetClockPolarity
|
|
965 |
* @param USARTx USART Instance
|
|
966 |
* @retval Returned value can be one of the following values:
|
|
967 |
* @arg @ref LL_USART_POLARITY_LOW
|
|
968 |
* @arg @ref LL_USART_POLARITY_HIGH
|
|
969 |
*/
|
|
970 |
__STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx)
|
|
971 |
{
|
|
972 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL));
|
|
973 |
}
|
|
974 |
|
|
975 |
/**
|
|
976 |
* @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse)
|
|
977 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
978 |
* Synchronous mode is supported by the USARTx instance.
|
|
979 |
* @note Call of this function is equivalent to following function call sequence :
|
|
980 |
* - Clock Phase configuration using @ref LL_USART_SetClockPhase() function
|
|
981 |
* - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function
|
|
982 |
* - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function
|
|
983 |
* @rmtoll CR2 CPHA LL_USART_ConfigClock\n
|
|
984 |
* CR2 CPOL LL_USART_ConfigClock\n
|
|
985 |
* CR2 LBCL LL_USART_ConfigClock
|
|
986 |
* @param USARTx USART Instance
|
|
987 |
* @param Phase This parameter can be one of the following values:
|
|
988 |
* @arg @ref LL_USART_PHASE_1EDGE
|
|
989 |
* @arg @ref LL_USART_PHASE_2EDGE
|
|
990 |
* @param Polarity This parameter can be one of the following values:
|
|
991 |
* @arg @ref LL_USART_POLARITY_LOW
|
|
992 |
* @arg @ref LL_USART_POLARITY_HIGH
|
|
993 |
* @param LBCPOutput This parameter can be one of the following values:
|
|
994 |
* @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
|
|
995 |
* @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
|
|
996 |
* @retval None
|
|
997 |
*/
|
|
998 |
__STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput)
|
|
999 |
{
|
|
1000 |
MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput);
|
|
1001 |
}
|
|
1002 |
|
|
1003 |
/**
|
|
1004 |
* @brief Enable Clock output on SCLK pin
|
|
1005 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
1006 |
* Synchronous mode is supported by the USARTx instance.
|
|
1007 |
* @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput
|
|
1008 |
* @param USARTx USART Instance
|
|
1009 |
* @retval None
|
|
1010 |
*/
|
|
1011 |
__STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx)
|
|
1012 |
{
|
|
1013 |
SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
|
|
1014 |
}
|
|
1015 |
|
|
1016 |
/**
|
|
1017 |
* @brief Disable Clock output on SCLK pin
|
|
1018 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
1019 |
* Synchronous mode is supported by the USARTx instance.
|
|
1020 |
* @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput
|
|
1021 |
* @param USARTx USART Instance
|
|
1022 |
* @retval None
|
|
1023 |
*/
|
|
1024 |
__STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx)
|
|
1025 |
{
|
|
1026 |
CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
|
|
1027 |
}
|
|
1028 |
|
|
1029 |
/**
|
|
1030 |
* @brief Indicate if Clock output on SCLK pin is enabled
|
|
1031 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
1032 |
* Synchronous mode is supported by the USARTx instance.
|
|
1033 |
* @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput
|
|
1034 |
* @param USARTx USART Instance
|
|
1035 |
* @retval State of bit (1 or 0).
|
|
1036 |
*/
|
|
1037 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx)
|
|
1038 |
{
|
|
1039 |
return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN));
|
|
1040 |
}
|
|
1041 |
|
|
1042 |
/**
|
|
1043 |
* @brief Set the length of the stop bits
|
|
1044 |
* @rmtoll CR2 STOP LL_USART_SetStopBitsLength
|
|
1045 |
* @param USARTx USART Instance
|
|
1046 |
* @param StopBits This parameter can be one of the following values:
|
|
1047 |
* @arg @ref LL_USART_STOPBITS_0_5 (*)
|
|
1048 |
* @arg @ref LL_USART_STOPBITS_1
|
|
1049 |
* @arg @ref LL_USART_STOPBITS_1_5 (*)
|
|
1050 |
* @arg @ref LL_USART_STOPBITS_2
|
|
1051 |
*
|
|
1052 |
* (*) Values not available on all devices
|
|
1053 |
* @retval None
|
|
1054 |
*/
|
|
1055 |
__STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits)
|
|
1056 |
{
|
|
1057 |
MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
|
|
1058 |
}
|
|
1059 |
|
|
1060 |
/**
|
|
1061 |
* @brief Retrieve the length of the stop bits
|
|
1062 |
* @rmtoll CR2 STOP LL_USART_GetStopBitsLength
|
|
1063 |
* @param USARTx USART Instance
|
|
1064 |
* @retval Returned value can be one of the following values:
|
|
1065 |
* @arg @ref LL_USART_STOPBITS_0_5 (*)
|
|
1066 |
* @arg @ref LL_USART_STOPBITS_1
|
|
1067 |
* @arg @ref LL_USART_STOPBITS_1_5 (*)
|
|
1068 |
* @arg @ref LL_USART_STOPBITS_2
|
|
1069 |
*
|
|
1070 |
* (*) Values not available on all devices
|
|
1071 |
*/
|
|
1072 |
__STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx)
|
|
1073 |
{
|
|
1074 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP));
|
|
1075 |
}
|
|
1076 |
|
|
1077 |
/**
|
|
1078 |
* @brief Configure Character frame format (Datawidth, Parity control, Stop Bits)
|
|
1079 |
* @note Call of this function is equivalent to following function call sequence :
|
|
1080 |
* - Data Width configuration using @ref LL_USART_SetDataWidth() function
|
|
1081 |
* - Parity Control and mode configuration using @ref LL_USART_SetParity() function
|
|
1082 |
* - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function
|
|
1083 |
* @rmtoll CR1 PS LL_USART_ConfigCharacter\n
|
|
1084 |
* CR1 PCE LL_USART_ConfigCharacter\n
|
|
1085 |
* CR1 M0 LL_USART_ConfigCharacter\n
|
|
1086 |
* CR1 M1 LL_USART_ConfigCharacter\n
|
|
1087 |
* CR2 STOP LL_USART_ConfigCharacter
|
|
1088 |
* @param USARTx USART Instance
|
|
1089 |
* @param DataWidth This parameter can be one of the following values:
|
|
1090 |
* @arg @ref LL_USART_DATAWIDTH_7B (*)
|
|
1091 |
* @arg @ref LL_USART_DATAWIDTH_8B
|
|
1092 |
* @arg @ref LL_USART_DATAWIDTH_9B
|
|
1093 |
* @param Parity This parameter can be one of the following values:
|
|
1094 |
* @arg @ref LL_USART_PARITY_NONE
|
|
1095 |
* @arg @ref LL_USART_PARITY_EVEN
|
|
1096 |
* @arg @ref LL_USART_PARITY_ODD
|
|
1097 |
* @param StopBits This parameter can be one of the following values:
|
|
1098 |
* @arg @ref LL_USART_STOPBITS_0_5 (*)
|
|
1099 |
* @arg @ref LL_USART_STOPBITS_1
|
|
1100 |
* @arg @ref LL_USART_STOPBITS_1_5 (*)
|
|
1101 |
* @arg @ref LL_USART_STOPBITS_2
|
|
1102 |
*
|
|
1103 |
* (*) Values not available on all devices
|
|
1104 |
* @retval None
|
|
1105 |
*/
|
|
1106 |
__STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity,
|
|
1107 |
uint32_t StopBits)
|
|
1108 |
{
|
|
1109 |
MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth);
|
|
1110 |
MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
/**
|
|
1114 |
* @brief Configure TX/RX pins swapping setting.
|
|
1115 |
* @rmtoll CR2 SWAP LL_USART_SetTXRXSwap
|
|
1116 |
* @param USARTx USART Instance
|
|
1117 |
* @param SwapConfig This parameter can be one of the following values:
|
|
1118 |
* @arg @ref LL_USART_TXRX_STANDARD
|
|
1119 |
* @arg @ref LL_USART_TXRX_SWAPPED
|
|
1120 |
* @retval None
|
|
1121 |
*/
|
|
1122 |
__STATIC_INLINE void LL_USART_SetTXRXSwap(USART_TypeDef *USARTx, uint32_t SwapConfig)
|
|
1123 |
{
|
|
1124 |
MODIFY_REG(USARTx->CR2, USART_CR2_SWAP, SwapConfig);
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
/**
|
|
1128 |
* @brief Retrieve TX/RX pins swapping configuration.
|
|
1129 |
* @rmtoll CR2 SWAP LL_USART_GetTXRXSwap
|
|
1130 |
* @param USARTx USART Instance
|
|
1131 |
* @retval Returned value can be one of the following values:
|
|
1132 |
* @arg @ref LL_USART_TXRX_STANDARD
|
|
1133 |
* @arg @ref LL_USART_TXRX_SWAPPED
|
|
1134 |
*/
|
|
1135 |
__STATIC_INLINE uint32_t LL_USART_GetTXRXSwap(USART_TypeDef *USARTx)
|
|
1136 |
{
|
|
1137 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_SWAP));
|
|
1138 |
}
|
|
1139 |
|
|
1140 |
/**
|
|
1141 |
* @brief Configure RX pin active level logic
|
|
1142 |
* @rmtoll CR2 RXINV LL_USART_SetRXPinLevel
|
|
1143 |
* @param USARTx USART Instance
|
|
1144 |
* @param PinInvMethod This parameter can be one of the following values:
|
|
1145 |
* @arg @ref LL_USART_RXPIN_LEVEL_STANDARD
|
|
1146 |
* @arg @ref LL_USART_RXPIN_LEVEL_INVERTED
|
|
1147 |
* @retval None
|
|
1148 |
*/
|
|
1149 |
__STATIC_INLINE void LL_USART_SetRXPinLevel(USART_TypeDef *USARTx, uint32_t PinInvMethod)
|
|
1150 |
{
|
|
1151 |
MODIFY_REG(USARTx->CR2, USART_CR2_RXINV, PinInvMethod);
|
|
1152 |
}
|
|
1153 |
|
|
1154 |
/**
|
|
1155 |
* @brief Retrieve RX pin active level logic configuration
|
|
1156 |
* @rmtoll CR2 RXINV LL_USART_GetRXPinLevel
|
|
1157 |
* @param USARTx USART Instance
|
|
1158 |
* @retval Returned value can be one of the following values:
|
|
1159 |
* @arg @ref LL_USART_RXPIN_LEVEL_STANDARD
|
|
1160 |
* @arg @ref LL_USART_RXPIN_LEVEL_INVERTED
|
|
1161 |
*/
|
|
1162 |
__STATIC_INLINE uint32_t LL_USART_GetRXPinLevel(USART_TypeDef *USARTx)
|
|
1163 |
{
|
|
1164 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_RXINV));
|
|
1165 |
}
|
|
1166 |
|
|
1167 |
/**
|
|
1168 |
* @brief Configure TX pin active level logic
|
|
1169 |
* @rmtoll CR2 TXINV LL_USART_SetTXPinLevel
|
|
1170 |
* @param USARTx USART Instance
|
|
1171 |
* @param PinInvMethod This parameter can be one of the following values:
|
|
1172 |
* @arg @ref LL_USART_TXPIN_LEVEL_STANDARD
|
|
1173 |
* @arg @ref LL_USART_TXPIN_LEVEL_INVERTED
|
|
1174 |
* @retval None
|
|
1175 |
*/
|
|
1176 |
__STATIC_INLINE void LL_USART_SetTXPinLevel(USART_TypeDef *USARTx, uint32_t PinInvMethod)
|
|
1177 |
{
|
|
1178 |
MODIFY_REG(USARTx->CR2, USART_CR2_TXINV, PinInvMethod);
|
|
1179 |
}
|
|
1180 |
|
|
1181 |
/**
|
|
1182 |
* @brief Retrieve TX pin active level logic configuration
|
|
1183 |
* @rmtoll CR2 TXINV LL_USART_GetTXPinLevel
|
|
1184 |
* @param USARTx USART Instance
|
|
1185 |
* @retval Returned value can be one of the following values:
|
|
1186 |
* @arg @ref LL_USART_TXPIN_LEVEL_STANDARD
|
|
1187 |
* @arg @ref LL_USART_TXPIN_LEVEL_INVERTED
|
|
1188 |
*/
|
|
1189 |
__STATIC_INLINE uint32_t LL_USART_GetTXPinLevel(USART_TypeDef *USARTx)
|
|
1190 |
{
|
|
1191 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_TXINV));
|
|
1192 |
}
|
|
1193 |
|
|
1194 |
/**
|
|
1195 |
* @brief Configure Binary data logic.
|
|
1196 |
* @note Allow to define how Logical data from the data register are send/received :
|
|
1197 |
* either in positive/direct logic (1=H, 0=L) or in negative/inverse logic (1=L, 0=H)
|
|
1198 |
* @rmtoll CR2 DATAINV LL_USART_SetBinaryDataLogic
|
|
1199 |
* @param USARTx USART Instance
|
|
1200 |
* @param DataLogic This parameter can be one of the following values:
|
|
1201 |
* @arg @ref LL_USART_BINARY_LOGIC_POSITIVE
|
|
1202 |
* @arg @ref LL_USART_BINARY_LOGIC_NEGATIVE
|
|
1203 |
* @retval None
|
|
1204 |
*/
|
|
1205 |
__STATIC_INLINE void LL_USART_SetBinaryDataLogic(USART_TypeDef *USARTx, uint32_t DataLogic)
|
|
1206 |
{
|
|
1207 |
MODIFY_REG(USARTx->CR2, USART_CR2_DATAINV, DataLogic);
|
|
1208 |
}
|
|
1209 |
|
|
1210 |
/**
|
|
1211 |
* @brief Retrieve Binary data configuration
|
|
1212 |
* @rmtoll CR2 DATAINV LL_USART_GetBinaryDataLogic
|
|
1213 |
* @param USARTx USART Instance
|
|
1214 |
* @retval Returned value can be one of the following values:
|
|
1215 |
* @arg @ref LL_USART_BINARY_LOGIC_POSITIVE
|
|
1216 |
* @arg @ref LL_USART_BINARY_LOGIC_NEGATIVE
|
|
1217 |
*/
|
|
1218 |
__STATIC_INLINE uint32_t LL_USART_GetBinaryDataLogic(USART_TypeDef *USARTx)
|
|
1219 |
{
|
|
1220 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_DATAINV));
|
|
1221 |
}
|
|
1222 |
|
|
1223 |
/**
|
|
1224 |
* @brief Configure transfer bit order (either Less or Most Significant Bit First)
|
|
1225 |
* @note MSB First means data is transmitted/received with the MSB first, following the start bit.
|
|
1226 |
* LSB First means data is transmitted/received with data bit 0 first, following the start bit.
|
|
1227 |
* @rmtoll CR2 MSBFIRST LL_USART_SetTransferBitOrder
|
|
1228 |
* @param USARTx USART Instance
|
|
1229 |
* @param BitOrder This parameter can be one of the following values:
|
|
1230 |
* @arg @ref LL_USART_BITORDER_LSBFIRST
|
|
1231 |
* @arg @ref LL_USART_BITORDER_MSBFIRST
|
|
1232 |
* @retval None
|
|
1233 |
*/
|
|
1234 |
__STATIC_INLINE void LL_USART_SetTransferBitOrder(USART_TypeDef *USARTx, uint32_t BitOrder)
|
|
1235 |
{
|
|
1236 |
MODIFY_REG(USARTx->CR2, USART_CR2_MSBFIRST, BitOrder);
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
/**
|
|
1240 |
* @brief Return transfer bit order (either Less or Most Significant Bit First)
|
|
1241 |
* @note MSB First means data is transmitted/received with the MSB first, following the start bit.
|
|
1242 |
* LSB First means data is transmitted/received with data bit 0 first, following the start bit.
|
|
1243 |
* @rmtoll CR2 MSBFIRST LL_USART_GetTransferBitOrder
|
|
1244 |
* @param USARTx USART Instance
|
|
1245 |
* @retval Returned value can be one of the following values:
|
|
1246 |
* @arg @ref LL_USART_BITORDER_LSBFIRST
|
|
1247 |
* @arg @ref LL_USART_BITORDER_MSBFIRST
|
|
1248 |
*/
|
|
1249 |
__STATIC_INLINE uint32_t LL_USART_GetTransferBitOrder(USART_TypeDef *USARTx)
|
|
1250 |
{
|
|
1251 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_MSBFIRST));
|
|
1252 |
}
|
|
1253 |
|
|
1254 |
/**
|
|
1255 |
* @brief Enable Auto Baud-Rate Detection
|
|
1256 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
1257 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
1258 |
* @rmtoll CR2 ABREN LL_USART_EnableAutoBaudRate
|
|
1259 |
* @param USARTx USART Instance
|
|
1260 |
* @retval None
|
|
1261 |
*/
|
|
1262 |
__STATIC_INLINE void LL_USART_EnableAutoBaudRate(USART_TypeDef *USARTx)
|
|
1263 |
{
|
|
1264 |
SET_BIT(USARTx->CR2, USART_CR2_ABREN);
|
|
1265 |
}
|
|
1266 |
|
|
1267 |
/**
|
|
1268 |
* @brief Disable Auto Baud-Rate Detection
|
|
1269 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
1270 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
1271 |
* @rmtoll CR2 ABREN LL_USART_DisableAutoBaudRate
|
|
1272 |
* @param USARTx USART Instance
|
|
1273 |
* @retval None
|
|
1274 |
*/
|
|
1275 |
__STATIC_INLINE void LL_USART_DisableAutoBaudRate(USART_TypeDef *USARTx)
|
|
1276 |
{
|
|
1277 |
CLEAR_BIT(USARTx->CR2, USART_CR2_ABREN);
|
|
1278 |
}
|
|
1279 |
|
|
1280 |
/**
|
|
1281 |
* @brief Indicate if Auto Baud-Rate Detection mechanism is enabled
|
|
1282 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
1283 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
1284 |
* @rmtoll CR2 ABREN LL_USART_IsEnabledAutoBaud
|
|
1285 |
* @param USARTx USART Instance
|
|
1286 |
* @retval State of bit (1 or 0).
|
|
1287 |
*/
|
|
1288 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledAutoBaud(USART_TypeDef *USARTx)
|
|
1289 |
{
|
|
1290 |
return (READ_BIT(USARTx->CR2, USART_CR2_ABREN) == (USART_CR2_ABREN));
|
|
1291 |
}
|
|
1292 |
|
|
1293 |
/**
|
|
1294 |
* @brief Set Auto Baud-Rate mode bits
|
|
1295 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
1296 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
1297 |
* @rmtoll CR2 ABRMODE LL_USART_SetAutoBaudRateMode
|
|
1298 |
* @param USARTx USART Instance
|
|
1299 |
* @param AutoBaudRateMode This parameter can be one of the following values:
|
|
1300 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
|
|
1301 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
|
|
1302 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME (*)
|
|
1303 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_55_FRAME (*)
|
|
1304 |
*
|
|
1305 |
* (*) Values not available on all devices
|
|
1306 |
* @retval None
|
|
1307 |
*/
|
|
1308 |
__STATIC_INLINE void LL_USART_SetAutoBaudRateMode(USART_TypeDef *USARTx, uint32_t AutoBaudRateMode)
|
|
1309 |
{
|
|
1310 |
MODIFY_REG(USARTx->CR2, USART_CR2_ABRMODE, AutoBaudRateMode);
|
|
1311 |
}
|
|
1312 |
|
|
1313 |
/**
|
|
1314 |
* @brief Return Auto Baud-Rate mode
|
|
1315 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
1316 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
1317 |
* @rmtoll CR2 ABRMODE LL_USART_GetAutoBaudRateMode
|
|
1318 |
* @param USARTx USART Instance
|
|
1319 |
* @retval Returned value can be one of the following values:
|
|
1320 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
|
|
1321 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
|
|
1322 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME (*)
|
|
1323 |
* @arg @ref LL_USART_AUTOBAUD_DETECT_ON_55_FRAME (*)
|
|
1324 |
*
|
|
1325 |
* (*) Values not available on all devices
|
|
1326 |
*/
|
|
1327 |
__STATIC_INLINE uint32_t LL_USART_GetAutoBaudRateMode(USART_TypeDef *USARTx)
|
|
1328 |
{
|
|
1329 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ABRMODE));
|
|
1330 |
}
|
|
1331 |
|
|
1332 |
/**
|
|
1333 |
* @brief Enable Receiver Timeout
|
|
1334 |
* @rmtoll CR2 RTOEN LL_USART_EnableRxTimeout
|
|
1335 |
* @param USARTx USART Instance
|
|
1336 |
* @retval None
|
|
1337 |
*/
|
|
1338 |
__STATIC_INLINE void LL_USART_EnableRxTimeout(USART_TypeDef *USARTx)
|
|
1339 |
{
|
|
1340 |
SET_BIT(USARTx->CR2, USART_CR2_RTOEN);
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
/**
|
|
1344 |
* @brief Disable Receiver Timeout
|
|
1345 |
* @rmtoll CR2 RTOEN LL_USART_DisableRxTimeout
|
|
1346 |
* @param USARTx USART Instance
|
|
1347 |
* @retval None
|
|
1348 |
*/
|
|
1349 |
__STATIC_INLINE void LL_USART_DisableRxTimeout(USART_TypeDef *USARTx)
|
|
1350 |
{
|
|
1351 |
CLEAR_BIT(USARTx->CR2, USART_CR2_RTOEN);
|
|
1352 |
}
|
|
1353 |
|
|
1354 |
/**
|
|
1355 |
* @brief Indicate if Receiver Timeout feature is enabled
|
|
1356 |
* @rmtoll CR2 RTOEN LL_USART_IsEnabledRxTimeout
|
|
1357 |
* @param USARTx USART Instance
|
|
1358 |
* @retval State of bit (1 or 0).
|
|
1359 |
*/
|
|
1360 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledRxTimeout(USART_TypeDef *USARTx)
|
|
1361 |
{
|
|
1362 |
return (READ_BIT(USARTx->CR2, USART_CR2_RTOEN) == (USART_CR2_RTOEN));
|
|
1363 |
}
|
|
1364 |
|
|
1365 |
/**
|
|
1366 |
* @brief Set Address of the USART node.
|
|
1367 |
* @note This is used in multiprocessor communication during Mute mode or Stop mode,
|
|
1368 |
* for wake up with address mark detection.
|
|
1369 |
* @note 4bits address node is used when 4-bit Address Detection is selected in ADDM7.
|
|
1370 |
* (b7-b4 should be set to 0)
|
|
1371 |
* 8bits address node is used when 7-bit Address Detection is selected in ADDM7.
|
|
1372 |
* (This is used in multiprocessor communication during Mute mode or Stop mode,
|
|
1373 |
* for wake up with 7-bit address mark detection.
|
|
1374 |
* The MSB of the character sent by the transmitter should be equal to 1.
|
|
1375 |
* It may also be used for character detection during normal reception,
|
|
1376 |
* Mute mode inactive (for example, end of block detection in ModBus protocol).
|
|
1377 |
* In this case, the whole received character (8-bit) is compared to the ADD[7:0]
|
|
1378 |
* value and CMF flag is set on match)
|
|
1379 |
* @rmtoll CR2 ADD LL_USART_ConfigNodeAddress\n
|
|
1380 |
* CR2 ADDM7 LL_USART_ConfigNodeAddress
|
|
1381 |
* @param USARTx USART Instance
|
|
1382 |
* @param AddressLen This parameter can be one of the following values:
|
|
1383 |
* @arg @ref LL_USART_ADDRESS_DETECT_4B
|
|
1384 |
* @arg @ref LL_USART_ADDRESS_DETECT_7B
|
|
1385 |
* @param NodeAddress 4 or 7 bit Address of the USART node.
|
|
1386 |
* @retval None
|
|
1387 |
*/
|
|
1388 |
__STATIC_INLINE void LL_USART_ConfigNodeAddress(USART_TypeDef *USARTx, uint32_t AddressLen, uint32_t NodeAddress)
|
|
1389 |
{
|
|
1390 |
MODIFY_REG(USARTx->CR2, USART_CR2_ADD | USART_CR2_ADDM7,
|
|
1391 |
(uint32_t)(AddressLen | (NodeAddress << USART_CR2_ADD_Pos)));
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
/**
|
|
1395 |
* @brief Return 8 bit Address of the USART node as set in ADD field of CR2.
|
|
1396 |
* @note If 4-bit Address Detection is selected in ADDM7,
|
|
1397 |
* only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant)
|
|
1398 |
* If 7-bit Address Detection is selected in ADDM7,
|
|
1399 |
* only 8bits (b7-b0) of returned value are relevant (b31-b8 are not relevant)
|
|
1400 |
* @rmtoll CR2 ADD LL_USART_GetNodeAddress
|
|
1401 |
* @param USARTx USART Instance
|
|
1402 |
* @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255)
|
|
1403 |
*/
|
|
1404 |
__STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx)
|
|
1405 |
{
|
|
1406 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD) >> USART_CR2_ADD_Pos);
|
|
1407 |
}
|
|
1408 |
|
|
1409 |
/**
|
|
1410 |
* @brief Return Length of Node Address used in Address Detection mode (7-bit or 4-bit)
|
|
1411 |
* @rmtoll CR2 ADDM7 LL_USART_GetNodeAddressLen
|
|
1412 |
* @param USARTx USART Instance
|
|
1413 |
* @retval Returned value can be one of the following values:
|
|
1414 |
* @arg @ref LL_USART_ADDRESS_DETECT_4B
|
|
1415 |
* @arg @ref LL_USART_ADDRESS_DETECT_7B
|
|
1416 |
*/
|
|
1417 |
__STATIC_INLINE uint32_t LL_USART_GetNodeAddressLen(USART_TypeDef *USARTx)
|
|
1418 |
{
|
|
1419 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADDM7));
|
|
1420 |
}
|
|
1421 |
|
|
1422 |
/**
|
|
1423 |
* @brief Enable RTS HW Flow Control
|
|
1424 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
1425 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
1426 |
* @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl
|
|
1427 |
* @param USARTx USART Instance
|
|
1428 |
* @retval None
|
|
1429 |
*/
|
|
1430 |
__STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx)
|
|
1431 |
{
|
|
1432 |
SET_BIT(USARTx->CR3, USART_CR3_RTSE);
|
|
1433 |
}
|
|
1434 |
|
|
1435 |
/**
|
|
1436 |
* @brief Disable RTS HW Flow Control
|
|
1437 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
1438 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
1439 |
* @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl
|
|
1440 |
* @param USARTx USART Instance
|
|
1441 |
* @retval None
|
|
1442 |
*/
|
|
1443 |
__STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx)
|
|
1444 |
{
|
|
1445 |
CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE);
|
|
1446 |
}
|
|
1447 |
|
|
1448 |
/**
|
|
1449 |
* @brief Enable CTS HW Flow Control
|
|
1450 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
1451 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
1452 |
* @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl
|
|
1453 |
* @param USARTx USART Instance
|
|
1454 |
* @retval None
|
|
1455 |
*/
|
|
1456 |
__STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx)
|
|
1457 |
{
|
|
1458 |
SET_BIT(USARTx->CR3, USART_CR3_CTSE);
|
|
1459 |
}
|
|
1460 |
|
|
1461 |
/**
|
|
1462 |
* @brief Disable CTS HW Flow Control
|
|
1463 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
1464 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
1465 |
* @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl
|
|
1466 |
* @param USARTx USART Instance
|
|
1467 |
* @retval None
|
|
1468 |
*/
|
|
1469 |
__STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx)
|
|
1470 |
{
|
|
1471 |
CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE);
|
|
1472 |
}
|
|
1473 |
|
|
1474 |
/**
|
|
1475 |
* @brief Configure HW Flow Control mode (both CTS and RTS)
|
|
1476 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
1477 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
1478 |
* @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n
|
|
1479 |
* CR3 CTSE LL_USART_SetHWFlowCtrl
|
|
1480 |
* @param USARTx USART Instance
|
|
1481 |
* @param HardwareFlowControl This parameter can be one of the following values:
|
|
1482 |
* @arg @ref LL_USART_HWCONTROL_NONE
|
|
1483 |
* @arg @ref LL_USART_HWCONTROL_RTS
|
|
1484 |
* @arg @ref LL_USART_HWCONTROL_CTS
|
|
1485 |
* @arg @ref LL_USART_HWCONTROL_RTS_CTS
|
|
1486 |
* @retval None
|
|
1487 |
*/
|
|
1488 |
__STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl)
|
|
1489 |
{
|
|
1490 |
MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl);
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
/**
|
|
1494 |
* @brief Return HW Flow Control configuration (both CTS and RTS)
|
|
1495 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
1496 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
1497 |
* @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n
|
|
1498 |
* CR3 CTSE LL_USART_GetHWFlowCtrl
|
|
1499 |
* @param USARTx USART Instance
|
|
1500 |
* @retval Returned value can be one of the following values:
|
|
1501 |
* @arg @ref LL_USART_HWCONTROL_NONE
|
|
1502 |
* @arg @ref LL_USART_HWCONTROL_RTS
|
|
1503 |
* @arg @ref LL_USART_HWCONTROL_CTS
|
|
1504 |
* @arg @ref LL_USART_HWCONTROL_RTS_CTS
|
|
1505 |
*/
|
|
1506 |
__STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx)
|
|
1507 |
{
|
|
1508 |
return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE));
|
|
1509 |
}
|
|
1510 |
|
|
1511 |
/**
|
|
1512 |
* @brief Enable One bit sampling method
|
|
1513 |
* @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp
|
|
1514 |
* @param USARTx USART Instance
|
|
1515 |
* @retval None
|
|
1516 |
*/
|
|
1517 |
__STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx)
|
|
1518 |
{
|
|
1519 |
SET_BIT(USARTx->CR3, USART_CR3_ONEBIT);
|
|
1520 |
}
|
|
1521 |
|
|
1522 |
/**
|
|
1523 |
* @brief Disable One bit sampling method
|
|
1524 |
* @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp
|
|
1525 |
* @param USARTx USART Instance
|
|
1526 |
* @retval None
|
|
1527 |
*/
|
|
1528 |
__STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx)
|
|
1529 |
{
|
|
1530 |
CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT);
|
|
1531 |
}
|
|
1532 |
|
|
1533 |
/**
|
|
1534 |
* @brief Indicate if One bit sampling method is enabled
|
|
1535 |
* @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp
|
|
1536 |
* @param USARTx USART Instance
|
|
1537 |
* @retval State of bit (1 or 0).
|
|
1538 |
*/
|
|
1539 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx)
|
|
1540 |
{
|
|
1541 |
return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT));
|
|
1542 |
}
|
|
1543 |
|
|
1544 |
/**
|
|
1545 |
* @brief Enable Overrun detection
|
|
1546 |
* @rmtoll CR3 OVRDIS LL_USART_EnableOverrunDetect
|
|
1547 |
* @param USARTx USART Instance
|
|
1548 |
* @retval None
|
|
1549 |
*/
|
|
1550 |
__STATIC_INLINE void LL_USART_EnableOverrunDetect(USART_TypeDef *USARTx)
|
|
1551 |
{
|
|
1552 |
CLEAR_BIT(USARTx->CR3, USART_CR3_OVRDIS);
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
/**
|
|
1556 |
* @brief Disable Overrun detection
|
|
1557 |
* @rmtoll CR3 OVRDIS LL_USART_DisableOverrunDetect
|
|
1558 |
* @param USARTx USART Instance
|
|
1559 |
* @retval None
|
|
1560 |
*/
|
|
1561 |
__STATIC_INLINE void LL_USART_DisableOverrunDetect(USART_TypeDef *USARTx)
|
|
1562 |
{
|
|
1563 |
SET_BIT(USARTx->CR3, USART_CR3_OVRDIS);
|
|
1564 |
}
|
|
1565 |
|
|
1566 |
/**
|
|
1567 |
* @brief Indicate if Overrun detection is enabled
|
|
1568 |
* @rmtoll CR3 OVRDIS LL_USART_IsEnabledOverrunDetect
|
|
1569 |
* @param USARTx USART Instance
|
|
1570 |
* @retval State of bit (1 or 0).
|
|
1571 |
*/
|
|
1572 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledOverrunDetect(USART_TypeDef *USARTx)
|
|
1573 |
{
|
|
1574 |
return (READ_BIT(USARTx->CR3, USART_CR3_OVRDIS) != USART_CR3_OVRDIS);
|
|
1575 |
}
|
|
1576 |
|
|
1577 |
#if defined(USART_WUSM_SUPPORT)
|
|
1578 |
/**
|
|
1579 |
* @brief Select event type for Wake UP Interrupt Flag (WUS[1:0] bits)
|
|
1580 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
1581 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
1582 |
* @rmtoll CR3 WUS LL_USART_SetWKUPType
|
|
1583 |
* @param USARTx USART Instance
|
|
1584 |
* @param Type This parameter can be one of the following values:
|
|
1585 |
* @arg @ref LL_USART_WAKEUP_ON_ADDRESS
|
|
1586 |
* @arg @ref LL_USART_WAKEUP_ON_STARTBIT
|
|
1587 |
* @arg @ref LL_USART_WAKEUP_ON_RXNE
|
|
1588 |
* @retval None
|
|
1589 |
*/
|
|
1590 |
__STATIC_INLINE void LL_USART_SetWKUPType(USART_TypeDef *USARTx, uint32_t Type)
|
|
1591 |
{
|
|
1592 |
MODIFY_REG(USARTx->CR3, USART_CR3_WUS, Type);
|
|
1593 |
}
|
|
1594 |
|
|
1595 |
/**
|
|
1596 |
* @brief Return event type for Wake UP Interrupt Flag (WUS[1:0] bits)
|
|
1597 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
1598 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
1599 |
* @rmtoll CR3 WUS LL_USART_GetWKUPType
|
|
1600 |
* @param USARTx USART Instance
|
|
1601 |
* @retval Returned value can be one of the following values:
|
|
1602 |
* @arg @ref LL_USART_WAKEUP_ON_ADDRESS
|
|
1603 |
* @arg @ref LL_USART_WAKEUP_ON_STARTBIT
|
|
1604 |
* @arg @ref LL_USART_WAKEUP_ON_RXNE
|
|
1605 |
*/
|
|
1606 |
__STATIC_INLINE uint32_t LL_USART_GetWKUPType(USART_TypeDef *USARTx)
|
|
1607 |
{
|
|
1608 |
return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_WUS));
|
|
1609 |
}
|
|
1610 |
#endif
|
|
1611 |
|
|
1612 |
/**
|
|
1613 |
* @brief Configure USART BRR register for achieving expected Baud Rate value.
|
|
1614 |
* @note Compute and set USARTDIV value in BRR Register (full BRR content)
|
|
1615 |
* according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values
|
|
1616 |
* @note Peripheral clock and Baud rate values provided as function parameters should be valid
|
|
1617 |
* (Baud rate value != 0)
|
|
1618 |
* @note In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d.
|
|
1619 |
* @rmtoll BRR BRR LL_USART_SetBaudRate
|
|
1620 |
* @param USARTx USART Instance
|
|
1621 |
* @param PeriphClk Peripheral Clock
|
|
1622 |
* @param OverSampling This parameter can be one of the following values:
|
|
1623 |
* @arg @ref LL_USART_OVERSAMPLING_16
|
|
1624 |
* @arg @ref LL_USART_OVERSAMPLING_8
|
|
1625 |
* @param BaudRate Baud Rate
|
|
1626 |
* @retval None
|
|
1627 |
*/
|
|
1628 |
__STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling,
|
|
1629 |
uint32_t BaudRate)
|
|
1630 |
{
|
|
1631 |
register uint32_t usartdiv = 0x0U;
|
|
1632 |
register uint32_t brrtemp = 0x0U;
|
|
1633 |
|
|
1634 |
if (OverSampling == LL_USART_OVERSAMPLING_8)
|
|
1635 |
{
|
|
1636 |
usartdiv = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate));
|
|
1637 |
brrtemp = usartdiv & 0xFFF0U;
|
|
1638 |
brrtemp |= (uint16_t)((usartdiv & (uint16_t)0x000FU) >> 1U);
|
|
1639 |
USARTx->BRR = brrtemp;
|
|
1640 |
}
|
|
1641 |
else
|
|
1642 |
{
|
|
1643 |
USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate));
|
|
1644 |
}
|
|
1645 |
}
|
|
1646 |
|
|
1647 |
/**
|
|
1648 |
* @brief Return current Baud Rate value, according to USARTDIV present in BRR register
|
|
1649 |
* (full BRR content), and to used Peripheral Clock and Oversampling mode values
|
|
1650 |
* @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned.
|
|
1651 |
* @note In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d.
|
|
1652 |
* @rmtoll BRR BRR LL_USART_GetBaudRate
|
|
1653 |
* @param USARTx USART Instance
|
|
1654 |
* @param PeriphClk Peripheral Clock
|
|
1655 |
* @param OverSampling This parameter can be one of the following values:
|
|
1656 |
* @arg @ref LL_USART_OVERSAMPLING_16
|
|
1657 |
* @arg @ref LL_USART_OVERSAMPLING_8
|
|
1658 |
* @retval Baud Rate
|
|
1659 |
*/
|
|
1660 |
__STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling)
|
|
1661 |
{
|
|
1662 |
register uint32_t usartdiv = 0x0U;
|
|
1663 |
register uint32_t brrresult = 0x0U;
|
|
1664 |
|
|
1665 |
usartdiv = USARTx->BRR;
|
|
1666 |
|
|
1667 |
if (OverSampling == LL_USART_OVERSAMPLING_8)
|
|
1668 |
{
|
|
1669 |
if ((usartdiv & 0xFFF7U) != 0U)
|
|
1670 |
{
|
|
1671 |
usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ;
|
|
1672 |
brrresult = (PeriphClk * 2U) / usartdiv;
|
|
1673 |
}
|
|
1674 |
}
|
|
1675 |
else
|
|
1676 |
{
|
|
1677 |
if ((usartdiv & 0xFFFFU) != 0U)
|
|
1678 |
{
|
|
1679 |
brrresult = PeriphClk / usartdiv;
|
|
1680 |
}
|
|
1681 |
}
|
|
1682 |
return (brrresult);
|
|
1683 |
}
|
|
1684 |
|
|
1685 |
/**
|
|
1686 |
* @brief Set Receiver Time Out Value (expressed in nb of bits duration)
|
|
1687 |
* @rmtoll RTOR RTO LL_USART_SetRxTimeout
|
|
1688 |
* @param USARTx USART Instance
|
|
1689 |
* @param Timeout Value between Min_Data=0x00 and Max_Data=0x00FFFFFF
|
|
1690 |
* @retval None
|
|
1691 |
*/
|
|
1692 |
__STATIC_INLINE void LL_USART_SetRxTimeout(USART_TypeDef *USARTx, uint32_t Timeout)
|
|
1693 |
{
|
|
1694 |
MODIFY_REG(USARTx->RTOR, USART_RTOR_RTO, Timeout);
|
|
1695 |
}
|
|
1696 |
|
|
1697 |
/**
|
|
1698 |
* @brief Get Receiver Time Out Value (expressed in nb of bits duration)
|
|
1699 |
* @rmtoll RTOR RTO LL_USART_GetRxTimeout
|
|
1700 |
* @param USARTx USART Instance
|
|
1701 |
* @retval Value between Min_Data=0x00 and Max_Data=0x00FFFFFF
|
|
1702 |
*/
|
|
1703 |
__STATIC_INLINE uint32_t LL_USART_GetRxTimeout(USART_TypeDef *USARTx)
|
|
1704 |
{
|
|
1705 |
return (uint32_t)(READ_BIT(USARTx->RTOR, USART_RTOR_RTO));
|
|
1706 |
}
|
|
1707 |
|
|
1708 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
1709 |
/**
|
|
1710 |
* @brief Set Block Length value in reception
|
|
1711 |
* @rmtoll RTOR BLEN LL_USART_SetBlockLength
|
|
1712 |
* @param USARTx USART Instance
|
|
1713 |
* @param BlockLength Value between Min_Data=0x00 and Max_Data=0xFF
|
|
1714 |
* @retval None
|
|
1715 |
*/
|
|
1716 |
__STATIC_INLINE void LL_USART_SetBlockLength(USART_TypeDef *USARTx, uint32_t BlockLength)
|
|
1717 |
{
|
|
1718 |
MODIFY_REG(USARTx->RTOR, USART_RTOR_BLEN, BlockLength << USART_RTOR_BLEN_Pos);
|
|
1719 |
}
|
|
1720 |
|
|
1721 |
/**
|
|
1722 |
* @brief Get Block Length value in reception
|
|
1723 |
* @rmtoll RTOR BLEN LL_USART_GetBlockLength
|
|
1724 |
* @param USARTx USART Instance
|
|
1725 |
* @retval Value between Min_Data=0x00 and Max_Data=0xFF
|
|
1726 |
*/
|
|
1727 |
__STATIC_INLINE uint32_t LL_USART_GetBlockLength(USART_TypeDef *USARTx)
|
|
1728 |
{
|
|
1729 |
return (uint32_t)(READ_BIT(USARTx->RTOR, USART_RTOR_BLEN) >> USART_RTOR_BLEN_Pos);
|
|
1730 |
}
|
|
1731 |
#endif
|
|
1732 |
|
|
1733 |
/**
|
|
1734 |
* @}
|
|
1735 |
*/
|
|
1736 |
|
|
1737 |
#if defined(USART_IRDA_SUPPORT)
|
|
1738 |
/** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature
|
|
1739 |
* @{
|
|
1740 |
*/
|
|
1741 |
|
|
1742 |
/**
|
|
1743 |
* @brief Enable IrDA mode
|
|
1744 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1745 |
* IrDA feature is supported by the USARTx instance.
|
|
1746 |
* @rmtoll CR3 IREN LL_USART_EnableIrda
|
|
1747 |
* @param USARTx USART Instance
|
|
1748 |
* @retval None
|
|
1749 |
*/
|
|
1750 |
__STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx)
|
|
1751 |
{
|
|
1752 |
SET_BIT(USARTx->CR3, USART_CR3_IREN);
|
|
1753 |
}
|
|
1754 |
|
|
1755 |
/**
|
|
1756 |
* @brief Disable IrDA mode
|
|
1757 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1758 |
* IrDA feature is supported by the USARTx instance.
|
|
1759 |
* @rmtoll CR3 IREN LL_USART_DisableIrda
|
|
1760 |
* @param USARTx USART Instance
|
|
1761 |
* @retval None
|
|
1762 |
*/
|
|
1763 |
__STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx)
|
|
1764 |
{
|
|
1765 |
CLEAR_BIT(USARTx->CR3, USART_CR3_IREN);
|
|
1766 |
}
|
|
1767 |
|
|
1768 |
/**
|
|
1769 |
* @brief Indicate if IrDA mode is enabled
|
|
1770 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1771 |
* IrDA feature is supported by the USARTx instance.
|
|
1772 |
* @rmtoll CR3 IREN LL_USART_IsEnabledIrda
|
|
1773 |
* @param USARTx USART Instance
|
|
1774 |
* @retval State of bit (1 or 0).
|
|
1775 |
*/
|
|
1776 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx)
|
|
1777 |
{
|
|
1778 |
return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN));
|
|
1779 |
}
|
|
1780 |
|
|
1781 |
/**
|
|
1782 |
* @brief Configure IrDA Power Mode (Normal or Low Power)
|
|
1783 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1784 |
* IrDA feature is supported by the USARTx instance.
|
|
1785 |
* @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode
|
|
1786 |
* @param USARTx USART Instance
|
|
1787 |
* @param PowerMode This parameter can be one of the following values:
|
|
1788 |
* @arg @ref LL_USART_IRDA_POWER_NORMAL
|
|
1789 |
* @arg @ref LL_USART_IRDA_POWER_LOW
|
|
1790 |
* @retval None
|
|
1791 |
*/
|
|
1792 |
__STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode)
|
|
1793 |
{
|
|
1794 |
MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode);
|
|
1795 |
}
|
|
1796 |
|
|
1797 |
/**
|
|
1798 |
* @brief Retrieve IrDA Power Mode configuration (Normal or Low Power)
|
|
1799 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1800 |
* IrDA feature is supported by the USARTx instance.
|
|
1801 |
* @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode
|
|
1802 |
* @param USARTx USART Instance
|
|
1803 |
* @retval Returned value can be one of the following values:
|
|
1804 |
* @arg @ref LL_USART_IRDA_POWER_NORMAL
|
|
1805 |
* @arg @ref LL_USART_PHASE_2EDGE
|
|
1806 |
*/
|
|
1807 |
__STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx)
|
|
1808 |
{
|
|
1809 |
return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP));
|
|
1810 |
}
|
|
1811 |
|
|
1812 |
/**
|
|
1813 |
* @brief Set Irda prescaler value, used for dividing the USART clock source
|
|
1814 |
* to achieve the Irda Low Power frequency (8 bits value)
|
|
1815 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1816 |
* IrDA feature is supported by the USARTx instance.
|
|
1817 |
* @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler
|
|
1818 |
* @param USARTx USART Instance
|
|
1819 |
* @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF
|
|
1820 |
* @retval None
|
|
1821 |
*/
|
|
1822 |
__STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
|
|
1823 |
{
|
|
1824 |
MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue);
|
|
1825 |
}
|
|
1826 |
|
|
1827 |
/**
|
|
1828 |
* @brief Return Irda prescaler value, used for dividing the USART clock source
|
|
1829 |
* to achieve the Irda Low Power frequency (8 bits value)
|
|
1830 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
1831 |
* IrDA feature is supported by the USARTx instance.
|
|
1832 |
* @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler
|
|
1833 |
* @param USARTx USART Instance
|
|
1834 |
* @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF)
|
|
1835 |
*/
|
|
1836 |
__STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx)
|
|
1837 |
{
|
|
1838 |
return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
|
|
1839 |
}
|
|
1840 |
|
|
1841 |
/**
|
|
1842 |
* @}
|
|
1843 |
*/
|
|
1844 |
#endif
|
|
1845 |
|
|
1846 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
1847 |
/** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature
|
|
1848 |
* @{
|
|
1849 |
*/
|
|
1850 |
|
|
1851 |
/**
|
|
1852 |
* @brief Enable Smartcard NACK transmission
|
|
1853 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1854 |
* Smartcard feature is supported by the USARTx instance.
|
|
1855 |
* @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK
|
|
1856 |
* @param USARTx USART Instance
|
|
1857 |
* @retval None
|
|
1858 |
*/
|
|
1859 |
__STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx)
|
|
1860 |
{
|
|
1861 |
SET_BIT(USARTx->CR3, USART_CR3_NACK);
|
|
1862 |
}
|
|
1863 |
|
|
1864 |
/**
|
|
1865 |
* @brief Disable Smartcard NACK transmission
|
|
1866 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1867 |
* Smartcard feature is supported by the USARTx instance.
|
|
1868 |
* @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK
|
|
1869 |
* @param USARTx USART Instance
|
|
1870 |
* @retval None
|
|
1871 |
*/
|
|
1872 |
__STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx)
|
|
1873 |
{
|
|
1874 |
CLEAR_BIT(USARTx->CR3, USART_CR3_NACK);
|
|
1875 |
}
|
|
1876 |
|
|
1877 |
/**
|
|
1878 |
* @brief Indicate if Smartcard NACK transmission is enabled
|
|
1879 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1880 |
* Smartcard feature is supported by the USARTx instance.
|
|
1881 |
* @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK
|
|
1882 |
* @param USARTx USART Instance
|
|
1883 |
* @retval State of bit (1 or 0).
|
|
1884 |
*/
|
|
1885 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx)
|
|
1886 |
{
|
|
1887 |
return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK));
|
|
1888 |
}
|
|
1889 |
|
|
1890 |
/**
|
|
1891 |
* @brief Enable Smartcard mode
|
|
1892 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1893 |
* Smartcard feature is supported by the USARTx instance.
|
|
1894 |
* @rmtoll CR3 SCEN LL_USART_EnableSmartcard
|
|
1895 |
* @param USARTx USART Instance
|
|
1896 |
* @retval None
|
|
1897 |
*/
|
|
1898 |
__STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx)
|
|
1899 |
{
|
|
1900 |
SET_BIT(USARTx->CR3, USART_CR3_SCEN);
|
|
1901 |
}
|
|
1902 |
|
|
1903 |
/**
|
|
1904 |
* @brief Disable Smartcard mode
|
|
1905 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1906 |
* Smartcard feature is supported by the USARTx instance.
|
|
1907 |
* @rmtoll CR3 SCEN LL_USART_DisableSmartcard
|
|
1908 |
* @param USARTx USART Instance
|
|
1909 |
* @retval None
|
|
1910 |
*/
|
|
1911 |
__STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx)
|
|
1912 |
{
|
|
1913 |
CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN);
|
|
1914 |
}
|
|
1915 |
|
|
1916 |
/**
|
|
1917 |
* @brief Indicate if Smartcard mode is enabled
|
|
1918 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1919 |
* Smartcard feature is supported by the USARTx instance.
|
|
1920 |
* @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard
|
|
1921 |
* @param USARTx USART Instance
|
|
1922 |
* @retval State of bit (1 or 0).
|
|
1923 |
*/
|
|
1924 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx)
|
|
1925 |
{
|
|
1926 |
return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN));
|
|
1927 |
}
|
|
1928 |
|
|
1929 |
/**
|
|
1930 |
* @brief Set Smartcard Auto-Retry Count value (SCARCNT[2:0] bits)
|
|
1931 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1932 |
* Smartcard feature is supported by the USARTx instance.
|
|
1933 |
* @note This bit-field specifies the number of retries in transmit and receive, in Smartcard mode.
|
|
1934 |
* In transmission mode, it specifies the number of automatic retransmission retries, before
|
|
1935 |
* generating a transmission error (FE bit set).
|
|
1936 |
* In reception mode, it specifies the number or erroneous reception trials, before generating a
|
|
1937 |
* reception error (RXNE and PE bits set)
|
|
1938 |
* @rmtoll CR3 SCARCNT LL_USART_SetSmartcardAutoRetryCount
|
|
1939 |
* @param USARTx USART Instance
|
|
1940 |
* @param AutoRetryCount Value between Min_Data=0 and Max_Data=7
|
|
1941 |
* @retval None
|
|
1942 |
*/
|
|
1943 |
__STATIC_INLINE void LL_USART_SetSmartcardAutoRetryCount(USART_TypeDef *USARTx, uint32_t AutoRetryCount)
|
|
1944 |
{
|
|
1945 |
MODIFY_REG(USARTx->CR3, USART_CR3_SCARCNT, AutoRetryCount << USART_CR3_SCARCNT_Pos);
|
|
1946 |
}
|
|
1947 |
|
|
1948 |
/**
|
|
1949 |
* @brief Return Smartcard Auto-Retry Count value (SCARCNT[2:0] bits)
|
|
1950 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1951 |
* Smartcard feature is supported by the USARTx instance.
|
|
1952 |
* @rmtoll CR3 SCARCNT LL_USART_GetSmartcardAutoRetryCount
|
|
1953 |
* @param USARTx USART Instance
|
|
1954 |
* @retval Smartcard Auto-Retry Count value (Value between Min_Data=0 and Max_Data=7)
|
|
1955 |
*/
|
|
1956 |
__STATIC_INLINE uint32_t LL_USART_GetSmartcardAutoRetryCount(USART_TypeDef *USARTx)
|
|
1957 |
{
|
|
1958 |
return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_SCARCNT) >> USART_CR3_SCARCNT_Pos);
|
|
1959 |
}
|
|
1960 |
|
|
1961 |
/**
|
|
1962 |
* @brief Set Smartcard prescaler value, used for dividing the USART clock
|
|
1963 |
* source to provide the SMARTCARD Clock (5 bits value)
|
|
1964 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1965 |
* Smartcard feature is supported by the USARTx instance.
|
|
1966 |
* @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler
|
|
1967 |
* @param USARTx USART Instance
|
|
1968 |
* @param PrescalerValue Value between Min_Data=0 and Max_Data=31
|
|
1969 |
* @retval None
|
|
1970 |
*/
|
|
1971 |
__STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
|
|
1972 |
{
|
|
1973 |
MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue);
|
|
1974 |
}
|
|
1975 |
|
|
1976 |
/**
|
|
1977 |
* @brief Return Smartcard prescaler value, used for dividing the USART clock
|
|
1978 |
* source to provide the SMARTCARD Clock (5 bits value)
|
|
1979 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1980 |
* Smartcard feature is supported by the USARTx instance.
|
|
1981 |
* @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler
|
|
1982 |
* @param USARTx USART Instance
|
|
1983 |
* @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31)
|
|
1984 |
*/
|
|
1985 |
__STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx)
|
|
1986 |
{
|
|
1987 |
return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
|
|
1988 |
}
|
|
1989 |
|
|
1990 |
/**
|
|
1991 |
* @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods
|
|
1992 |
* (GT[7:0] bits : Guard time value)
|
|
1993 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
1994 |
* Smartcard feature is supported by the USARTx instance.
|
|
1995 |
* @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime
|
|
1996 |
* @param USARTx USART Instance
|
|
1997 |
* @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF
|
|
1998 |
* @retval None
|
|
1999 |
*/
|
|
2000 |
__STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime)
|
|
2001 |
{
|
|
2002 |
MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_GTPR_GT_Pos);
|
|
2003 |
}
|
|
2004 |
|
|
2005 |
/**
|
|
2006 |
* @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods
|
|
2007 |
* (GT[7:0] bits : Guard time value)
|
|
2008 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
2009 |
* Smartcard feature is supported by the USARTx instance.
|
|
2010 |
* @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime
|
|
2011 |
* @param USARTx USART Instance
|
|
2012 |
* @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF)
|
|
2013 |
*/
|
|
2014 |
__STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx)
|
|
2015 |
{
|
|
2016 |
return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_GTPR_GT_Pos);
|
|
2017 |
}
|
|
2018 |
|
|
2019 |
/**
|
|
2020 |
* @}
|
|
2021 |
*/
|
|
2022 |
#endif
|
|
2023 |
|
|
2024 |
/** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature
|
|
2025 |
* @{
|
|
2026 |
*/
|
|
2027 |
|
|
2028 |
/**
|
|
2029 |
* @brief Enable Single Wire Half-Duplex mode
|
|
2030 |
* @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
|
|
2031 |
* Half-Duplex mode is supported by the USARTx instance.
|
|
2032 |
* @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex
|
|
2033 |
* @param USARTx USART Instance
|
|
2034 |
* @retval None
|
|
2035 |
*/
|
|
2036 |
__STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx)
|
|
2037 |
{
|
|
2038 |
SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
|
|
2039 |
}
|
|
2040 |
|
|
2041 |
/**
|
|
2042 |
* @brief Disable Single Wire Half-Duplex mode
|
|
2043 |
* @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
|
|
2044 |
* Half-Duplex mode is supported by the USARTx instance.
|
|
2045 |
* @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex
|
|
2046 |
* @param USARTx USART Instance
|
|
2047 |
* @retval None
|
|
2048 |
*/
|
|
2049 |
__STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx)
|
|
2050 |
{
|
|
2051 |
CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
|
|
2052 |
}
|
|
2053 |
|
|
2054 |
/**
|
|
2055 |
* @brief Indicate if Single Wire Half-Duplex mode is enabled
|
|
2056 |
* @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
|
|
2057 |
* Half-Duplex mode is supported by the USARTx instance.
|
|
2058 |
* @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex
|
|
2059 |
* @param USARTx USART Instance
|
|
2060 |
* @retval State of bit (1 or 0).
|
|
2061 |
*/
|
|
2062 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx)
|
|
2063 |
{
|
|
2064 |
return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL));
|
|
2065 |
}
|
|
2066 |
|
|
2067 |
/**
|
|
2068 |
* @}
|
|
2069 |
*/
|
|
2070 |
|
|
2071 |
#if defined(USART_LIN_SUPPORT)
|
|
2072 |
/** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature
|
|
2073 |
* @{
|
|
2074 |
*/
|
|
2075 |
|
|
2076 |
/**
|
|
2077 |
* @brief Set LIN Break Detection Length
|
|
2078 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2079 |
* LIN feature is supported by the USARTx instance.
|
|
2080 |
* @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen
|
|
2081 |
* @param USARTx USART Instance
|
|
2082 |
* @param LINBDLength This parameter can be one of the following values:
|
|
2083 |
* @arg @ref LL_USART_LINBREAK_DETECT_10B
|
|
2084 |
* @arg @ref LL_USART_LINBREAK_DETECT_11B
|
|
2085 |
* @retval None
|
|
2086 |
*/
|
|
2087 |
__STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength)
|
|
2088 |
{
|
|
2089 |
MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength);
|
|
2090 |
}
|
|
2091 |
|
|
2092 |
/**
|
|
2093 |
* @brief Return LIN Break Detection Length
|
|
2094 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2095 |
* LIN feature is supported by the USARTx instance.
|
|
2096 |
* @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen
|
|
2097 |
* @param USARTx USART Instance
|
|
2098 |
* @retval Returned value can be one of the following values:
|
|
2099 |
* @arg @ref LL_USART_LINBREAK_DETECT_10B
|
|
2100 |
* @arg @ref LL_USART_LINBREAK_DETECT_11B
|
|
2101 |
*/
|
|
2102 |
__STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx)
|
|
2103 |
{
|
|
2104 |
return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL));
|
|
2105 |
}
|
|
2106 |
|
|
2107 |
/**
|
|
2108 |
* @brief Enable LIN mode
|
|
2109 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2110 |
* LIN feature is supported by the USARTx instance.
|
|
2111 |
* @rmtoll CR2 LINEN LL_USART_EnableLIN
|
|
2112 |
* @param USARTx USART Instance
|
|
2113 |
* @retval None
|
|
2114 |
*/
|
|
2115 |
__STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx)
|
|
2116 |
{
|
|
2117 |
SET_BIT(USARTx->CR2, USART_CR2_LINEN);
|
|
2118 |
}
|
|
2119 |
|
|
2120 |
/**
|
|
2121 |
* @brief Disable LIN mode
|
|
2122 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2123 |
* LIN feature is supported by the USARTx instance.
|
|
2124 |
* @rmtoll CR2 LINEN LL_USART_DisableLIN
|
|
2125 |
* @param USARTx USART Instance
|
|
2126 |
* @retval None
|
|
2127 |
*/
|
|
2128 |
__STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx)
|
|
2129 |
{
|
|
2130 |
CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN);
|
|
2131 |
}
|
|
2132 |
|
|
2133 |
/**
|
|
2134 |
* @brief Indicate if LIN mode is enabled
|
|
2135 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2136 |
* LIN feature is supported by the USARTx instance.
|
|
2137 |
* @rmtoll CR2 LINEN LL_USART_IsEnabledLIN
|
|
2138 |
* @param USARTx USART Instance
|
|
2139 |
* @retval State of bit (1 or 0).
|
|
2140 |
*/
|
|
2141 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx)
|
|
2142 |
{
|
|
2143 |
return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN));
|
|
2144 |
}
|
|
2145 |
|
|
2146 |
/**
|
|
2147 |
* @}
|
|
2148 |
*/
|
|
2149 |
#endif
|
|
2150 |
|
|
2151 |
/** @defgroup USART_LL_EF_Configuration_DE Configuration functions related to Driver Enable feature
|
|
2152 |
* @{
|
|
2153 |
*/
|
|
2154 |
|
|
2155 |
/**
|
|
2156 |
* @brief Set DEDT (Driver Enable De-Assertion Time), Time value expressed on 5 bits ([4:0] bits).
|
|
2157 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2158 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2159 |
* @rmtoll CR1 DEDT LL_USART_SetDEDeassertionTime
|
|
2160 |
* @param USARTx USART Instance
|
|
2161 |
* @param Time Value between Min_Data=0 and Max_Data=31
|
|
2162 |
* @retval None
|
|
2163 |
*/
|
|
2164 |
__STATIC_INLINE void LL_USART_SetDEDeassertionTime(USART_TypeDef *USARTx, uint32_t Time)
|
|
2165 |
{
|
|
2166 |
MODIFY_REG(USARTx->CR1, USART_CR1_DEDT, Time << USART_CR1_DEDT_Pos);
|
|
2167 |
}
|
|
2168 |
|
|
2169 |
/**
|
|
2170 |
* @brief Return DEDT (Driver Enable De-Assertion Time)
|
|
2171 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2172 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2173 |
* @rmtoll CR1 DEDT LL_USART_GetDEDeassertionTime
|
|
2174 |
* @param USARTx USART Instance
|
|
2175 |
* @retval Time value expressed on 5 bits ([4:0] bits) : Value between Min_Data=0 and Max_Data=31
|
|
2176 |
*/
|
|
2177 |
__STATIC_INLINE uint32_t LL_USART_GetDEDeassertionTime(USART_TypeDef *USARTx)
|
|
2178 |
{
|
|
2179 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_DEDT) >> USART_CR1_DEDT_Pos);
|
|
2180 |
}
|
|
2181 |
|
|
2182 |
/**
|
|
2183 |
* @brief Set DEAT (Driver Enable Assertion Time), Time value expressed on 5 bits ([4:0] bits).
|
|
2184 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2185 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2186 |
* @rmtoll CR1 DEAT LL_USART_SetDEAssertionTime
|
|
2187 |
* @param USARTx USART Instance
|
|
2188 |
* @param Time Value between Min_Data=0 and Max_Data=31
|
|
2189 |
* @retval None
|
|
2190 |
*/
|
|
2191 |
__STATIC_INLINE void LL_USART_SetDEAssertionTime(USART_TypeDef *USARTx, uint32_t Time)
|
|
2192 |
{
|
|
2193 |
MODIFY_REG(USARTx->CR1, USART_CR1_DEAT, Time << USART_CR1_DEAT_Pos);
|
|
2194 |
}
|
|
2195 |
|
|
2196 |
/**
|
|
2197 |
* @brief Return DEAT (Driver Enable Assertion Time)
|
|
2198 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2199 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2200 |
* @rmtoll CR1 DEAT LL_USART_GetDEAssertionTime
|
|
2201 |
* @param USARTx USART Instance
|
|
2202 |
* @retval Time value expressed on 5 bits ([4:0] bits) : Value between Min_Data=0 and Max_Data=31
|
|
2203 |
*/
|
|
2204 |
__STATIC_INLINE uint32_t LL_USART_GetDEAssertionTime(USART_TypeDef *USARTx)
|
|
2205 |
{
|
|
2206 |
return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_DEAT) >> USART_CR1_DEAT_Pos);
|
|
2207 |
}
|
|
2208 |
|
|
2209 |
/**
|
|
2210 |
* @brief Enable Driver Enable (DE) Mode
|
|
2211 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2212 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2213 |
* @rmtoll CR3 DEM LL_USART_EnableDEMode
|
|
2214 |
* @param USARTx USART Instance
|
|
2215 |
* @retval None
|
|
2216 |
*/
|
|
2217 |
__STATIC_INLINE void LL_USART_EnableDEMode(USART_TypeDef *USARTx)
|
|
2218 |
{
|
|
2219 |
SET_BIT(USARTx->CR3, USART_CR3_DEM);
|
|
2220 |
}
|
|
2221 |
|
|
2222 |
/**
|
|
2223 |
* @brief Disable Driver Enable (DE) Mode
|
|
2224 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2225 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2226 |
* @rmtoll CR3 DEM LL_USART_DisableDEMode
|
|
2227 |
* @param USARTx USART Instance
|
|
2228 |
* @retval None
|
|
2229 |
*/
|
|
2230 |
__STATIC_INLINE void LL_USART_DisableDEMode(USART_TypeDef *USARTx)
|
|
2231 |
{
|
|
2232 |
CLEAR_BIT(USARTx->CR3, USART_CR3_DEM);
|
|
2233 |
}
|
|
2234 |
|
|
2235 |
/**
|
|
2236 |
* @brief Indicate if Driver Enable (DE) Mode is enabled
|
|
2237 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2238 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2239 |
* @rmtoll CR3 DEM LL_USART_IsEnabledDEMode
|
|
2240 |
* @param USARTx USART Instance
|
|
2241 |
* @retval State of bit (1 or 0).
|
|
2242 |
*/
|
|
2243 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledDEMode(USART_TypeDef *USARTx)
|
|
2244 |
{
|
|
2245 |
return (READ_BIT(USARTx->CR3, USART_CR3_DEM) == (USART_CR3_DEM));
|
|
2246 |
}
|
|
2247 |
|
|
2248 |
/**
|
|
2249 |
* @brief Select Driver Enable Polarity
|
|
2250 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2251 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2252 |
* @rmtoll CR3 DEP LL_USART_SetDESignalPolarity
|
|
2253 |
* @param USARTx USART Instance
|
|
2254 |
* @param Polarity This parameter can be one of the following values:
|
|
2255 |
* @arg @ref LL_USART_DE_POLARITY_HIGH
|
|
2256 |
* @arg @ref LL_USART_DE_POLARITY_LOW
|
|
2257 |
* @retval None
|
|
2258 |
*/
|
|
2259 |
__STATIC_INLINE void LL_USART_SetDESignalPolarity(USART_TypeDef *USARTx, uint32_t Polarity)
|
|
2260 |
{
|
|
2261 |
MODIFY_REG(USARTx->CR3, USART_CR3_DEP, Polarity);
|
|
2262 |
}
|
|
2263 |
|
|
2264 |
/**
|
|
2265 |
* @brief Return Driver Enable Polarity
|
|
2266 |
* @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
|
|
2267 |
* Driver Enable feature is supported by the USARTx instance.
|
|
2268 |
* @rmtoll CR3 DEP LL_USART_GetDESignalPolarity
|
|
2269 |
* @param USARTx USART Instance
|
|
2270 |
* @retval Returned value can be one of the following values:
|
|
2271 |
* @arg @ref LL_USART_DE_POLARITY_HIGH
|
|
2272 |
* @arg @ref LL_USART_DE_POLARITY_LOW
|
|
2273 |
*/
|
|
2274 |
__STATIC_INLINE uint32_t LL_USART_GetDESignalPolarity(USART_TypeDef *USARTx)
|
|
2275 |
{
|
|
2276 |
return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_DEP));
|
|
2277 |
}
|
|
2278 |
|
|
2279 |
/**
|
|
2280 |
* @}
|
|
2281 |
*/
|
|
2282 |
|
|
2283 |
/** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services
|
|
2284 |
* @{
|
|
2285 |
*/
|
|
2286 |
|
|
2287 |
/**
|
|
2288 |
* @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART)
|
|
2289 |
* @note In UART mode, the following bits must be kept cleared:
|
|
2290 |
* - LINEN bit in the USART_CR2 register (if LIN feature is supported),
|
|
2291 |
* - CLKEN bit in the USART_CR2 register,
|
|
2292 |
* - SCEN bit in the USART_CR3 register (if Smartcard feature is supported),
|
|
2293 |
* - IREN bit in the USART_CR3 register (if Irda feature is supported),
|
|
2294 |
* - HDSEL bit in the USART_CR3 register.
|
|
2295 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2296 |
* - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function (if LIN feature is supported)
|
|
2297 |
* - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
|
|
2298 |
* - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function (if Smartcard feature is supported)
|
|
2299 |
* - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function (if Irda feature is supported)
|
|
2300 |
* - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
|
|
2301 |
* @note Other remaining configurations items related to Asynchronous Mode
|
|
2302 |
* (as Baud Rate, Word length, Parity, ...) should be set using
|
|
2303 |
* dedicated functions
|
|
2304 |
* @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n
|
|
2305 |
* CR2 CLKEN LL_USART_ConfigAsyncMode\n
|
|
2306 |
* CR3 SCEN LL_USART_ConfigAsyncMode\n
|
|
2307 |
* CR3 IREN LL_USART_ConfigAsyncMode\n
|
|
2308 |
* CR3 HDSEL LL_USART_ConfigAsyncMode
|
|
2309 |
* @param USARTx USART Instance
|
|
2310 |
* @retval None
|
|
2311 |
*/
|
|
2312 |
__STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx)
|
|
2313 |
{
|
|
2314 |
/* In Asynchronous mode, the following bits must be kept cleared:
|
|
2315 |
- LINEN (if LIN feature is supported), CLKEN bits in the USART_CR2 register,
|
|
2316 |
- SCEN (if Smartcard feature is supported), IREN (if Irda feature is supported) and HDSEL bits in the USART_CR3 register.*/
|
|
2317 |
#if defined(USART_LIN_SUPPORT)
|
|
2318 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
|
|
2319 |
#else
|
|
2320 |
CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
|
|
2321 |
#endif
|
|
2322 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2323 |
#if defined(USART_IRDA_SUPPORT)
|
|
2324 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
|
|
2325 |
#else
|
|
2326 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
|
|
2327 |
#endif
|
|
2328 |
#else
|
|
2329 |
#if defined(USART_IRDA_SUPPORT)
|
|
2330 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
|
|
2331 |
#else
|
|
2332 |
CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
|
|
2333 |
#endif
|
|
2334 |
#endif
|
|
2335 |
}
|
|
2336 |
|
|
2337 |
/**
|
|
2338 |
* @brief Perform basic configuration of USART for enabling use in Synchronous Mode
|
|
2339 |
* @note In Synchronous mode, the following bits must be kept cleared:
|
|
2340 |
* - LINEN bit in the USART_CR2 register (if LIN feature is supported),
|
|
2341 |
* - SCEN bit in the USART_CR3 register (if Smartcard feature is supported),
|
|
2342 |
* - IREN bit in the USART_CR3 register (if Irda feature is supported),
|
|
2343 |
* - HDSEL bit in the USART_CR3 register.
|
|
2344 |
* This function also sets the USART in Synchronous mode.
|
|
2345 |
* @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
|
|
2346 |
* Synchronous mode is supported by the USARTx instance.
|
|
2347 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2348 |
* - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function (if LIN feature is supported)
|
|
2349 |
* - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function (if Irda feature is supported)
|
|
2350 |
* - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function (if Smartcard feature is supported)
|
|
2351 |
* - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
|
|
2352 |
* - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
|
|
2353 |
* @note Other remaining configurations items related to Synchronous Mode
|
|
2354 |
* (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using
|
|
2355 |
* dedicated functions
|
|
2356 |
* @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n
|
|
2357 |
* CR2 CLKEN LL_USART_ConfigSyncMode\n
|
|
2358 |
* CR3 SCEN LL_USART_ConfigSyncMode\n
|
|
2359 |
* CR3 IREN LL_USART_ConfigSyncMode\n
|
|
2360 |
* CR3 HDSEL LL_USART_ConfigSyncMode
|
|
2361 |
* @param USARTx USART Instance
|
|
2362 |
* @retval None
|
|
2363 |
*/
|
|
2364 |
__STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx)
|
|
2365 |
{
|
|
2366 |
/* In Synchronous mode, the following bits must be kept cleared:
|
|
2367 |
- LINEN (if LIN feature is supported) bit in the USART_CR2 register,
|
|
2368 |
- SCEN (if Smartcard feature is supported), IREN (if Irda feature is supported) and HDSEL bits in the USART_CR3 register.*/
|
|
2369 |
#if defined(USART_LIN_SUPPORT)
|
|
2370 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
|
|
2371 |
#endif
|
|
2372 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2373 |
#if defined(USART_IRDA_SUPPORT)
|
|
2374 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
|
|
2375 |
#else
|
|
2376 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
|
|
2377 |
#endif
|
|
2378 |
#else
|
|
2379 |
#if defined(USART_IRDA_SUPPORT)
|
|
2380 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
|
|
2381 |
#else
|
|
2382 |
CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
|
|
2383 |
#endif
|
|
2384 |
#endif
|
|
2385 |
/* set the UART/USART in Synchronous mode */
|
|
2386 |
SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
|
|
2387 |
}
|
|
2388 |
|
|
2389 |
#if defined(USART_LIN_SUPPORT)
|
|
2390 |
/**
|
|
2391 |
* @brief Perform basic configuration of USART for enabling use in LIN Mode
|
|
2392 |
* @note In LIN mode, the following bits must be kept cleared:
|
|
2393 |
* - STOP and CLKEN bits in the USART_CR2 register,
|
|
2394 |
* - SCEN bit in the USART_CR3 register (if Smartcard feature is supported),
|
|
2395 |
* - IREN bit in the USART_CR3 register (if Irda feature is supported),
|
|
2396 |
* - HDSEL bit in the USART_CR3 register.
|
|
2397 |
* This function also set the UART/USART in LIN mode.
|
|
2398 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2399 |
* LIN feature is supported by the USARTx instance.
|
|
2400 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2401 |
* - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
|
|
2402 |
* - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
|
|
2403 |
* - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function (if Smartcard feature is supported)
|
|
2404 |
* - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function (if Irda feature is supported)
|
|
2405 |
* - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
|
|
2406 |
* - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function
|
|
2407 |
* @note Other remaining configurations items related to LIN Mode
|
|
2408 |
* (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using
|
|
2409 |
* dedicated functions
|
|
2410 |
* @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n
|
|
2411 |
* CR2 STOP LL_USART_ConfigLINMode\n
|
|
2412 |
* CR2 LINEN LL_USART_ConfigLINMode\n
|
|
2413 |
* CR3 IREN LL_USART_ConfigLINMode\n
|
|
2414 |
* CR3 SCEN LL_USART_ConfigLINMode\n
|
|
2415 |
* CR3 HDSEL LL_USART_ConfigLINMode
|
|
2416 |
* @param USARTx USART Instance
|
|
2417 |
* @retval None
|
|
2418 |
*/
|
|
2419 |
__STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx)
|
|
2420 |
{
|
|
2421 |
/* In LIN mode, the following bits must be kept cleared:
|
|
2422 |
- STOP and CLKEN bits in the USART_CR2 register,
|
|
2423 |
- IREN (if Irda feature is supported), SCEN (if Smartcard feature is supported) and HDSEL bits in the USART_CR3 register.*/
|
|
2424 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP));
|
|
2425 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2426 |
#if defined(USART_IRDA_SUPPORT)
|
|
2427 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL));
|
|
2428 |
#else
|
|
2429 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
|
|
2430 |
#endif
|
|
2431 |
#else
|
|
2432 |
#if defined(USART_IRDA_SUPPORT)
|
|
2433 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
|
|
2434 |
#else
|
|
2435 |
CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
|
|
2436 |
#endif
|
|
2437 |
#endif
|
|
2438 |
/* Set the UART/USART in LIN mode */
|
|
2439 |
SET_BIT(USARTx->CR2, USART_CR2_LINEN);
|
|
2440 |
}
|
|
2441 |
#endif
|
|
2442 |
|
|
2443 |
/**
|
|
2444 |
* @brief Perform basic configuration of USART for enabling use in Half Duplex Mode
|
|
2445 |
* @note In Half Duplex mode, the following bits must be kept cleared:
|
|
2446 |
* - LINEN bit in the USART_CR2 register (if LIN feature is supported),
|
|
2447 |
* - CLKEN bit in the USART_CR2 register,
|
|
2448 |
* - SCEN bit in the USART_CR3 register (if Smartcard feature is supported),
|
|
2449 |
* - IREN bit in the USART_CR3 register (if Irda feature is supported),
|
|
2450 |
* This function also sets the UART/USART in Half Duplex mode.
|
|
2451 |
* @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
|
|
2452 |
* Half-Duplex mode is supported by the USARTx instance.
|
|
2453 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2454 |
* - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function (if LIN feature is supported)
|
|
2455 |
* - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
|
|
2456 |
* - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function (if Smartcard feature is supported)
|
|
2457 |
* - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function (if Irda feature is supported)
|
|
2458 |
* - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function
|
|
2459 |
* @note Other remaining configurations items related to Half Duplex Mode
|
|
2460 |
* (as Baud Rate, Word length, Parity, ...) should be set using
|
|
2461 |
* dedicated functions
|
|
2462 |
* @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n
|
|
2463 |
* CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n
|
|
2464 |
* CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n
|
|
2465 |
* CR3 SCEN LL_USART_ConfigHalfDuplexMode\n
|
|
2466 |
* CR3 IREN LL_USART_ConfigHalfDuplexMode
|
|
2467 |
* @param USARTx USART Instance
|
|
2468 |
* @retval None
|
|
2469 |
*/
|
|
2470 |
__STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx)
|
|
2471 |
{
|
|
2472 |
/* In Half Duplex mode, the following bits must be kept cleared:
|
|
2473 |
- LINEN (if LIN feature is supported), CLKEN bits in the USART_CR2 register,
|
|
2474 |
- SCEN (if Smartcard feature is supported) and IREN (if Irda feature is supported) bits in the USART_CR3 register.*/
|
|
2475 |
#if defined(USART_LIN_SUPPORT)
|
|
2476 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
|
|
2477 |
#else
|
|
2478 |
CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
|
|
2479 |
#endif
|
|
2480 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2481 |
#if defined(USART_IRDA_SUPPORT)
|
|
2482 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN));
|
|
2483 |
#else
|
|
2484 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN));
|
|
2485 |
#endif
|
|
2486 |
#else
|
|
2487 |
#if defined(USART_IRDA_SUPPORT)
|
|
2488 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN));
|
|
2489 |
#endif
|
|
2490 |
#endif
|
|
2491 |
/* set the UART/USART in Half Duplex mode */
|
|
2492 |
SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
|
|
2493 |
}
|
|
2494 |
|
|
2495 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2496 |
/**
|
|
2497 |
* @brief Perform basic configuration of USART for enabling use in Smartcard Mode
|
|
2498 |
* @note In Smartcard mode, the following bits must be kept cleared:
|
|
2499 |
* - LINEN bit in the USART_CR2 register (if LIN feature is supported),
|
|
2500 |
* - IREN bit in the USART_CR3 register (if Irda feature is supported),
|
|
2501 |
* - HDSEL bit in the USART_CR3 register.
|
|
2502 |
* This function also configures Stop bits to 1.5 bits and
|
|
2503 |
* sets the USART in Smartcard mode (SCEN bit).
|
|
2504 |
* Clock Output is also enabled (CLKEN).
|
|
2505 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
2506 |
* Smartcard feature is supported by the USARTx instance.
|
|
2507 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2508 |
* - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function (if LIN feature is supported)
|
|
2509 |
* - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function (if Irda feature is supported)
|
|
2510 |
* - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
|
|
2511 |
* - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
|
|
2512 |
* - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
|
|
2513 |
* - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function
|
|
2514 |
* @note Other remaining configurations items related to Smartcard Mode
|
|
2515 |
* (as Baud Rate, Word length, Parity, ...) should be set using
|
|
2516 |
* dedicated functions
|
|
2517 |
* @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n
|
|
2518 |
* CR2 STOP LL_USART_ConfigSmartcardMode\n
|
|
2519 |
* CR2 CLKEN LL_USART_ConfigSmartcardMode\n
|
|
2520 |
* CR3 HDSEL LL_USART_ConfigSmartcardMode\n
|
|
2521 |
* CR3 SCEN LL_USART_ConfigSmartcardMode
|
|
2522 |
* @param USARTx USART Instance
|
|
2523 |
* @retval None
|
|
2524 |
*/
|
|
2525 |
__STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx)
|
|
2526 |
{
|
|
2527 |
/* In Smartcard mode, the following bits must be kept cleared:
|
|
2528 |
- LINEN (if LIN feature is supported) bit in the USART_CR2 register,
|
|
2529 |
- IREN (if Irda feature is supported) and HDSEL bits in the USART_CR3 register.*/
|
|
2530 |
#if defined(USART_LIN_SUPPORT)
|
|
2531 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
|
|
2532 |
#endif
|
|
2533 |
#if defined(USART_IRDA_SUPPORT)
|
|
2534 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
|
|
2535 |
#else
|
|
2536 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_HDSEL));
|
|
2537 |
#endif
|
|
2538 |
/* Configure Stop bits to 1.5 bits */
|
|
2539 |
/* Synchronous mode is activated by default */
|
|
2540 |
SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN));
|
|
2541 |
/* set the UART/USART in Smartcard mode */
|
|
2542 |
SET_BIT(USARTx->CR3, USART_CR3_SCEN);
|
|
2543 |
}
|
|
2544 |
#endif
|
|
2545 |
|
|
2546 |
#if defined(USART_IRDA_SUPPORT)
|
|
2547 |
/**
|
|
2548 |
* @brief Perform basic configuration of USART for enabling use in Irda Mode
|
|
2549 |
* @note In IRDA mode, the following bits must be kept cleared:
|
|
2550 |
* - LINEN bit in the USART_CR2 register (if LIN feature is supported),
|
|
2551 |
* - STOP and CLKEN bits in the USART_CR2 register,
|
|
2552 |
* - SCEN bit in the USART_CR3 register (if Smartcard feature is supported),
|
|
2553 |
* - HDSEL bit in the USART_CR3 register.
|
|
2554 |
* This function also sets the UART/USART in IRDA mode (IREN bit).
|
|
2555 |
* @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
|
|
2556 |
* IrDA feature is supported by the USARTx instance.
|
|
2557 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2558 |
* - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function (if LIN feature is supported)
|
|
2559 |
* - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
|
|
2560 |
* - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function (if Smartcard feature is supported)
|
|
2561 |
* - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
|
|
2562 |
* - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
|
|
2563 |
* - Set IREN in CR3 using @ref LL_USART_EnableIrda() function
|
|
2564 |
* @note Other remaining configurations items related to Irda Mode
|
|
2565 |
* (as Baud Rate, Word length, Power mode, ...) should be set using
|
|
2566 |
* dedicated functions
|
|
2567 |
* @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n
|
|
2568 |
* CR2 CLKEN LL_USART_ConfigIrdaMode\n
|
|
2569 |
* CR2 STOP LL_USART_ConfigIrdaMode\n
|
|
2570 |
* CR3 SCEN LL_USART_ConfigIrdaMode\n
|
|
2571 |
* CR3 HDSEL LL_USART_ConfigIrdaMode\n
|
|
2572 |
* CR3 IREN LL_USART_ConfigIrdaMode
|
|
2573 |
* @param USARTx USART Instance
|
|
2574 |
* @retval None
|
|
2575 |
*/
|
|
2576 |
__STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx)
|
|
2577 |
{
|
|
2578 |
/* In IRDA mode, the following bits must be kept cleared:
|
|
2579 |
- LINEN (if LIN feature is supported), STOP and CLKEN bits in the USART_CR2 register,
|
|
2580 |
- SCEN (if Smartcard feature is supported) and HDSEL bits in the USART_CR3 register.*/
|
|
2581 |
#if defined(USART_LIN_SUPPORT)
|
|
2582 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP));
|
|
2583 |
#else
|
|
2584 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP));
|
|
2585 |
#endif
|
|
2586 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2587 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
|
|
2588 |
#else
|
|
2589 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_HDSEL));
|
|
2590 |
#endif
|
|
2591 |
/* set the UART/USART in IRDA mode */
|
|
2592 |
SET_BIT(USARTx->CR3, USART_CR3_IREN);
|
|
2593 |
}
|
|
2594 |
#endif
|
|
2595 |
|
|
2596 |
/**
|
|
2597 |
* @brief Perform basic configuration of USART for enabling use in Multi processor Mode
|
|
2598 |
* (several USARTs connected in a network, one of the USARTs can be the master,
|
|
2599 |
* its TX output connected to the RX inputs of the other slaves USARTs).
|
|
2600 |
* @note In MultiProcessor mode, the following bits must be kept cleared:
|
|
2601 |
* - LINEN bit in the USART_CR2 register (if LIN feature is supported),
|
|
2602 |
* - CLKEN bit in the USART_CR2 register,
|
|
2603 |
* - SCEN bit in the USART_CR3 register (if Smartcard feature is supported),
|
|
2604 |
* - IREN bit in the USART_CR3 register (if Irda feature is supported),
|
|
2605 |
* - HDSEL bit in the USART_CR3 register.
|
|
2606 |
* @note Call of this function is equivalent to following function call sequence :
|
|
2607 |
* - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function (if LIN feature is supported)
|
|
2608 |
* - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
|
|
2609 |
* - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function (if Smartcard feature is supported)
|
|
2610 |
* - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function (if Irda feature is supported)
|
|
2611 |
* - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
|
|
2612 |
* @note Other remaining configurations items related to Multi processor Mode
|
|
2613 |
* (as Baud Rate, Wake Up Method, Node address, ...) should be set using
|
|
2614 |
* dedicated functions
|
|
2615 |
* @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n
|
|
2616 |
* CR2 CLKEN LL_USART_ConfigMultiProcessMode\n
|
|
2617 |
* CR3 SCEN LL_USART_ConfigMultiProcessMode\n
|
|
2618 |
* CR3 HDSEL LL_USART_ConfigMultiProcessMode\n
|
|
2619 |
* CR3 IREN LL_USART_ConfigMultiProcessMode
|
|
2620 |
* @param USARTx USART Instance
|
|
2621 |
* @retval None
|
|
2622 |
*/
|
|
2623 |
__STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx)
|
|
2624 |
{
|
|
2625 |
/* In Multi Processor mode, the following bits must be kept cleared:
|
|
2626 |
- LINEN (if LIN feature is supported) and CLKEN bits in the USART_CR2 register,
|
|
2627 |
- IREN (if Irda feature is supported), SCEN (if Smartcard feature is supported) and HDSEL bits in the USART_CR3 register.*/
|
|
2628 |
#if defined(USART_LIN_SUPPORT)
|
|
2629 |
CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
|
|
2630 |
#else
|
|
2631 |
CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
|
|
2632 |
#endif
|
|
2633 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2634 |
#if defined(USART_IRDA_SUPPORT)
|
|
2635 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN));
|
|
2636 |
#else
|
|
2637 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
|
|
2638 |
#endif
|
|
2639 |
#else
|
|
2640 |
#if defined(USART_IRDA_SUPPORT)
|
|
2641 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_HDSEL | USART_CR3_IREN));
|
|
2642 |
#else
|
|
2643 |
CLEAR_BIT(USARTx->CR3, (USART_CR3_HDSEL));
|
|
2644 |
#endif
|
|
2645 |
#endif
|
|
2646 |
}
|
|
2647 |
|
|
2648 |
/**
|
|
2649 |
* @}
|
|
2650 |
*/
|
|
2651 |
|
|
2652 |
/** @defgroup USART_LL_EF_FLAG_Management FLAG_Management
|
|
2653 |
* @{
|
|
2654 |
*/
|
|
2655 |
|
|
2656 |
/**
|
|
2657 |
* @brief Check if the USART Parity Error Flag is set or not
|
|
2658 |
* @rmtoll ISR PE LL_USART_IsActiveFlag_PE
|
|
2659 |
* @param USARTx USART Instance
|
|
2660 |
* @retval State of bit (1 or 0).
|
|
2661 |
*/
|
|
2662 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx)
|
|
2663 |
{
|
|
2664 |
return (READ_BIT(USARTx->ISR, USART_ISR_PE) == (USART_ISR_PE));
|
|
2665 |
}
|
|
2666 |
|
|
2667 |
/**
|
|
2668 |
* @brief Check if the USART Framing Error Flag is set or not
|
|
2669 |
* @rmtoll ISR FE LL_USART_IsActiveFlag_FE
|
|
2670 |
* @param USARTx USART Instance
|
|
2671 |
* @retval State of bit (1 or 0).
|
|
2672 |
*/
|
|
2673 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx)
|
|
2674 |
{
|
|
2675 |
return (READ_BIT(USARTx->ISR, USART_ISR_FE) == (USART_ISR_FE));
|
|
2676 |
}
|
|
2677 |
|
|
2678 |
/**
|
|
2679 |
* @brief Check if the USART Noise error detected Flag is set or not
|
|
2680 |
* @rmtoll ISR NF LL_USART_IsActiveFlag_NE
|
|
2681 |
* @param USARTx USART Instance
|
|
2682 |
* @retval State of bit (1 or 0).
|
|
2683 |
*/
|
|
2684 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx)
|
|
2685 |
{
|
|
2686 |
return (READ_BIT(USARTx->ISR, USART_ISR_NE) == (USART_ISR_NE));
|
|
2687 |
}
|
|
2688 |
|
|
2689 |
/**
|
|
2690 |
* @brief Check if the USART OverRun Error Flag is set or not
|
|
2691 |
* @rmtoll ISR ORE LL_USART_IsActiveFlag_ORE
|
|
2692 |
* @param USARTx USART Instance
|
|
2693 |
* @retval State of bit (1 or 0).
|
|
2694 |
*/
|
|
2695 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx)
|
|
2696 |
{
|
|
2697 |
return (READ_BIT(USARTx->ISR, USART_ISR_ORE) == (USART_ISR_ORE));
|
|
2698 |
}
|
|
2699 |
|
|
2700 |
/**
|
|
2701 |
* @brief Check if the USART IDLE line detected Flag is set or not
|
|
2702 |
* @rmtoll ISR IDLE LL_USART_IsActiveFlag_IDLE
|
|
2703 |
* @param USARTx USART Instance
|
|
2704 |
* @retval State of bit (1 or 0).
|
|
2705 |
*/
|
|
2706 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx)
|
|
2707 |
{
|
|
2708 |
return (READ_BIT(USARTx->ISR, USART_ISR_IDLE) == (USART_ISR_IDLE));
|
|
2709 |
}
|
|
2710 |
|
|
2711 |
/**
|
|
2712 |
* @brief Check if the USART Read Data Register Not Empty Flag is set or not
|
|
2713 |
* @rmtoll ISR RXNE LL_USART_IsActiveFlag_RXNE
|
|
2714 |
* @param USARTx USART Instance
|
|
2715 |
* @retval State of bit (1 or 0).
|
|
2716 |
*/
|
|
2717 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx)
|
|
2718 |
{
|
|
2719 |
return (READ_BIT(USARTx->ISR, USART_ISR_RXNE) == (USART_ISR_RXNE));
|
|
2720 |
}
|
|
2721 |
|
|
2722 |
/**
|
|
2723 |
* @brief Check if the USART Transmission Complete Flag is set or not
|
|
2724 |
* @rmtoll ISR TC LL_USART_IsActiveFlag_TC
|
|
2725 |
* @param USARTx USART Instance
|
|
2726 |
* @retval State of bit (1 or 0).
|
|
2727 |
*/
|
|
2728 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx)
|
|
2729 |
{
|
|
2730 |
return (READ_BIT(USARTx->ISR, USART_ISR_TC) == (USART_ISR_TC));
|
|
2731 |
}
|
|
2732 |
|
|
2733 |
/**
|
|
2734 |
* @brief Check if the USART Transmit Data Register Empty Flag is set or not
|
|
2735 |
* @rmtoll ISR TXE LL_USART_IsActiveFlag_TXE
|
|
2736 |
* @param USARTx USART Instance
|
|
2737 |
* @retval State of bit (1 or 0).
|
|
2738 |
*/
|
|
2739 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx)
|
|
2740 |
{
|
|
2741 |
return (READ_BIT(USARTx->ISR, USART_ISR_TXE) == (USART_ISR_TXE));
|
|
2742 |
}
|
|
2743 |
|
|
2744 |
#if defined(USART_LIN_SUPPORT)
|
|
2745 |
/**
|
|
2746 |
* @brief Check if the USART LIN Break Detection Flag is set or not
|
|
2747 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2748 |
* LIN feature is supported by the USARTx instance.
|
|
2749 |
* @rmtoll ISR LBDF LL_USART_IsActiveFlag_LBD
|
|
2750 |
* @param USARTx USART Instance
|
|
2751 |
* @retval State of bit (1 or 0).
|
|
2752 |
*/
|
|
2753 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx)
|
|
2754 |
{
|
|
2755 |
return (READ_BIT(USARTx->ISR, USART_ISR_LBDF) == (USART_ISR_LBDF));
|
|
2756 |
}
|
|
2757 |
#endif
|
|
2758 |
|
|
2759 |
/**
|
|
2760 |
* @brief Check if the USART CTS interrupt Flag is set or not
|
|
2761 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
2762 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
2763 |
* @rmtoll ISR CTSIF LL_USART_IsActiveFlag_nCTS
|
|
2764 |
* @param USARTx USART Instance
|
|
2765 |
* @retval State of bit (1 or 0).
|
|
2766 |
*/
|
|
2767 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx)
|
|
2768 |
{
|
|
2769 |
return (READ_BIT(USARTx->ISR, USART_ISR_CTSIF) == (USART_ISR_CTSIF));
|
|
2770 |
}
|
|
2771 |
|
|
2772 |
/**
|
|
2773 |
* @brief Check if the USART CTS Flag is set or not
|
|
2774 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
2775 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
2776 |
* @rmtoll ISR CTS LL_USART_IsActiveFlag_CTS
|
|
2777 |
* @param USARTx USART Instance
|
|
2778 |
* @retval State of bit (1 or 0).
|
|
2779 |
*/
|
|
2780 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_CTS(USART_TypeDef *USARTx)
|
|
2781 |
{
|
|
2782 |
return (READ_BIT(USARTx->ISR, USART_ISR_CTS) == (USART_ISR_CTS));
|
|
2783 |
}
|
|
2784 |
|
|
2785 |
/**
|
|
2786 |
* @brief Check if the USART Receiver Time Out Flag is set or not
|
|
2787 |
* @rmtoll ISR RTOF LL_USART_IsActiveFlag_RTO
|
|
2788 |
* @param USARTx USART Instance
|
|
2789 |
* @retval State of bit (1 or 0).
|
|
2790 |
*/
|
|
2791 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RTO(USART_TypeDef *USARTx)
|
|
2792 |
{
|
|
2793 |
return (READ_BIT(USARTx->ISR, USART_ISR_RTOF) == (USART_ISR_RTOF));
|
|
2794 |
}
|
|
2795 |
|
|
2796 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
2797 |
/**
|
|
2798 |
* @brief Check if the USART End Of Block Flag is set or not
|
|
2799 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
2800 |
* Smartcard feature is supported by the USARTx instance.
|
|
2801 |
* @rmtoll ISR EOBF LL_USART_IsActiveFlag_EOB
|
|
2802 |
* @param USARTx USART Instance
|
|
2803 |
* @retval State of bit (1 or 0).
|
|
2804 |
*/
|
|
2805 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_EOB(USART_TypeDef *USARTx)
|
|
2806 |
{
|
|
2807 |
return (READ_BIT(USARTx->ISR, USART_ISR_EOBF) == (USART_ISR_EOBF));
|
|
2808 |
}
|
|
2809 |
#endif
|
|
2810 |
|
|
2811 |
/**
|
|
2812 |
* @brief Check if the USART Auto-Baud Rate Error Flag is set or not
|
|
2813 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
2814 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
2815 |
* @rmtoll ISR ABRE LL_USART_IsActiveFlag_ABRE
|
|
2816 |
* @param USARTx USART Instance
|
|
2817 |
* @retval State of bit (1 or 0).
|
|
2818 |
*/
|
|
2819 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ABRE(USART_TypeDef *USARTx)
|
|
2820 |
{
|
|
2821 |
return (READ_BIT(USARTx->ISR, USART_ISR_ABRE) == (USART_ISR_ABRE));
|
|
2822 |
}
|
|
2823 |
|
|
2824 |
/**
|
|
2825 |
* @brief Check if the USART Auto-Baud Rate Flag is set or not
|
|
2826 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
2827 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
2828 |
* @rmtoll ISR ABRF LL_USART_IsActiveFlag_ABR
|
|
2829 |
* @param USARTx USART Instance
|
|
2830 |
* @retval State of bit (1 or 0).
|
|
2831 |
*/
|
|
2832 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ABR(USART_TypeDef *USARTx)
|
|
2833 |
{
|
|
2834 |
return (READ_BIT(USARTx->ISR, USART_ISR_ABRF) == (USART_ISR_ABRF));
|
|
2835 |
}
|
|
2836 |
|
|
2837 |
/**
|
|
2838 |
* @brief Check if the USART Busy Flag is set or not
|
|
2839 |
* @rmtoll ISR BUSY LL_USART_IsActiveFlag_BUSY
|
|
2840 |
* @param USARTx USART Instance
|
|
2841 |
* @retval State of bit (1 or 0).
|
|
2842 |
*/
|
|
2843 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_BUSY(USART_TypeDef *USARTx)
|
|
2844 |
{
|
|
2845 |
return (READ_BIT(USARTx->ISR, USART_ISR_BUSY) == (USART_ISR_BUSY));
|
|
2846 |
}
|
|
2847 |
|
|
2848 |
/**
|
|
2849 |
* @brief Check if the USART Character Match Flag is set or not
|
|
2850 |
* @rmtoll ISR CMF LL_USART_IsActiveFlag_CM
|
|
2851 |
* @param USARTx USART Instance
|
|
2852 |
* @retval State of bit (1 or 0).
|
|
2853 |
*/
|
|
2854 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_CM(USART_TypeDef *USARTx)
|
|
2855 |
{
|
|
2856 |
return (READ_BIT(USARTx->ISR, USART_ISR_CMF) == (USART_ISR_CMF));
|
|
2857 |
}
|
|
2858 |
|
|
2859 |
/**
|
|
2860 |
* @brief Check if the USART Send Break Flag is set or not
|
|
2861 |
* @rmtoll ISR SBKF LL_USART_IsActiveFlag_SBK
|
|
2862 |
* @param USARTx USART Instance
|
|
2863 |
* @retval State of bit (1 or 0).
|
|
2864 |
*/
|
|
2865 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx)
|
|
2866 |
{
|
|
2867 |
return (READ_BIT(USARTx->ISR, USART_ISR_SBKF) == (USART_ISR_SBKF));
|
|
2868 |
}
|
|
2869 |
|
|
2870 |
/**
|
|
2871 |
* @brief Check if the USART Receive Wake Up from mute mode Flag is set or not
|
|
2872 |
* @rmtoll ISR RWU LL_USART_IsActiveFlag_RWU
|
|
2873 |
* @param USARTx USART Instance
|
|
2874 |
* @retval State of bit (1 or 0).
|
|
2875 |
*/
|
|
2876 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx)
|
|
2877 |
{
|
|
2878 |
return (READ_BIT(USARTx->ISR, USART_ISR_RWU) == (USART_ISR_RWU));
|
|
2879 |
}
|
|
2880 |
|
|
2881 |
#if defined(USART_WUSM_SUPPORT)
|
|
2882 |
/**
|
|
2883 |
* @brief Check if the USART Wake Up from stop mode Flag is set or not
|
|
2884 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
2885 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
2886 |
* @rmtoll ISR WUF LL_USART_IsActiveFlag_WKUP
|
|
2887 |
* @param USARTx USART Instance
|
|
2888 |
* @retval State of bit (1 or 0).
|
|
2889 |
*/
|
|
2890 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_WKUP(USART_TypeDef *USARTx)
|
|
2891 |
{
|
|
2892 |
return (READ_BIT(USARTx->ISR, USART_ISR_WUF) == (USART_ISR_WUF));
|
|
2893 |
}
|
|
2894 |
#endif
|
|
2895 |
|
|
2896 |
/**
|
|
2897 |
* @brief Check if the USART Transmit Enable Acknowledge Flag is set or not
|
|
2898 |
* @rmtoll ISR TEACK LL_USART_IsActiveFlag_TEACK
|
|
2899 |
* @param USARTx USART Instance
|
|
2900 |
* @retval State of bit (1 or 0).
|
|
2901 |
*/
|
|
2902 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TEACK(USART_TypeDef *USARTx)
|
|
2903 |
{
|
|
2904 |
return (READ_BIT(USARTx->ISR, USART_ISR_TEACK) == (USART_ISR_TEACK));
|
|
2905 |
}
|
|
2906 |
|
|
2907 |
/**
|
|
2908 |
* @brief Check if the USART Receive Enable Acknowledge Flag is set or not
|
|
2909 |
* @rmtoll ISR REACK LL_USART_IsActiveFlag_REACK
|
|
2910 |
* @param USARTx USART Instance
|
|
2911 |
* @retval State of bit (1 or 0).
|
|
2912 |
*/
|
|
2913 |
__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_REACK(USART_TypeDef *USARTx)
|
|
2914 |
{
|
|
2915 |
return (READ_BIT(USARTx->ISR, USART_ISR_REACK) == (USART_ISR_REACK));
|
|
2916 |
}
|
|
2917 |
|
|
2918 |
|
|
2919 |
/**
|
|
2920 |
* @brief Clear Parity Error Flag
|
|
2921 |
* @rmtoll ICR PECF LL_USART_ClearFlag_PE
|
|
2922 |
* @param USARTx USART Instance
|
|
2923 |
* @retval None
|
|
2924 |
*/
|
|
2925 |
__STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx)
|
|
2926 |
{
|
|
2927 |
WRITE_REG(USARTx->ICR, USART_ICR_PECF);
|
|
2928 |
}
|
|
2929 |
|
|
2930 |
/**
|
|
2931 |
* @brief Clear Framing Error Flag
|
|
2932 |
* @rmtoll ICR FECF LL_USART_ClearFlag_FE
|
|
2933 |
* @param USARTx USART Instance
|
|
2934 |
* @retval None
|
|
2935 |
*/
|
|
2936 |
__STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx)
|
|
2937 |
{
|
|
2938 |
WRITE_REG(USARTx->ICR, USART_ICR_FECF);
|
|
2939 |
}
|
|
2940 |
|
|
2941 |
/**
|
|
2942 |
* @brief Clear Noise detected Flag
|
|
2943 |
* @rmtoll ICR NCF LL_USART_ClearFlag_NE
|
|
2944 |
* @param USARTx USART Instance
|
|
2945 |
* @retval None
|
|
2946 |
*/
|
|
2947 |
__STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx)
|
|
2948 |
{
|
|
2949 |
WRITE_REG(USARTx->ICR, USART_ICR_NCF);
|
|
2950 |
}
|
|
2951 |
|
|
2952 |
/**
|
|
2953 |
* @brief Clear OverRun Error Flag
|
|
2954 |
* @rmtoll ICR ORECF LL_USART_ClearFlag_ORE
|
|
2955 |
* @param USARTx USART Instance
|
|
2956 |
* @retval None
|
|
2957 |
*/
|
|
2958 |
__STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx)
|
|
2959 |
{
|
|
2960 |
WRITE_REG(USARTx->ICR, USART_ICR_ORECF);
|
|
2961 |
}
|
|
2962 |
|
|
2963 |
/**
|
|
2964 |
* @brief Clear IDLE line detected Flag
|
|
2965 |
* @rmtoll ICR IDLECF LL_USART_ClearFlag_IDLE
|
|
2966 |
* @param USARTx USART Instance
|
|
2967 |
* @retval None
|
|
2968 |
*/
|
|
2969 |
__STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx)
|
|
2970 |
{
|
|
2971 |
WRITE_REG(USARTx->ICR, USART_ICR_IDLECF);
|
|
2972 |
}
|
|
2973 |
|
|
2974 |
/**
|
|
2975 |
* @brief Clear Transmission Complete Flag
|
|
2976 |
* @rmtoll ICR TCCF LL_USART_ClearFlag_TC
|
|
2977 |
* @param USARTx USART Instance
|
|
2978 |
* @retval None
|
|
2979 |
*/
|
|
2980 |
__STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx)
|
|
2981 |
{
|
|
2982 |
WRITE_REG(USARTx->ICR, USART_ICR_TCCF);
|
|
2983 |
}
|
|
2984 |
|
|
2985 |
|
|
2986 |
#if defined(USART_LIN_SUPPORT)
|
|
2987 |
/**
|
|
2988 |
* @brief Clear LIN Break Detection Flag
|
|
2989 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
2990 |
* LIN feature is supported by the USARTx instance.
|
|
2991 |
* @rmtoll ICR LBDCF LL_USART_ClearFlag_LBD
|
|
2992 |
* @param USARTx USART Instance
|
|
2993 |
* @retval None
|
|
2994 |
*/
|
|
2995 |
__STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx)
|
|
2996 |
{
|
|
2997 |
WRITE_REG(USARTx->ICR, USART_ICR_LBDCF);
|
|
2998 |
}
|
|
2999 |
#endif
|
|
3000 |
|
|
3001 |
/**
|
|
3002 |
* @brief Clear CTS Interrupt Flag
|
|
3003 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
3004 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
3005 |
* @rmtoll ICR CTSCF LL_USART_ClearFlag_nCTS
|
|
3006 |
* @param USARTx USART Instance
|
|
3007 |
* @retval None
|
|
3008 |
*/
|
|
3009 |
__STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx)
|
|
3010 |
{
|
|
3011 |
WRITE_REG(USARTx->ICR, USART_ICR_CTSCF);
|
|
3012 |
}
|
|
3013 |
|
|
3014 |
/**
|
|
3015 |
* @brief Clear Receiver Time Out Flag
|
|
3016 |
* @rmtoll ICR RTOCF LL_USART_ClearFlag_RTO
|
|
3017 |
* @param USARTx USART Instance
|
|
3018 |
* @retval None
|
|
3019 |
*/
|
|
3020 |
__STATIC_INLINE void LL_USART_ClearFlag_RTO(USART_TypeDef *USARTx)
|
|
3021 |
{
|
|
3022 |
WRITE_REG(USARTx->ICR, USART_ICR_RTOCF);
|
|
3023 |
}
|
|
3024 |
|
|
3025 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
3026 |
/**
|
|
3027 |
* @brief Clear End Of Block Flag
|
|
3028 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
3029 |
* Smartcard feature is supported by the USARTx instance.
|
|
3030 |
* @rmtoll ICR EOBCF LL_USART_ClearFlag_EOB
|
|
3031 |
* @param USARTx USART Instance
|
|
3032 |
* @retval None
|
|
3033 |
*/
|
|
3034 |
__STATIC_INLINE void LL_USART_ClearFlag_EOB(USART_TypeDef *USARTx)
|
|
3035 |
{
|
|
3036 |
WRITE_REG(USARTx->ICR, USART_ICR_EOBCF);
|
|
3037 |
}
|
|
3038 |
#endif
|
|
3039 |
|
|
3040 |
/**
|
|
3041 |
* @brief Clear Character Match Flag
|
|
3042 |
* @rmtoll ICR CMCF LL_USART_ClearFlag_CM
|
|
3043 |
* @param USARTx USART Instance
|
|
3044 |
* @retval None
|
|
3045 |
*/
|
|
3046 |
__STATIC_INLINE void LL_USART_ClearFlag_CM(USART_TypeDef *USARTx)
|
|
3047 |
{
|
|
3048 |
WRITE_REG(USARTx->ICR, USART_ICR_CMCF);
|
|
3049 |
}
|
|
3050 |
|
|
3051 |
#if defined(USART_WUSM_SUPPORT)
|
|
3052 |
/**
|
|
3053 |
* @brief Clear Wake Up from stop mode Flag
|
|
3054 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
3055 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
3056 |
* @rmtoll ICR WUCF LL_USART_ClearFlag_WKUP
|
|
3057 |
* @param USARTx USART Instance
|
|
3058 |
* @retval None
|
|
3059 |
*/
|
|
3060 |
__STATIC_INLINE void LL_USART_ClearFlag_WKUP(USART_TypeDef *USARTx)
|
|
3061 |
{
|
|
3062 |
WRITE_REG(USARTx->ICR, USART_ICR_WUCF);
|
|
3063 |
}
|
|
3064 |
#endif
|
|
3065 |
|
|
3066 |
/**
|
|
3067 |
* @}
|
|
3068 |
*/
|
|
3069 |
|
|
3070 |
/** @defgroup USART_LL_EF_IT_Management IT_Management
|
|
3071 |
* @{
|
|
3072 |
*/
|
|
3073 |
|
|
3074 |
/**
|
|
3075 |
* @brief Enable IDLE Interrupt
|
|
3076 |
* @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE
|
|
3077 |
* @param USARTx USART Instance
|
|
3078 |
* @retval None
|
|
3079 |
*/
|
|
3080 |
__STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx)
|
|
3081 |
{
|
|
3082 |
SET_BIT(USARTx->CR1, USART_CR1_IDLEIE);
|
|
3083 |
}
|
|
3084 |
|
|
3085 |
/**
|
|
3086 |
* @brief Enable RX Not Empty Interrupt
|
|
3087 |
* @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE
|
|
3088 |
* @param USARTx USART Instance
|
|
3089 |
* @retval None
|
|
3090 |
*/
|
|
3091 |
__STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx)
|
|
3092 |
{
|
|
3093 |
SET_BIT(USARTx->CR1, USART_CR1_RXNEIE);
|
|
3094 |
}
|
|
3095 |
|
|
3096 |
/**
|
|
3097 |
* @brief Enable Transmission Complete Interrupt
|
|
3098 |
* @rmtoll CR1 TCIE LL_USART_EnableIT_TC
|
|
3099 |
* @param USARTx USART Instance
|
|
3100 |
* @retval None
|
|
3101 |
*/
|
|
3102 |
__STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx)
|
|
3103 |
{
|
|
3104 |
SET_BIT(USARTx->CR1, USART_CR1_TCIE);
|
|
3105 |
}
|
|
3106 |
|
|
3107 |
/**
|
|
3108 |
* @brief Enable TX Empty Interrupt
|
|
3109 |
* @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE
|
|
3110 |
* @param USARTx USART Instance
|
|
3111 |
* @retval None
|
|
3112 |
*/
|
|
3113 |
__STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx)
|
|
3114 |
{
|
|
3115 |
SET_BIT(USARTx->CR1, USART_CR1_TXEIE);
|
|
3116 |
}
|
|
3117 |
|
|
3118 |
/**
|
|
3119 |
* @brief Enable Parity Error Interrupt
|
|
3120 |
* @rmtoll CR1 PEIE LL_USART_EnableIT_PE
|
|
3121 |
* @param USARTx USART Instance
|
|
3122 |
* @retval None
|
|
3123 |
*/
|
|
3124 |
__STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx)
|
|
3125 |
{
|
|
3126 |
SET_BIT(USARTx->CR1, USART_CR1_PEIE);
|
|
3127 |
}
|
|
3128 |
|
|
3129 |
/**
|
|
3130 |
* @brief Enable Character Match Interrupt
|
|
3131 |
* @rmtoll CR1 CMIE LL_USART_EnableIT_CM
|
|
3132 |
* @param USARTx USART Instance
|
|
3133 |
* @retval None
|
|
3134 |
*/
|
|
3135 |
__STATIC_INLINE void LL_USART_EnableIT_CM(USART_TypeDef *USARTx)
|
|
3136 |
{
|
|
3137 |
SET_BIT(USARTx->CR1, USART_CR1_CMIE);
|
|
3138 |
}
|
|
3139 |
|
|
3140 |
/**
|
|
3141 |
* @brief Enable Receiver Timeout Interrupt
|
|
3142 |
* @rmtoll CR1 RTOIE LL_USART_EnableIT_RTO
|
|
3143 |
* @param USARTx USART Instance
|
|
3144 |
* @retval None
|
|
3145 |
*/
|
|
3146 |
__STATIC_INLINE void LL_USART_EnableIT_RTO(USART_TypeDef *USARTx)
|
|
3147 |
{
|
|
3148 |
SET_BIT(USARTx->CR1, USART_CR1_RTOIE);
|
|
3149 |
}
|
|
3150 |
|
|
3151 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
3152 |
/**
|
|
3153 |
* @brief Enable End Of Block Interrupt
|
|
3154 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
3155 |
* Smartcard feature is supported by the USARTx instance.
|
|
3156 |
* @rmtoll CR1 EOBIE LL_USART_EnableIT_EOB
|
|
3157 |
* @param USARTx USART Instance
|
|
3158 |
* @retval None
|
|
3159 |
*/
|
|
3160 |
__STATIC_INLINE void LL_USART_EnableIT_EOB(USART_TypeDef *USARTx)
|
|
3161 |
{
|
|
3162 |
SET_BIT(USARTx->CR1, USART_CR1_EOBIE);
|
|
3163 |
}
|
|
3164 |
#endif
|
|
3165 |
|
|
3166 |
#if defined(USART_LIN_SUPPORT)
|
|
3167 |
/**
|
|
3168 |
* @brief Enable LIN Break Detection Interrupt
|
|
3169 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
3170 |
* LIN feature is supported by the USARTx instance.
|
|
3171 |
* @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD
|
|
3172 |
* @param USARTx USART Instance
|
|
3173 |
* @retval None
|
|
3174 |
*/
|
|
3175 |
__STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx)
|
|
3176 |
{
|
|
3177 |
SET_BIT(USARTx->CR2, USART_CR2_LBDIE);
|
|
3178 |
}
|
|
3179 |
#endif
|
|
3180 |
|
|
3181 |
/**
|
|
3182 |
* @brief Enable Error Interrupt
|
|
3183 |
* @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
|
|
3184 |
* error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
|
|
3185 |
* 0: Interrupt is inhibited
|
|
3186 |
* 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.
|
|
3187 |
* @rmtoll CR3 EIE LL_USART_EnableIT_ERROR
|
|
3188 |
* @param USARTx USART Instance
|
|
3189 |
* @retval None
|
|
3190 |
*/
|
|
3191 |
__STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx)
|
|
3192 |
{
|
|
3193 |
SET_BIT(USARTx->CR3, USART_CR3_EIE);
|
|
3194 |
}
|
|
3195 |
|
|
3196 |
/**
|
|
3197 |
* @brief Enable CTS Interrupt
|
|
3198 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
3199 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
3200 |
* @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS
|
|
3201 |
* @param USARTx USART Instance
|
|
3202 |
* @retval None
|
|
3203 |
*/
|
|
3204 |
__STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx)
|
|
3205 |
{
|
|
3206 |
SET_BIT(USARTx->CR3, USART_CR3_CTSIE);
|
|
3207 |
}
|
|
3208 |
|
|
3209 |
#if defined(USART_WUSM_SUPPORT)
|
|
3210 |
/**
|
|
3211 |
* @brief Enable Wake Up from Stop Mode Interrupt
|
|
3212 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
3213 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
3214 |
* @rmtoll CR3 WUFIE LL_USART_EnableIT_WKUP
|
|
3215 |
* @param USARTx USART Instance
|
|
3216 |
* @retval None
|
|
3217 |
*/
|
|
3218 |
__STATIC_INLINE void LL_USART_EnableIT_WKUP(USART_TypeDef *USARTx)
|
|
3219 |
{
|
|
3220 |
SET_BIT(USARTx->CR3, USART_CR3_WUFIE);
|
|
3221 |
}
|
|
3222 |
#endif
|
|
3223 |
|
|
3224 |
|
|
3225 |
/**
|
|
3226 |
* @brief Disable IDLE Interrupt
|
|
3227 |
* @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE
|
|
3228 |
* @param USARTx USART Instance
|
|
3229 |
* @retval None
|
|
3230 |
*/
|
|
3231 |
__STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx)
|
|
3232 |
{
|
|
3233 |
CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE);
|
|
3234 |
}
|
|
3235 |
|
|
3236 |
/**
|
|
3237 |
* @brief Disable RX Not Empty Interrupt
|
|
3238 |
* @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE
|
|
3239 |
* @param USARTx USART Instance
|
|
3240 |
* @retval None
|
|
3241 |
*/
|
|
3242 |
__STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx)
|
|
3243 |
{
|
|
3244 |
CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE);
|
|
3245 |
}
|
|
3246 |
|
|
3247 |
/**
|
|
3248 |
* @brief Disable Transmission Complete Interrupt
|
|
3249 |
* @rmtoll CR1 TCIE LL_USART_DisableIT_TC
|
|
3250 |
* @param USARTx USART Instance
|
|
3251 |
* @retval None
|
|
3252 |
*/
|
|
3253 |
__STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx)
|
|
3254 |
{
|
|
3255 |
CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE);
|
|
3256 |
}
|
|
3257 |
|
|
3258 |
/**
|
|
3259 |
* @brief Disable TX Empty Interrupt
|
|
3260 |
* @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE
|
|
3261 |
* @param USARTx USART Instance
|
|
3262 |
* @retval None
|
|
3263 |
*/
|
|
3264 |
__STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx)
|
|
3265 |
{
|
|
3266 |
CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE);
|
|
3267 |
}
|
|
3268 |
|
|
3269 |
/**
|
|
3270 |
* @brief Disable Parity Error Interrupt
|
|
3271 |
* @rmtoll CR1 PEIE LL_USART_DisableIT_PE
|
|
3272 |
* @param USARTx USART Instance
|
|
3273 |
* @retval None
|
|
3274 |
*/
|
|
3275 |
__STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx)
|
|
3276 |
{
|
|
3277 |
CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE);
|
|
3278 |
}
|
|
3279 |
|
|
3280 |
/**
|
|
3281 |
* @brief Disable Character Match Interrupt
|
|
3282 |
* @rmtoll CR1 CMIE LL_USART_DisableIT_CM
|
|
3283 |
* @param USARTx USART Instance
|
|
3284 |
* @retval None
|
|
3285 |
*/
|
|
3286 |
__STATIC_INLINE void LL_USART_DisableIT_CM(USART_TypeDef *USARTx)
|
|
3287 |
{
|
|
3288 |
CLEAR_BIT(USARTx->CR1, USART_CR1_CMIE);
|
|
3289 |
}
|
|
3290 |
|
|
3291 |
/**
|
|
3292 |
* @brief Disable Receiver Timeout Interrupt
|
|
3293 |
* @rmtoll CR1 RTOIE LL_USART_DisableIT_RTO
|
|
3294 |
* @param USARTx USART Instance
|
|
3295 |
* @retval None
|
|
3296 |
*/
|
|
3297 |
__STATIC_INLINE void LL_USART_DisableIT_RTO(USART_TypeDef *USARTx)
|
|
3298 |
{
|
|
3299 |
CLEAR_BIT(USARTx->CR1, USART_CR1_RTOIE);
|
|
3300 |
}
|
|
3301 |
|
|
3302 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
3303 |
/**
|
|
3304 |
* @brief Disable End Of Block Interrupt
|
|
3305 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
3306 |
* Smartcard feature is supported by the USARTx instance.
|
|
3307 |
* @rmtoll CR1 EOBIE LL_USART_DisableIT_EOB
|
|
3308 |
* @param USARTx USART Instance
|
|
3309 |
* @retval None
|
|
3310 |
*/
|
|
3311 |
__STATIC_INLINE void LL_USART_DisableIT_EOB(USART_TypeDef *USARTx)
|
|
3312 |
{
|
|
3313 |
CLEAR_BIT(USARTx->CR1, USART_CR1_EOBIE);
|
|
3314 |
}
|
|
3315 |
#endif
|
|
3316 |
|
|
3317 |
#if defined(USART_LIN_SUPPORT)
|
|
3318 |
/**
|
|
3319 |
* @brief Disable LIN Break Detection Interrupt
|
|
3320 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
3321 |
* LIN feature is supported by the USARTx instance.
|
|
3322 |
* @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD
|
|
3323 |
* @param USARTx USART Instance
|
|
3324 |
* @retval None
|
|
3325 |
*/
|
|
3326 |
__STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx)
|
|
3327 |
{
|
|
3328 |
CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE);
|
|
3329 |
}
|
|
3330 |
#endif
|
|
3331 |
|
|
3332 |
/**
|
|
3333 |
* @brief Disable Error Interrupt
|
|
3334 |
* @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
|
|
3335 |
* error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
|
|
3336 |
* 0: Interrupt is inhibited
|
|
3337 |
* 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.
|
|
3338 |
* @rmtoll CR3 EIE LL_USART_DisableIT_ERROR
|
|
3339 |
* @param USARTx USART Instance
|
|
3340 |
* @retval None
|
|
3341 |
*/
|
|
3342 |
__STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx)
|
|
3343 |
{
|
|
3344 |
CLEAR_BIT(USARTx->CR3, USART_CR3_EIE);
|
|
3345 |
}
|
|
3346 |
|
|
3347 |
/**
|
|
3348 |
* @brief Disable CTS Interrupt
|
|
3349 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
3350 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
3351 |
* @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS
|
|
3352 |
* @param USARTx USART Instance
|
|
3353 |
* @retval None
|
|
3354 |
*/
|
|
3355 |
__STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx)
|
|
3356 |
{
|
|
3357 |
CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE);
|
|
3358 |
}
|
|
3359 |
|
|
3360 |
#if defined(USART_WUSM_SUPPORT)
|
|
3361 |
/**
|
|
3362 |
* @brief Disable Wake Up from Stop Mode Interrupt
|
|
3363 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
3364 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
3365 |
* @rmtoll CR3 WUFIE LL_USART_DisableIT_WKUP
|
|
3366 |
* @param USARTx USART Instance
|
|
3367 |
* @retval None
|
|
3368 |
*/
|
|
3369 |
__STATIC_INLINE void LL_USART_DisableIT_WKUP(USART_TypeDef *USARTx)
|
|
3370 |
{
|
|
3371 |
CLEAR_BIT(USARTx->CR3, USART_CR3_WUFIE);
|
|
3372 |
}
|
|
3373 |
#endif
|
|
3374 |
|
|
3375 |
|
|
3376 |
/**
|
|
3377 |
* @brief Check if the USART IDLE Interrupt source is enabled or disabled.
|
|
3378 |
* @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE
|
|
3379 |
* @param USARTx USART Instance
|
|
3380 |
* @retval State of bit (1 or 0).
|
|
3381 |
*/
|
|
3382 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx)
|
|
3383 |
{
|
|
3384 |
return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE));
|
|
3385 |
}
|
|
3386 |
|
|
3387 |
/**
|
|
3388 |
* @brief Check if the USART RX Not Empty Interrupt is enabled or disabled.
|
|
3389 |
* @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE
|
|
3390 |
* @param USARTx USART Instance
|
|
3391 |
* @retval State of bit (1 or 0).
|
|
3392 |
*/
|
|
3393 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx)
|
|
3394 |
{
|
|
3395 |
return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE));
|
|
3396 |
}
|
|
3397 |
|
|
3398 |
/**
|
|
3399 |
* @brief Check if the USART Transmission Complete Interrupt is enabled or disabled.
|
|
3400 |
* @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC
|
|
3401 |
* @param USARTx USART Instance
|
|
3402 |
* @retval State of bit (1 or 0).
|
|
3403 |
*/
|
|
3404 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx)
|
|
3405 |
{
|
|
3406 |
return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE));
|
|
3407 |
}
|
|
3408 |
|
|
3409 |
/**
|
|
3410 |
* @brief Check if the USART TX Empty Interrupt is enabled or disabled.
|
|
3411 |
* @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE
|
|
3412 |
* @param USARTx USART Instance
|
|
3413 |
* @retval State of bit (1 or 0).
|
|
3414 |
*/
|
|
3415 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx)
|
|
3416 |
{
|
|
3417 |
return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE));
|
|
3418 |
}
|
|
3419 |
|
|
3420 |
/**
|
|
3421 |
* @brief Check if the USART Parity Error Interrupt is enabled or disabled.
|
|
3422 |
* @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE
|
|
3423 |
* @param USARTx USART Instance
|
|
3424 |
* @retval State of bit (1 or 0).
|
|
3425 |
*/
|
|
3426 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx)
|
|
3427 |
{
|
|
3428 |
return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE));
|
|
3429 |
}
|
|
3430 |
|
|
3431 |
/**
|
|
3432 |
* @brief Check if the USART Character Match Interrupt is enabled or disabled.
|
|
3433 |
* @rmtoll CR1 CMIE LL_USART_IsEnabledIT_CM
|
|
3434 |
* @param USARTx USART Instance
|
|
3435 |
* @retval State of bit (1 or 0).
|
|
3436 |
*/
|
|
3437 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CM(USART_TypeDef *USARTx)
|
|
3438 |
{
|
|
3439 |
return (READ_BIT(USARTx->CR1, USART_CR1_CMIE) == (USART_CR1_CMIE));
|
|
3440 |
}
|
|
3441 |
|
|
3442 |
/**
|
|
3443 |
* @brief Check if the USART Receiver Timeout Interrupt is enabled or disabled.
|
|
3444 |
* @rmtoll CR1 RTOIE LL_USART_IsEnabledIT_RTO
|
|
3445 |
* @param USARTx USART Instance
|
|
3446 |
* @retval State of bit (1 or 0).
|
|
3447 |
*/
|
|
3448 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RTO(USART_TypeDef *USARTx)
|
|
3449 |
{
|
|
3450 |
return (READ_BIT(USARTx->CR1, USART_CR1_RTOIE) == (USART_CR1_RTOIE));
|
|
3451 |
}
|
|
3452 |
|
|
3453 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
3454 |
/**
|
|
3455 |
* @brief Check if the USART End Of Block Interrupt is enabled or disabled.
|
|
3456 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
3457 |
* Smartcard feature is supported by the USARTx instance.
|
|
3458 |
* @rmtoll CR1 EOBIE LL_USART_IsEnabledIT_EOB
|
|
3459 |
* @param USARTx USART Instance
|
|
3460 |
* @retval State of bit (1 or 0).
|
|
3461 |
*/
|
|
3462 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_EOB(USART_TypeDef *USARTx)
|
|
3463 |
{
|
|
3464 |
return (READ_BIT(USARTx->CR1, USART_CR1_EOBIE) == (USART_CR1_EOBIE));
|
|
3465 |
}
|
|
3466 |
#endif
|
|
3467 |
|
|
3468 |
#if defined(USART_LIN_SUPPORT)
|
|
3469 |
/**
|
|
3470 |
* @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled.
|
|
3471 |
* @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
|
|
3472 |
* LIN feature is supported by the USARTx instance.
|
|
3473 |
* @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD
|
|
3474 |
* @param USARTx USART Instance
|
|
3475 |
* @retval State of bit (1 or 0).
|
|
3476 |
*/
|
|
3477 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx)
|
|
3478 |
{
|
|
3479 |
return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE));
|
|
3480 |
}
|
|
3481 |
#endif
|
|
3482 |
|
|
3483 |
/**
|
|
3484 |
* @brief Check if the USART Error Interrupt is enabled or disabled.
|
|
3485 |
* @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR
|
|
3486 |
* @param USARTx USART Instance
|
|
3487 |
* @retval State of bit (1 or 0).
|
|
3488 |
*/
|
|
3489 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx)
|
|
3490 |
{
|
|
3491 |
return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE));
|
|
3492 |
}
|
|
3493 |
|
|
3494 |
/**
|
|
3495 |
* @brief Check if the USART CTS Interrupt is enabled or disabled.
|
|
3496 |
* @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
|
|
3497 |
* Hardware Flow control feature is supported by the USARTx instance.
|
|
3498 |
* @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS
|
|
3499 |
* @param USARTx USART Instance
|
|
3500 |
* @retval State of bit (1 or 0).
|
|
3501 |
*/
|
|
3502 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx)
|
|
3503 |
{
|
|
3504 |
return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE));
|
|
3505 |
}
|
|
3506 |
|
|
3507 |
#if defined(USART_WUSM_SUPPORT)
|
|
3508 |
/**
|
|
3509 |
* @brief Check if the USART Wake Up from Stop Mode Interrupt is enabled or disabled.
|
|
3510 |
* @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
|
|
3511 |
* Wake-up from Stop mode feature is supported by the USARTx instance.
|
|
3512 |
* @rmtoll CR3 WUFIE LL_USART_IsEnabledIT_WKUP
|
|
3513 |
* @param USARTx USART Instance
|
|
3514 |
* @retval State of bit (1 or 0).
|
|
3515 |
*/
|
|
3516 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_WKUP(USART_TypeDef *USARTx)
|
|
3517 |
{
|
|
3518 |
return (READ_BIT(USARTx->CR3, USART_CR3_WUFIE) == (USART_CR3_WUFIE));
|
|
3519 |
}
|
|
3520 |
#endif
|
|
3521 |
|
|
3522 |
|
|
3523 |
/**
|
|
3524 |
* @}
|
|
3525 |
*/
|
|
3526 |
|
|
3527 |
/** @defgroup USART_LL_EF_DMA_Management DMA_Management
|
|
3528 |
* @{
|
|
3529 |
*/
|
|
3530 |
|
|
3531 |
/**
|
|
3532 |
* @brief Enable DMA Mode for reception
|
|
3533 |
* @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX
|
|
3534 |
* @param USARTx USART Instance
|
|
3535 |
* @retval None
|
|
3536 |
*/
|
|
3537 |
__STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx)
|
|
3538 |
{
|
|
3539 |
SET_BIT(USARTx->CR3, USART_CR3_DMAR);
|
|
3540 |
}
|
|
3541 |
|
|
3542 |
/**
|
|
3543 |
* @brief Disable DMA Mode for reception
|
|
3544 |
* @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX
|
|
3545 |
* @param USARTx USART Instance
|
|
3546 |
* @retval None
|
|
3547 |
*/
|
|
3548 |
__STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx)
|
|
3549 |
{
|
|
3550 |
CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR);
|
|
3551 |
}
|
|
3552 |
|
|
3553 |
/**
|
|
3554 |
* @brief Check if DMA Mode is enabled for reception
|
|
3555 |
* @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX
|
|
3556 |
* @param USARTx USART Instance
|
|
3557 |
* @retval State of bit (1 or 0).
|
|
3558 |
*/
|
|
3559 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx)
|
|
3560 |
{
|
|
3561 |
return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR));
|
|
3562 |
}
|
|
3563 |
|
|
3564 |
/**
|
|
3565 |
* @brief Enable DMA Mode for transmission
|
|
3566 |
* @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX
|
|
3567 |
* @param USARTx USART Instance
|
|
3568 |
* @retval None
|
|
3569 |
*/
|
|
3570 |
__STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx)
|
|
3571 |
{
|
|
3572 |
SET_BIT(USARTx->CR3, USART_CR3_DMAT);
|
|
3573 |
}
|
|
3574 |
|
|
3575 |
/**
|
|
3576 |
* @brief Disable DMA Mode for transmission
|
|
3577 |
* @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX
|
|
3578 |
* @param USARTx USART Instance
|
|
3579 |
* @retval None
|
|
3580 |
*/
|
|
3581 |
__STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx)
|
|
3582 |
{
|
|
3583 |
CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT);
|
|
3584 |
}
|
|
3585 |
|
|
3586 |
/**
|
|
3587 |
* @brief Check if DMA Mode is enabled for transmission
|
|
3588 |
* @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX
|
|
3589 |
* @param USARTx USART Instance
|
|
3590 |
* @retval State of bit (1 or 0).
|
|
3591 |
*/
|
|
3592 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx)
|
|
3593 |
{
|
|
3594 |
return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT));
|
|
3595 |
}
|
|
3596 |
|
|
3597 |
/**
|
|
3598 |
* @brief Enable DMA Disabling on Reception Error
|
|
3599 |
* @rmtoll CR3 DDRE LL_USART_EnableDMADeactOnRxErr
|
|
3600 |
* @param USARTx USART Instance
|
|
3601 |
* @retval None
|
|
3602 |
*/
|
|
3603 |
__STATIC_INLINE void LL_USART_EnableDMADeactOnRxErr(USART_TypeDef *USARTx)
|
|
3604 |
{
|
|
3605 |
SET_BIT(USARTx->CR3, USART_CR3_DDRE);
|
|
3606 |
}
|
|
3607 |
|
|
3608 |
/**
|
|
3609 |
* @brief Disable DMA Disabling on Reception Error
|
|
3610 |
* @rmtoll CR3 DDRE LL_USART_DisableDMADeactOnRxErr
|
|
3611 |
* @param USARTx USART Instance
|
|
3612 |
* @retval None
|
|
3613 |
*/
|
|
3614 |
__STATIC_INLINE void LL_USART_DisableDMADeactOnRxErr(USART_TypeDef *USARTx)
|
|
3615 |
{
|
|
3616 |
CLEAR_BIT(USARTx->CR3, USART_CR3_DDRE);
|
|
3617 |
}
|
|
3618 |
|
|
3619 |
/**
|
|
3620 |
* @brief Indicate if DMA Disabling on Reception Error is disabled
|
|
3621 |
* @rmtoll CR3 DDRE LL_USART_IsEnabledDMADeactOnRxErr
|
|
3622 |
* @param USARTx USART Instance
|
|
3623 |
* @retval State of bit (1 or 0).
|
|
3624 |
*/
|
|
3625 |
__STATIC_INLINE uint32_t LL_USART_IsEnabledDMADeactOnRxErr(USART_TypeDef *USARTx)
|
|
3626 |
{
|
|
3627 |
return (READ_BIT(USARTx->CR3, USART_CR3_DDRE) == (USART_CR3_DDRE));
|
|
3628 |
}
|
|
3629 |
|
|
3630 |
/**
|
|
3631 |
* @brief Get the data register address used for DMA transfer
|
|
3632 |
* @rmtoll RDR RDR LL_USART_DMA_GetRegAddr\n
|
|
3633 |
* @rmtoll TDR TDR LL_USART_DMA_GetRegAddr
|
|
3634 |
* @param USARTx USART Instance
|
|
3635 |
* @param Direction This parameter can be one of the following values:
|
|
3636 |
* @arg @ref LL_USART_DMA_REG_DATA_TRANSMIT
|
|
3637 |
* @arg @ref LL_USART_DMA_REG_DATA_RECEIVE
|
|
3638 |
* @retval Address of data register
|
|
3639 |
*/
|
|
3640 |
__STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx, uint32_t Direction)
|
|
3641 |
{
|
|
3642 |
register uint32_t data_reg_addr = 0U;
|
|
3643 |
|
|
3644 |
if (Direction == LL_USART_DMA_REG_DATA_TRANSMIT)
|
|
3645 |
{
|
|
3646 |
/* return address of TDR register */
|
|
3647 |
data_reg_addr = (uint32_t) &(USARTx->TDR);
|
|
3648 |
}
|
|
3649 |
else
|
|
3650 |
{
|
|
3651 |
/* return address of RDR register */
|
|
3652 |
data_reg_addr = (uint32_t) &(USARTx->RDR);
|
|
3653 |
}
|
|
3654 |
|
|
3655 |
return data_reg_addr;
|
|
3656 |
}
|
|
3657 |
|
|
3658 |
/**
|
|
3659 |
* @}
|
|
3660 |
*/
|
|
3661 |
|
|
3662 |
/** @defgroup USART_LL_EF_Data_Management Data_Management
|
|
3663 |
* @{
|
|
3664 |
*/
|
|
3665 |
|
|
3666 |
/**
|
|
3667 |
* @brief Read Receiver Data register (Receive Data value, 8 bits)
|
|
3668 |
* @rmtoll RDR RDR LL_USART_ReceiveData8
|
|
3669 |
* @param USARTx USART Instance
|
|
3670 |
* @retval Value between Min_Data=0x00 and Max_Data=0xFF
|
|
3671 |
*/
|
|
3672 |
__STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx)
|
|
3673 |
{
|
|
3674 |
return (uint8_t)(READ_BIT(USARTx->RDR, USART_RDR_RDR));
|
|
3675 |
}
|
|
3676 |
|
|
3677 |
/**
|
|
3678 |
* @brief Read Receiver Data register (Receive Data value, 9 bits)
|
|
3679 |
* @rmtoll RDR RDR LL_USART_ReceiveData9
|
|
3680 |
* @param USARTx USART Instance
|
|
3681 |
* @retval Value between Min_Data=0x00 and Max_Data=0x1FF
|
|
3682 |
*/
|
|
3683 |
__STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx)
|
|
3684 |
{
|
|
3685 |
return (uint16_t)(READ_BIT(USARTx->RDR, USART_RDR_RDR));
|
|
3686 |
}
|
|
3687 |
|
|
3688 |
/**
|
|
3689 |
* @brief Write in Transmitter Data Register (Transmit Data value, 8 bits)
|
|
3690 |
* @rmtoll TDR TDR LL_USART_TransmitData8
|
|
3691 |
* @param USARTx USART Instance
|
|
3692 |
* @param Value between Min_Data=0x00 and Max_Data=0xFF
|
|
3693 |
* @retval None
|
|
3694 |
*/
|
|
3695 |
__STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value)
|
|
3696 |
{
|
|
3697 |
USARTx->TDR = Value;
|
|
3698 |
}
|
|
3699 |
|
|
3700 |
/**
|
|
3701 |
* @brief Write in Transmitter Data Register (Transmit Data value, 9 bits)
|
|
3702 |
* @rmtoll TDR TDR LL_USART_TransmitData9
|
|
3703 |
* @param USARTx USART Instance
|
|
3704 |
* @param Value between Min_Data=0x00 and Max_Data=0x1FF
|
|
3705 |
* @retval None
|
|
3706 |
*/
|
|
3707 |
__STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value)
|
|
3708 |
{
|
|
3709 |
USARTx->TDR = Value & 0x1FFU;
|
|
3710 |
}
|
|
3711 |
|
|
3712 |
/**
|
|
3713 |
* @}
|
|
3714 |
*/
|
|
3715 |
|
|
3716 |
/** @defgroup USART_LL_EF_Execution Execution
|
|
3717 |
* @{
|
|
3718 |
*/
|
|
3719 |
|
|
3720 |
/**
|
|
3721 |
* @brief Request an Automatic Baud Rate measurement on next received data frame
|
|
3722 |
* @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
|
|
3723 |
* Auto Baud Rate detection feature is supported by the USARTx instance.
|
|
3724 |
* @rmtoll RQR ABRRQ LL_USART_RequestAutoBaudRate
|
|
3725 |
* @param USARTx USART Instance
|
|
3726 |
* @retval None
|
|
3727 |
*/
|
|
3728 |
__STATIC_INLINE void LL_USART_RequestAutoBaudRate(USART_TypeDef *USARTx)
|
|
3729 |
{
|
|
3730 |
SET_BIT(USARTx->RQR, USART_RQR_ABRRQ);
|
|
3731 |
}
|
|
3732 |
|
|
3733 |
/**
|
|
3734 |
* @brief Request Break sending
|
|
3735 |
* @rmtoll RQR SBKRQ LL_USART_RequestBreakSending
|
|
3736 |
* @param USARTx USART Instance
|
|
3737 |
* @retval None
|
|
3738 |
*/
|
|
3739 |
__STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx)
|
|
3740 |
{
|
|
3741 |
SET_BIT(USARTx->RQR, USART_RQR_SBKRQ);
|
|
3742 |
}
|
|
3743 |
|
|
3744 |
/**
|
|
3745 |
* @brief Put USART in mute mode and set the RWU flag
|
|
3746 |
* @rmtoll RQR MMRQ LL_USART_RequestEnterMuteMode
|
|
3747 |
* @param USARTx USART Instance
|
|
3748 |
* @retval None
|
|
3749 |
*/
|
|
3750 |
__STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx)
|
|
3751 |
{
|
|
3752 |
SET_BIT(USARTx->RQR, USART_RQR_MMRQ);
|
|
3753 |
}
|
|
3754 |
|
|
3755 |
/**
|
|
3756 |
* @brief Request a Receive Data flush
|
|
3757 |
* @rmtoll RQR RXFRQ LL_USART_RequestRxDataFlush
|
|
3758 |
* @param USARTx USART Instance
|
|
3759 |
* @retval None
|
|
3760 |
*/
|
|
3761 |
__STATIC_INLINE void LL_USART_RequestRxDataFlush(USART_TypeDef *USARTx)
|
|
3762 |
{
|
|
3763 |
SET_BIT(USARTx->RQR, USART_RQR_RXFRQ);
|
|
3764 |
}
|
|
3765 |
|
|
3766 |
#if defined(USART_SMARTCARD_SUPPORT)
|
|
3767 |
/**
|
|
3768 |
* @brief Request a Transmit data flush
|
|
3769 |
* @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
|
|
3770 |
* Smartcard feature is supported by the USARTx instance.
|
|
3771 |
* @rmtoll RQR TXFRQ LL_USART_RequestTxDataFlush
|
|
3772 |
* @param USARTx USART Instance
|
|
3773 |
* @retval None
|
|
3774 |
*/
|
|
3775 |
__STATIC_INLINE void LL_USART_RequestTxDataFlush(USART_TypeDef *USARTx)
|
|
3776 |
{
|
|
3777 |
SET_BIT(USARTx->RQR, USART_RQR_TXFRQ);
|
|
3778 |
}
|
|
3779 |
#endif
|
|
3780 |
|
|
3781 |
/**
|
|
3782 |
* @}
|
|
3783 |
*/
|
|
3784 |
|
|
3785 |
#if defined(USE_FULL_LL_DRIVER)
|
|
3786 |
/** @defgroup USART_LL_EF_Init Initialization and de-initialization functions
|
|
3787 |
* @{
|
|
3788 |
*/
|
|
3789 |
ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx);
|
|
3790 |
ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct);
|
|
3791 |
void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct);
|
|
3792 |
ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
|
|
3793 |
void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
|
|
3794 |
/**
|
|
3795 |
* @}
|
|
3796 |
*/
|
|
3797 |
#endif /* USE_FULL_LL_DRIVER */
|
|
3798 |
|
|
3799 |
/**
|
|
3800 |
* @}
|
|
3801 |
*/
|
|
3802 |
|
|
3803 |
/**
|
|
3804 |
* @}
|
|
3805 |
*/
|
|
3806 |
|
|
3807 |
#endif /* USART1 || USART2|| USART3 || USART4 || USART5 || USART6 || USART7 || USART8 */
|
|
3808 |
|
|
3809 |
/**
|
|
3810 |
* @}
|
|
3811 |
*/
|
|
3812 |
|
|
3813 |
#ifdef __cplusplus
|
|
3814 |
}
|
|
3815 |
#endif
|
|
3816 |
|
|
3817 |
#endif /* __STM32F0xx_LL_USART_H */
|
|
3818 |
|
|
3819 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|