Rev 56 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 56 | Rev 77 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32l1xx_ll_usart.h |
3 | * @file stm32l1xx_ll_usart.h |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief Header file of USART LL module. |
5 | * @brief Header file of USART LL module. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
9 | * Copyright (c) 2016 STMicroelectronics. |
10 | * All rights reserved.</center></h2> |
10 | * All rights reserved. |
11 | * |
11 | * |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * This software is licensed under terms that can be found in the LICENSE file |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * in the root directory of this software component. |
14 | * License. You may obtain a copy of the License at: |
14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
15 | * opensource.org/licenses/BSD-3-Clause |
15 | * |
16 | * |
16 | ****************************************************************************** |
17 | ****************************************************************************** |
17 | */ |
18 | */ |
18 | |
19 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ |
|
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | #ifndef __STM32L1xx_LL_USART_H |
21 | #ifndef __STM32L1xx_LL_USART_H |
21 | #define __STM32L1xx_LL_USART_H |
22 | #define __STM32L1xx_LL_USART_H |
22 | |
23 | 23 | #ifdef __cplusplus |
|
24 | #ifdef __cplusplus |
24 | extern "C" { |
25 | extern "C" { |
25 | #endif |
26 | #endif |
26 | |
27 | 27 | /* Includes ------------------------------------------------------------------*/ |
|
28 | /* Includes ------------------------------------------------------------------*/ |
28 | #include "stm32l1xx.h" |
29 | #include "stm32l1xx.h" |
29 | |
30 | 30 | /** @addtogroup STM32L1xx_LL_Driver |
|
31 | /** @addtogroup STM32L1xx_LL_Driver |
31 | * @{ |
32 | * @{ |
32 | */ |
33 | */ |
33 | |
34 | 34 | #if defined (USART1) || defined (USART2) || defined (USART3) || defined (UART4) || defined (UART5) |
|
35 | #if defined (USART1) || defined (USART2) || defined (USART3) || defined (UART4) || defined (UART5) |
35 | |
36 | 36 | /** @defgroup USART_LL USART |
|
37 | /** @defgroup USART_LL USART |
37 | * @{ |
38 | * @{ |
38 | */ |
39 | */ |
39 | |
40 | 40 | /* Private types -------------------------------------------------------------*/ |
|
41 | /* Private types -------------------------------------------------------------*/ |
41 | /* Private variables ---------------------------------------------------------*/ |
42 | /* Private variables ---------------------------------------------------------*/ |
42 | |
43 | 43 | /* Private constants ---------------------------------------------------------*/ |
|
44 | /* Private constants ---------------------------------------------------------*/ |
44 | /** @defgroup USART_LL_Private_Constants USART Private Constants |
45 | /** @defgroup USART_LL_Private_Constants USART Private Constants |
45 | * @{ |
46 | * @{ |
46 | */ |
47 | */ |
47 | |
48 | 48 | /* Defines used for the bit position in the register and perform offsets*/ |
|
49 | /* Defines used for the bit position in the register and perform offsets*/ |
49 | #define USART_POSITION_GTPR_GT USART_GTPR_GT_Pos |
50 | #define USART_POSITION_GTPR_GT USART_GTPR_GT_Pos |
50 | /** |
51 | /** |
51 | * @} |
52 | * @} |
52 | */ |
53 | */ |
53 | |
54 | 54 | /* Private macros ------------------------------------------------------------*/ |
|
55 | /* Private macros ------------------------------------------------------------*/ |
55 | #if defined(USE_FULL_LL_DRIVER) |
56 | #if defined(USE_FULL_LL_DRIVER) |
56 | /** @defgroup USART_LL_Private_Macros USART Private Macros |
57 | /** @defgroup USART_LL_Private_Macros USART Private Macros |
57 | * @{ |
58 | * @{ |
58 | */ |
59 | */ |
59 | /** |
60 | /** |
60 | * @} |
61 | * @} |
61 | */ |
62 | */ |
62 | #endif /*USE_FULL_LL_DRIVER*/ |
63 | #endif /*USE_FULL_LL_DRIVER*/ |
63 | |
64 | 64 | /* Exported types ------------------------------------------------------------*/ |
|
65 | /* Exported types ------------------------------------------------------------*/ |
65 | #if defined(USE_FULL_LL_DRIVER) |
66 | #if defined(USE_FULL_LL_DRIVER) |
66 | /** @defgroup USART_LL_ES_INIT USART Exported Init structures |
67 | /** @defgroup USART_LL_ES_INIT USART Exported Init structures |
67 | * @{ |
68 | * @{ |
68 | */ |
69 | */ |
69 | |
70 | 70 | /** |
|
71 | /** |
71 | * @brief LL USART Init Structure definition |
72 | * @brief LL USART Init Structure definition |
72 | */ |
73 | */ |
73 | typedef struct |
74 | typedef struct |
74 | { |
75 | { |
75 | uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate. |
76 | uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate. |
76 | |
77 | 77 | This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/ |
|
78 | This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/ |
78 | |
79 | 79 | uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame. |
|
80 | uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame. |
80 | This parameter can be a value of @ref USART_LL_EC_DATAWIDTH. |
81 | This parameter can be a value of @ref USART_LL_EC_DATAWIDTH. |
81 | |
82 | 82 | This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/ |
|
83 | This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/ |
83 | |
84 | 84 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
|
85 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
85 | This parameter can be a value of @ref USART_LL_EC_STOPBITS. |
86 | This parameter can be a value of @ref USART_LL_EC_STOPBITS. |
86 | |
87 | 87 | This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/ |
|
88 | This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/ |
88 | |
89 | 89 | uint32_t Parity; /*!< Specifies the parity mode. |
|
90 | uint32_t Parity; /*!< Specifies the parity mode. |
90 | This parameter can be a value of @ref USART_LL_EC_PARITY. |
91 | This parameter can be a value of @ref USART_LL_EC_PARITY. |
91 | |
92 | 92 | This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/ |
|
93 | This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/ |
93 | |
94 | 94 | uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled. |
|
95 | uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled. |
95 | This parameter can be a value of @ref USART_LL_EC_DIRECTION. |
96 | This parameter can be a value of @ref USART_LL_EC_DIRECTION. |
96 | |
97 | 97 | This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/ |
|
98 | This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/ |
98 | |
99 | 99 | uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled. |
|
100 | uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled. |
100 | This parameter can be a value of @ref USART_LL_EC_HWCONTROL. |
101 | This parameter can be a value of @ref USART_LL_EC_HWCONTROL. |
101 | |
102 | 102 | This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/ |
|
103 | This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/ |
103 | |
104 | 104 | uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8. |
|
105 | uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8. |
105 | This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING. |
106 | This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING. |
106 | |
107 | 107 | This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/ |
|
108 | This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/ |
108 | |
109 | 109 | } LL_USART_InitTypeDef; |
|
110 | } LL_USART_InitTypeDef; |
110 | |
111 | 111 | /** |
|
112 | /** |
112 | * @brief LL USART Clock Init Structure definition |
113 | * @brief LL USART Clock Init Structure definition |
113 | */ |
114 | */ |
114 | typedef struct |
115 | typedef struct |
115 | { |
116 | { |
116 | uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled. |
117 | uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled. |
117 | This parameter can be a value of @ref USART_LL_EC_CLOCK. |
118 | This parameter can be a value of @ref USART_LL_EC_CLOCK. |
118 | |
119 | 119 | USART HW configuration can be modified afterwards using unitary functions |
|
120 | USART HW configuration can be modified afterwards using unitary functions |
120 | @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput(). |
121 | @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput(). |
121 | For more details, refer to description of this function. */ |
122 | For more details, refer to description of this function. */ |
122 | |
123 | 123 | uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock. |
|
124 | uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock. |
124 | This parameter can be a value of @ref USART_LL_EC_POLARITY. |
125 | This parameter can be a value of @ref USART_LL_EC_POLARITY. |
125 | |
126 | 126 | USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity(). |
|
127 | USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity(). |
127 | For more details, refer to description of this function. */ |
128 | For more details, refer to description of this function. */ |
128 | |
129 | 129 | uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made. |
|
130 | uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made. |
130 | This parameter can be a value of @ref USART_LL_EC_PHASE. |
131 | This parameter can be a value of @ref USART_LL_EC_PHASE. |
131 | |
132 | 132 | USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase(). |
|
133 | USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase(). |
133 | For more details, refer to description of this function. */ |
134 | For more details, refer to description of this function. */ |
134 | |
135 | 135 | uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
|
136 | uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
136 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
137 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
137 | This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE. |
138 | This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE. |
138 | |
139 | 139 | USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput(). |
|
140 | USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput(). |
140 | For more details, refer to description of this function. */ |
141 | For more details, refer to description of this function. */ |
141 | |
142 | 142 | } LL_USART_ClockInitTypeDef; |
|
143 | } LL_USART_ClockInitTypeDef; |
143 | |
144 | 144 | /** |
|
145 | /** |
145 | * @} |
146 | * @} |
146 | */ |
147 | */ |
147 | #endif /* USE_FULL_LL_DRIVER */ |
148 | #endif /* USE_FULL_LL_DRIVER */ |
148 | |
149 | 149 | /* Exported constants --------------------------------------------------------*/ |
|
150 | /* Exported constants --------------------------------------------------------*/ |
150 | /** @defgroup USART_LL_Exported_Constants USART Exported Constants |
151 | /** @defgroup USART_LL_Exported_Constants USART Exported Constants |
151 | * @{ |
152 | * @{ |
152 | */ |
153 | */ |
153 | |
154 | 154 | /** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines |
|
155 | /** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines |
155 | * @brief Flags defines which can be used with LL_USART_ReadReg function |
156 | * @brief Flags defines which can be used with LL_USART_ReadReg function |
156 | * @{ |
157 | * @{ |
157 | */ |
158 | */ |
158 | #define LL_USART_SR_PE USART_SR_PE /*!< Parity error flag */ |
159 | #define LL_USART_SR_PE USART_SR_PE /*!< Parity error flag */ |
159 | #define LL_USART_SR_FE USART_SR_FE /*!< Framing error flag */ |
160 | #define LL_USART_SR_FE USART_SR_FE /*!< Framing error flag */ |
160 | #define LL_USART_SR_NE USART_SR_NE /*!< Noise detected flag */ |
161 | #define LL_USART_SR_NE USART_SR_NE /*!< Noise detected flag */ |
161 | #define LL_USART_SR_ORE USART_SR_ORE /*!< Overrun error flag */ |
162 | #define LL_USART_SR_ORE USART_SR_ORE /*!< Overrun error flag */ |
162 | #define LL_USART_SR_IDLE USART_SR_IDLE /*!< Idle line detected flag */ |
163 | #define LL_USART_SR_IDLE USART_SR_IDLE /*!< Idle line detected flag */ |
163 | #define LL_USART_SR_RXNE USART_SR_RXNE /*!< Read data register not empty flag */ |
164 | #define LL_USART_SR_RXNE USART_SR_RXNE /*!< Read data register not empty flag */ |
164 | #define LL_USART_SR_TC USART_SR_TC /*!< Transmission complete flag */ |
165 | #define LL_USART_SR_TC USART_SR_TC /*!< Transmission complete flag */ |
165 | #define LL_USART_SR_TXE USART_SR_TXE /*!< Transmit data register empty flag */ |
166 | #define LL_USART_SR_TXE USART_SR_TXE /*!< Transmit data register empty flag */ |
166 | #define LL_USART_SR_LBD USART_SR_LBD /*!< LIN break detection flag */ |
167 | #define LL_USART_SR_LBD USART_SR_LBD /*!< LIN break detection flag */ |
167 | #define LL_USART_SR_CTS USART_SR_CTS /*!< CTS flag */ |
168 | #define LL_USART_SR_CTS USART_SR_CTS /*!< CTS flag */ |
168 | /** |
169 | /** |
169 | * @} |
170 | * @} |
170 | */ |
171 | */ |
171 | |
172 | 172 | /** @defgroup USART_LL_EC_IT IT Defines |
|
173 | /** @defgroup USART_LL_EC_IT IT Defines |
173 | * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions |
174 | * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions |
174 | * @{ |
175 | * @{ |
175 | */ |
176 | */ |
176 | #define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */ |
177 | #define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */ |
177 | #define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */ |
178 | #define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */ |
178 | #define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */ |
179 | #define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */ |
179 | #define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */ |
180 | #define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */ |
180 | #define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */ |
181 | #define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */ |
181 | #define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */ |
182 | #define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */ |
182 | #define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */ |
183 | #define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */ |
183 | #define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */ |
184 | #define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */ |
184 | /** |
185 | /** |
185 | * @} |
186 | * @} |
186 | */ |
187 | */ |
187 | |
188 | 188 | /** @defgroup USART_LL_EC_DIRECTION Communication Direction |
|
189 | /** @defgroup USART_LL_EC_DIRECTION Communication Direction |
189 | * @{ |
190 | * @{ |
190 | */ |
191 | */ |
191 | #define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */ |
192 | #define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */ |
192 | #define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */ |
193 | #define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */ |
193 | #define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */ |
194 | #define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */ |
194 | #define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */ |
195 | #define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */ |
195 | /** |
196 | /** |
196 | * @} |
197 | * @} |
197 | */ |
198 | */ |
198 | |
199 | 199 | /** @defgroup USART_LL_EC_PARITY Parity Control |
|
200 | /** @defgroup USART_LL_EC_PARITY Parity Control |
200 | * @{ |
201 | * @{ |
201 | */ |
202 | */ |
202 | #define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */ |
203 | #define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */ |
203 | #define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */ |
204 | #define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */ |
204 | #define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */ |
205 | #define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */ |
205 | /** |
206 | /** |
206 | * @} |
207 | * @} |
207 | */ |
208 | */ |
208 | |
209 | 209 | /** @defgroup USART_LL_EC_WAKEUP Wakeup |
|
210 | /** @defgroup USART_LL_EC_WAKEUP Wakeup |
210 | * @{ |
211 | * @{ |
211 | */ |
212 | */ |
212 | #define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */ |
213 | #define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */ |
213 | #define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */ |
214 | #define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */ |
214 | /** |
215 | /** |
215 | * @} |
216 | * @} |
216 | */ |
217 | */ |
217 | |
218 | 218 | /** @defgroup USART_LL_EC_DATAWIDTH Datawidth |
|
219 | /** @defgroup USART_LL_EC_DATAWIDTH Datawidth |
219 | * @{ |
220 | * @{ |
220 | */ |
221 | */ |
221 | #define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */ |
222 | #define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */ |
222 | #define LL_USART_DATAWIDTH_9B USART_CR1_M /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */ |
223 | #define LL_USART_DATAWIDTH_9B USART_CR1_M /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */ |
223 | /** |
224 | /** |
224 | * @} |
225 | * @} |
225 | */ |
226 | */ |
226 | |
227 | 227 | /** @defgroup USART_LL_EC_OVERSAMPLING Oversampling |
|
228 | /** @defgroup USART_LL_EC_OVERSAMPLING Oversampling |
228 | * @{ |
229 | * @{ |
229 | */ |
230 | */ |
230 | #define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */ |
231 | #define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */ |
231 | #define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */ |
232 | #define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */ |
232 | /** |
233 | /** |
233 | * @} |
234 | * @} |
234 | */ |
235 | */ |
235 | |
236 | 236 | #if defined(USE_FULL_LL_DRIVER) |
|
237 | #if defined(USE_FULL_LL_DRIVER) |
237 | /** @defgroup USART_LL_EC_CLOCK Clock Signal |
238 | /** @defgroup USART_LL_EC_CLOCK Clock Signal |
238 | * @{ |
239 | * @{ |
239 | */ |
240 | */ |
240 | |
241 | 241 | #define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */ |
|
242 | #define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */ |
242 | #define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */ |
243 | #define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */ |
243 | /** |
244 | /** |
244 | * @} |
245 | * @} |
245 | */ |
246 | */ |
246 | #endif /*USE_FULL_LL_DRIVER*/ |
247 | #endif /*USE_FULL_LL_DRIVER*/ |
247 | |
248 | 248 | /** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse |
|
249 | /** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse |
249 | * @{ |
250 | * @{ |
250 | */ |
251 | */ |
251 | #define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */ |
252 | #define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */ |
252 | #define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */ |
253 | #define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */ |
253 | /** |
254 | /** |
254 | * @} |
255 | * @} |
255 | */ |
256 | */ |
256 | |
257 | 257 | /** @defgroup USART_LL_EC_PHASE Clock Phase |
|
258 | /** @defgroup USART_LL_EC_PHASE Clock Phase |
258 | * @{ |
259 | * @{ |
259 | */ |
260 | */ |
260 | #define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */ |
261 | #define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */ |
261 | #define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */ |
262 | #define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */ |
262 | /** |
263 | /** |
263 | * @} |
264 | * @} |
264 | */ |
265 | */ |
265 | |
266 | 266 | /** @defgroup USART_LL_EC_POLARITY Clock Polarity |
|
267 | /** @defgroup USART_LL_EC_POLARITY Clock Polarity |
267 | * @{ |
268 | * @{ |
268 | */ |
269 | */ |
269 | #define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/ |
270 | #define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/ |
270 | #define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */ |
271 | #define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */ |
271 | /** |
272 | /** |
272 | * @} |
273 | * @} |
273 | */ |
274 | */ |
274 | |
275 | 275 | /** @defgroup USART_LL_EC_STOPBITS Stop Bits |
|
276 | /** @defgroup USART_LL_EC_STOPBITS Stop Bits |
276 | * @{ |
277 | * @{ |
277 | */ |
278 | */ |
278 | #define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */ |
279 | #define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */ |
279 | #define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */ |
280 | #define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */ |
280 | #define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */ |
281 | #define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */ |
281 | #define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */ |
282 | #define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */ |
282 | /** |
283 | /** |
283 | * @} |
284 | * @} |
284 | */ |
285 | */ |
285 | |
286 | 286 | /** @defgroup USART_LL_EC_HWCONTROL Hardware Control |
|
287 | /** @defgroup USART_LL_EC_HWCONTROL Hardware Control |
287 | * @{ |
288 | * @{ |
288 | */ |
289 | */ |
289 | #define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */ |
290 | #define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */ |
290 | #define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */ |
291 | #define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */ |
291 | #define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */ |
292 | #define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */ |
292 | #define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */ |
293 | #define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */ |
293 | /** |
294 | /** |
294 | * @} |
295 | * @} |
295 | */ |
296 | */ |
296 | |
297 | 297 | /** @defgroup USART_LL_EC_IRDA_POWER IrDA Power |
|
298 | /** @defgroup USART_LL_EC_IRDA_POWER IrDA Power |
298 | * @{ |
299 | * @{ |
299 | */ |
300 | */ |
300 | #define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */ |
301 | #define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */ |
301 | #define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */ |
302 | #define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */ |
302 | /** |
303 | /** |
303 | * @} |
304 | * @} |
304 | */ |
305 | */ |
305 | |
306 | 306 | /** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length |
|
307 | /** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length |
307 | * @{ |
308 | * @{ |
308 | */ |
309 | */ |
309 | #define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */ |
310 | #define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */ |
310 | #define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */ |
311 | #define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */ |
311 | /** |
312 | /** |
312 | * @} |
313 | * @} |
313 | */ |
314 | */ |
314 | |
315 | 315 | /** |
|
316 | /** |
316 | * @} |
317 | * @} |
317 | */ |
318 | */ |
318 | |
319 | 319 | /* Exported macro ------------------------------------------------------------*/ |
|
320 | /* Exported macro ------------------------------------------------------------*/ |
320 | /** @defgroup USART_LL_Exported_Macros USART Exported Macros |
321 | /** @defgroup USART_LL_Exported_Macros USART Exported Macros |
321 | * @{ |
322 | * @{ |
322 | */ |
323 | */ |
323 | |
324 | 324 | /** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros |
|
325 | /** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros |
325 | * @{ |
326 | * @{ |
326 | */ |
327 | */ |
327 | |
328 | 328 | /** |
|
329 | /** |
329 | * @brief Write a value in USART register |
330 | * @brief Write a value in USART register |
330 | * @param __INSTANCE__ USART Instance |
331 | * @param __INSTANCE__ USART Instance |
331 | * @param __REG__ Register to be written |
332 | * @param __REG__ Register to be written |
332 | * @param __VALUE__ Value to be written in the register |
333 | * @param __VALUE__ Value to be written in the register |
333 | * @retval None |
334 | * @retval None |
334 | */ |
335 | */ |
335 | #define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
336 | #define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
336 | |
337 | 337 | /** |
|
338 | /** |
338 | * @brief Read a value in USART register |
339 | * @brief Read a value in USART register |
339 | * @param __INSTANCE__ USART Instance |
340 | * @param __INSTANCE__ USART Instance |
340 | * @param __REG__ Register to be read |
341 | * @param __REG__ Register to be read |
341 | * @retval Register value |
342 | * @retval Register value |
342 | */ |
343 | */ |
343 | #define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
344 | #define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
344 | /** |
345 | /** |
345 | * @} |
346 | * @} |
346 | */ |
347 | */ |
347 | |
348 | 348 | /** @defgroup USART_LL_EM_Exported_Macros_Helper Exported Macros Helper |
|
349 | /** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper |
349 | * @{ |
350 | * @{ |
350 | */ |
351 | */ |
351 | |
352 | 352 | /** |
|
353 | /** |
353 | * @brief Compute USARTDIV value according to Peripheral Clock and |
354 | * @brief Compute USARTDIV value according to Peripheral Clock and |
354 | * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned) |
355 | * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned) |
355 | * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance |
356 | * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance |
356 | * @param __BAUDRATE__ Baud rate value to achieve |
357 | * @param __BAUDRATE__ Baud rate value to achieve |
357 | * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case |
358 | * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case |
358 | */ |
359 | */ |
359 | #define __LL_USART_DIV_SAMPLING8_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(2*(__BAUDRATE__))) |
360 | #define __LL_USART_DIV_SAMPLING8_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(2*(__BAUDRATE__))) |
360 | #define __LL_USART_DIVMANT_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__))/100) |
361 | #define __LL_USART_DIVMANT_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__))/100) |
361 | #define __LL_USART_DIVFRAQ_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 8\ |
362 | #define __LL_USART_DIVFRAQ_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 8 + 50) / 100) |
362 | + 50) / 100) |
363 | /* UART BRR = mantissa + overflow + fraction |
363 | /* UART BRR = mantissa + overflow + fraction |
364 | = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07) */ |
364 | = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07) */ |
365 | #define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ |
365 | #define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ |
366 | ((__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0xF8) << 1)) + \ |
366 | ((__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0xF8) << 1)) + \ |
367 | (__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0x07)) |
367 | (__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0x07)) |
368 | 368 | ||
369 | /** |
369 | /** |
370 | * @brief Compute USARTDIV value according to Peripheral Clock and |
370 | * @brief Compute USARTDIV value according to Peripheral Clock and |
371 | * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned) |
371 | * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned) |
372 | * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance |
372 | * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance |
373 | * @param __BAUDRATE__ Baud rate value to achieve |
373 | * @param __BAUDRATE__ Baud rate value to achieve |
374 | * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case |
374 | * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case |
375 | */ |
375 | */ |
376 | #define __LL_USART_DIV_SAMPLING16_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(4*(__BAUDRATE__))) |
376 | #define __LL_USART_DIV_SAMPLING16_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(4*(__BAUDRATE__))) |
377 | #define __LL_USART_DIVMANT_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__))/100) |
377 | #define __LL_USART_DIVMANT_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__))/100) |
378 | #define __LL_USART_DIVFRAQ_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) ((((__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 16) + 50) / 100) |
378 | #define __LL_USART_DIVFRAQ_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) ((((__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 16)\ |
379 | /* USART BRR = mantissa + overflow + fraction |
379 | + 50) / 100) |
380 | = (USART DIVMANT << 4) + (USART DIVFRAQ & 0xF0) + (USART DIVFRAQ & 0x0F) */ |
380 | /* USART BRR = mantissa + overflow + fraction |
381 | #define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ |
381 | = (USART DIVMANT << 4) + (USART DIVFRAQ & 0xF0) + (USART DIVFRAQ & 0x0F) */ |
382 | (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0xF0)) + \ |
382 | #define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ |
383 | (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0x0F)) |
383 | (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0xF0)) + \ |
384 | 384 | (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0x0F)) |
|
385 | /** |
385 | |
386 | * @} |
386 | /** |
387 | */ |
387 | * @} |
388 | 388 | */ |
|
389 | /** |
389 | |
390 | * @} |
390 | /** |
391 | */ |
391 | * @} |
392 | 392 | */ |
|
393 | /* Exported functions --------------------------------------------------------*/ |
393 | |
394 | 394 | /* Exported functions --------------------------------------------------------*/ |
|
395 | /** @defgroup USART_LL_Exported_Functions USART Exported Functions |
395 | |
396 | * @{ |
396 | /** @defgroup USART_LL_Exported_Functions USART Exported Functions |
397 | */ |
397 | * @{ |
398 | 398 | */ |
|
399 | /** @defgroup USART_LL_EF_Configuration Configuration functions |
399 | |
400 | * @{ |
400 | /** @defgroup USART_LL_EF_Configuration Configuration functions |
401 | */ |
401 | * @{ |
402 | 402 | */ |
|
403 | /** |
403 | |
404 | * @brief USART Enable |
404 | /** |
405 | * @rmtoll CR1 UE LL_USART_Enable |
405 | * @brief USART Enable |
406 | * @param USARTx USART Instance |
406 | * @rmtoll CR1 UE LL_USART_Enable |
407 | * @retval None |
407 | * @param USARTx USART Instance |
408 | */ |
408 | * @retval None |
409 | __STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx) |
409 | */ |
410 | { |
410 | __STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx) |
411 | SET_BIT(USARTx->CR1, USART_CR1_UE); |
411 | { |
412 | } |
412 | SET_BIT(USARTx->CR1, USART_CR1_UE); |
413 | 413 | } |
|
414 | /** |
414 | |
415 | * @brief USART Disable (all USART prescalers and outputs are disabled) |
415 | /** |
416 | * @note When USART is disabled, USART prescalers and outputs are stopped immediately, |
416 | * @brief USART Disable (all USART prescalers and outputs are disabled) |
417 | * and current operations are discarded. The configuration of the USART is kept, but all the status |
417 | * @note When USART is disabled, USART prescalers and outputs are stopped immediately, |
418 | * flags, in the USARTx_SR are set to their default values. |
418 | * and current operations are discarded. The configuration of the USART is kept, but all the status |
419 | * @rmtoll CR1 UE LL_USART_Disable |
419 | * flags, in the USARTx_SR are set to their default values. |
420 | * @param USARTx USART Instance |
420 | * @rmtoll CR1 UE LL_USART_Disable |
421 | * @retval None |
421 | * @param USARTx USART Instance |
422 | */ |
422 | * @retval None |
423 | __STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx) |
423 | */ |
424 | { |
424 | __STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx) |
425 | CLEAR_BIT(USARTx->CR1, USART_CR1_UE); |
425 | { |
426 | } |
426 | CLEAR_BIT(USARTx->CR1, USART_CR1_UE); |
427 | 427 | } |
|
428 | /** |
428 | |
429 | * @brief Indicate if USART is enabled |
429 | /** |
430 | * @rmtoll CR1 UE LL_USART_IsEnabled |
430 | * @brief Indicate if USART is enabled |
431 | * @param USARTx USART Instance |
431 | * @rmtoll CR1 UE LL_USART_IsEnabled |
432 | * @retval State of bit (1 or 0). |
432 | * @param USARTx USART Instance |
433 | */ |
433 | * @retval State of bit (1 or 0). |
434 | __STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx) |
434 | */ |
435 | { |
435 | __STATIC_INLINE uint32_t LL_USART_IsEnabled(const USART_TypeDef *USARTx) |
436 | return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)); |
436 | { |
437 | } |
437 | return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)); |
438 | 438 | } |
|
439 | /** |
439 | |
440 | * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit) |
440 | /** |
441 | * @rmtoll CR1 RE LL_USART_EnableDirectionRx |
441 | * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit) |
442 | * @param USARTx USART Instance |
442 | * @rmtoll CR1 RE LL_USART_EnableDirectionRx |
443 | * @retval None |
443 | * @param USARTx USART Instance |
444 | */ |
444 | * @retval None |
445 | __STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx) |
445 | */ |
446 | { |
446 | __STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx) |
447 | SET_BIT(USARTx->CR1, USART_CR1_RE); |
447 | { |
448 | } |
448 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_RE); |
449 | 449 | } |
|
450 | /** |
450 | |
451 | * @brief Receiver Disable |
451 | /** |
452 | * @rmtoll CR1 RE LL_USART_DisableDirectionRx |
452 | * @brief Receiver Disable |
453 | * @param USARTx USART Instance |
453 | * @rmtoll CR1 RE LL_USART_DisableDirectionRx |
454 | * @retval None |
454 | * @param USARTx USART Instance |
455 | */ |
455 | * @retval None |
456 | __STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx) |
456 | */ |
457 | { |
457 | __STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx) |
458 | CLEAR_BIT(USARTx->CR1, USART_CR1_RE); |
458 | { |
459 | } |
459 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_RE); |
460 | 460 | } |
|
461 | /** |
461 | |
462 | * @brief Transmitter Enable |
462 | /** |
463 | * @rmtoll CR1 TE LL_USART_EnableDirectionTx |
463 | * @brief Transmitter Enable |
464 | * @param USARTx USART Instance |
464 | * @rmtoll CR1 TE LL_USART_EnableDirectionTx |
465 | * @retval None |
465 | * @param USARTx USART Instance |
466 | */ |
466 | * @retval None |
467 | __STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx) |
467 | */ |
468 | { |
468 | __STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx) |
469 | SET_BIT(USARTx->CR1, USART_CR1_TE); |
469 | { |
470 | } |
470 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_TE); |
471 | 471 | } |
|
472 | /** |
472 | |
473 | * @brief Transmitter Disable |
473 | /** |
474 | * @rmtoll CR1 TE LL_USART_DisableDirectionTx |
474 | * @brief Transmitter Disable |
475 | * @param USARTx USART Instance |
475 | * @rmtoll CR1 TE LL_USART_DisableDirectionTx |
476 | * @retval None |
476 | * @param USARTx USART Instance |
477 | */ |
477 | * @retval None |
478 | __STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx) |
478 | */ |
479 | { |
479 | __STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx) |
480 | CLEAR_BIT(USARTx->CR1, USART_CR1_TE); |
480 | { |
481 | } |
481 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_TE); |
482 | 482 | } |
|
483 | /** |
483 | |
484 | * @brief Configure simultaneously enabled/disabled states |
484 | /** |
485 | * of Transmitter and Receiver |
485 | * @brief Configure simultaneously enabled/disabled states |
486 | * @rmtoll CR1 RE LL_USART_SetTransferDirection\n |
486 | * of Transmitter and Receiver |
487 | * CR1 TE LL_USART_SetTransferDirection |
487 | * @rmtoll CR1 RE LL_USART_SetTransferDirection\n |
488 | * @param USARTx USART Instance |
488 | * CR1 TE LL_USART_SetTransferDirection |
489 | * @param TransferDirection This parameter can be one of the following values: |
489 | * @param USARTx USART Instance |
490 | * @arg @ref LL_USART_DIRECTION_NONE |
490 | * @param TransferDirection This parameter can be one of the following values: |
491 | * @arg @ref LL_USART_DIRECTION_RX |
491 | * @arg @ref LL_USART_DIRECTION_NONE |
492 | * @arg @ref LL_USART_DIRECTION_TX |
492 | * @arg @ref LL_USART_DIRECTION_RX |
493 | * @arg @ref LL_USART_DIRECTION_TX_RX |
493 | * @arg @ref LL_USART_DIRECTION_TX |
494 | * @retval None |
494 | * @arg @ref LL_USART_DIRECTION_TX_RX |
495 | */ |
495 | * @retval None |
496 | __STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection) |
496 | */ |
497 | { |
497 | __STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection) |
498 | MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection); |
498 | { |
499 | } |
499 | ATOMIC_MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection); |
500 | 500 | } |
|
501 | /** |
501 | |
502 | * @brief Return enabled/disabled states of Transmitter and Receiver |
502 | /** |
503 | * @rmtoll CR1 RE LL_USART_GetTransferDirection\n |
503 | * @brief Return enabled/disabled states of Transmitter and Receiver |
504 | * CR1 TE LL_USART_GetTransferDirection |
504 | * @rmtoll CR1 RE LL_USART_GetTransferDirection\n |
505 | * @param USARTx USART Instance |
505 | * CR1 TE LL_USART_GetTransferDirection |
506 | * @retval Returned value can be one of the following values: |
506 | * @param USARTx USART Instance |
507 | * @arg @ref LL_USART_DIRECTION_NONE |
507 | * @retval Returned value can be one of the following values: |
508 | * @arg @ref LL_USART_DIRECTION_RX |
508 | * @arg @ref LL_USART_DIRECTION_NONE |
509 | * @arg @ref LL_USART_DIRECTION_TX |
509 | * @arg @ref LL_USART_DIRECTION_RX |
510 | * @arg @ref LL_USART_DIRECTION_TX_RX |
510 | * @arg @ref LL_USART_DIRECTION_TX |
511 | */ |
511 | * @arg @ref LL_USART_DIRECTION_TX_RX |
512 | __STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx) |
512 | */ |
513 | { |
513 | __STATIC_INLINE uint32_t LL_USART_GetTransferDirection(const USART_TypeDef *USARTx) |
514 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE)); |
514 | { |
515 | } |
515 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE)); |
516 | 516 | } |
|
517 | /** |
517 | |
518 | * @brief Configure Parity (enabled/disabled and parity mode if enabled). |
518 | /** |
519 | * @note This function selects if hardware parity control (generation and detection) is enabled or disabled. |
519 | * @brief Configure Parity (enabled/disabled and parity mode if enabled). |
520 | * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position |
520 | * @note This function selects if hardware parity control (generation and detection) is enabled or disabled. |
521 | * (9th or 8th bit depending on data width) and parity is checked on the received data. |
521 | * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position |
522 | * @rmtoll CR1 PS LL_USART_SetParity\n |
522 | * (9th or 8th bit depending on data width) and parity is checked on the received data. |
523 | * CR1 PCE LL_USART_SetParity |
523 | * @rmtoll CR1 PS LL_USART_SetParity\n |
524 | * @param USARTx USART Instance |
524 | * CR1 PCE LL_USART_SetParity |
525 | * @param Parity This parameter can be one of the following values: |
525 | * @param USARTx USART Instance |
526 | * @arg @ref LL_USART_PARITY_NONE |
526 | * @param Parity This parameter can be one of the following values: |
527 | * @arg @ref LL_USART_PARITY_EVEN |
527 | * @arg @ref LL_USART_PARITY_NONE |
528 | * @arg @ref LL_USART_PARITY_ODD |
528 | * @arg @ref LL_USART_PARITY_EVEN |
529 | * @retval None |
529 | * @arg @ref LL_USART_PARITY_ODD |
530 | */ |
530 | * @retval None |
531 | __STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity) |
531 | */ |
532 | { |
532 | __STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity) |
533 | MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity); |
533 | { |
534 | } |
534 | MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity); |
535 | 535 | } |
|
536 | /** |
536 | |
537 | * @brief Return Parity configuration (enabled/disabled and parity mode if enabled) |
537 | /** |
538 | * @rmtoll CR1 PS LL_USART_GetParity\n |
538 | * @brief Return Parity configuration (enabled/disabled and parity mode if enabled) |
539 | * CR1 PCE LL_USART_GetParity |
539 | * @rmtoll CR1 PS LL_USART_GetParity\n |
540 | * @param USARTx USART Instance |
540 | * CR1 PCE LL_USART_GetParity |
541 | * @retval Returned value can be one of the following values: |
541 | * @param USARTx USART Instance |
542 | * @arg @ref LL_USART_PARITY_NONE |
542 | * @retval Returned value can be one of the following values: |
543 | * @arg @ref LL_USART_PARITY_EVEN |
543 | * @arg @ref LL_USART_PARITY_NONE |
544 | * @arg @ref LL_USART_PARITY_ODD |
544 | * @arg @ref LL_USART_PARITY_EVEN |
545 | */ |
545 | * @arg @ref LL_USART_PARITY_ODD |
546 | __STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx) |
546 | */ |
547 | { |
547 | __STATIC_INLINE uint32_t LL_USART_GetParity(const USART_TypeDef *USARTx) |
548 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE)); |
548 | { |
549 | } |
549 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE)); |
550 | 550 | } |
|
551 | /** |
551 | |
552 | * @brief Set Receiver Wake Up method from Mute mode. |
552 | /** |
553 | * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod |
553 | * @brief Set Receiver Wake Up method from Mute mode. |
554 | * @param USARTx USART Instance |
554 | * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod |
555 | * @param Method This parameter can be one of the following values: |
555 | * @param USARTx USART Instance |
556 | * @arg @ref LL_USART_WAKEUP_IDLELINE |
556 | * @param Method This parameter can be one of the following values: |
557 | * @arg @ref LL_USART_WAKEUP_ADDRESSMARK |
557 | * @arg @ref LL_USART_WAKEUP_IDLELINE |
558 | * @retval None |
558 | * @arg @ref LL_USART_WAKEUP_ADDRESSMARK |
559 | */ |
559 | * @retval None |
560 | __STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method) |
560 | */ |
561 | { |
561 | __STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method) |
562 | MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method); |
562 | { |
563 | } |
563 | MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method); |
564 | 564 | } |
|
565 | /** |
565 | |
566 | * @brief Return Receiver Wake Up method from Mute mode |
566 | /** |
567 | * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod |
567 | * @brief Return Receiver Wake Up method from Mute mode |
568 | * @param USARTx USART Instance |
568 | * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod |
569 | * @retval Returned value can be one of the following values: |
569 | * @param USARTx USART Instance |
570 | * @arg @ref LL_USART_WAKEUP_IDLELINE |
570 | * @retval Returned value can be one of the following values: |
571 | * @arg @ref LL_USART_WAKEUP_ADDRESSMARK |
571 | * @arg @ref LL_USART_WAKEUP_IDLELINE |
572 | */ |
572 | * @arg @ref LL_USART_WAKEUP_ADDRESSMARK |
573 | __STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx) |
573 | */ |
574 | { |
574 | __STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(const USART_TypeDef *USARTx) |
575 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE)); |
575 | { |
576 | } |
576 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE)); |
577 | 577 | } |
|
578 | /** |
578 | |
579 | * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits) |
579 | /** |
580 | * @rmtoll CR1 M LL_USART_SetDataWidth |
580 | * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits) |
581 | * @param USARTx USART Instance |
581 | * @rmtoll CR1 M LL_USART_SetDataWidth |
582 | * @param DataWidth This parameter can be one of the following values: |
582 | * @param USARTx USART Instance |
583 | * @arg @ref LL_USART_DATAWIDTH_8B |
583 | * @param DataWidth This parameter can be one of the following values: |
584 | * @arg @ref LL_USART_DATAWIDTH_9B |
584 | * @arg @ref LL_USART_DATAWIDTH_8B |
585 | * @retval None |
585 | * @arg @ref LL_USART_DATAWIDTH_9B |
586 | */ |
586 | * @retval None |
587 | __STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth) |
587 | */ |
588 | { |
588 | __STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth) |
589 | MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth); |
589 | { |
590 | } |
590 | MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth); |
591 | 591 | } |
|
592 | /** |
592 | |
593 | * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits) |
593 | /** |
594 | * @rmtoll CR1 M LL_USART_GetDataWidth |
594 | * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits) |
595 | * @param USARTx USART Instance |
595 | * @rmtoll CR1 M LL_USART_GetDataWidth |
596 | * @retval Returned value can be one of the following values: |
596 | * @param USARTx USART Instance |
597 | * @arg @ref LL_USART_DATAWIDTH_8B |
597 | * @retval Returned value can be one of the following values: |
598 | * @arg @ref LL_USART_DATAWIDTH_9B |
598 | * @arg @ref LL_USART_DATAWIDTH_8B |
599 | */ |
599 | * @arg @ref LL_USART_DATAWIDTH_9B |
600 | __STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx) |
600 | */ |
601 | { |
601 | __STATIC_INLINE uint32_t LL_USART_GetDataWidth(const USART_TypeDef *USARTx) |
602 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M)); |
602 | { |
603 | } |
603 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M)); |
604 | 604 | } |
|
605 | /** |
605 | |
606 | * @brief Set Oversampling to 8-bit or 16-bit mode |
606 | /** |
607 | * @rmtoll CR1 OVER8 LL_USART_SetOverSampling |
607 | * @brief Set Oversampling to 8-bit or 16-bit mode |
608 | * @param USARTx USART Instance |
608 | * @rmtoll CR1 OVER8 LL_USART_SetOverSampling |
609 | * @param OverSampling This parameter can be one of the following values: |
609 | * @param USARTx USART Instance |
610 | * @arg @ref LL_USART_OVERSAMPLING_16 |
610 | * @param OverSampling This parameter can be one of the following values: |
611 | * @arg @ref LL_USART_OVERSAMPLING_8 |
611 | * @arg @ref LL_USART_OVERSAMPLING_16 |
612 | * @retval None |
612 | * @arg @ref LL_USART_OVERSAMPLING_8 |
613 | */ |
613 | * @retval None |
614 | __STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling) |
614 | */ |
615 | { |
615 | __STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling) |
616 | MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling); |
616 | { |
617 | } |
617 | MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling); |
618 | 618 | } |
|
619 | /** |
619 | |
620 | * @brief Return Oversampling mode |
620 | /** |
621 | * @rmtoll CR1 OVER8 LL_USART_GetOverSampling |
621 | * @brief Return Oversampling mode |
622 | * @param USARTx USART Instance |
622 | * @rmtoll CR1 OVER8 LL_USART_GetOverSampling |
623 | * @retval Returned value can be one of the following values: |
623 | * @param USARTx USART Instance |
624 | * @arg @ref LL_USART_OVERSAMPLING_16 |
624 | * @retval Returned value can be one of the following values: |
625 | * @arg @ref LL_USART_OVERSAMPLING_8 |
625 | * @arg @ref LL_USART_OVERSAMPLING_16 |
626 | */ |
626 | * @arg @ref LL_USART_OVERSAMPLING_8 |
627 | __STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx) |
627 | */ |
628 | { |
628 | __STATIC_INLINE uint32_t LL_USART_GetOverSampling(const USART_TypeDef *USARTx) |
629 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8)); |
629 | { |
630 | } |
630 | return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8)); |
631 | 631 | } |
|
632 | /** |
632 | |
633 | * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not |
633 | /** |
634 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
634 | * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not |
635 | * Synchronous mode is supported by the USARTx instance. |
635 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
636 | * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput |
636 | * Synchronous mode is supported by the USARTx instance. |
637 | * @param USARTx USART Instance |
637 | * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput |
638 | * @param LastBitClockPulse This parameter can be one of the following values: |
638 | * @param USARTx USART Instance |
639 | * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT |
639 | * @param LastBitClockPulse This parameter can be one of the following values: |
640 | * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT |
640 | * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT |
641 | * @retval None |
641 | * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT |
642 | */ |
642 | * @retval None |
643 | __STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse) |
643 | */ |
644 | { |
644 | __STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse) |
645 | MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse); |
645 | { |
646 | } |
646 | MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse); |
647 | 647 | } |
|
648 | /** |
648 | |
649 | * @brief Retrieve Clock pulse of the last data bit output configuration |
649 | /** |
650 | * (Last bit Clock pulse output to the SCLK pin or not) |
650 | * @brief Retrieve Clock pulse of the last data bit output configuration |
651 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
651 | * (Last bit Clock pulse output to the SCLK pin or not) |
652 | * Synchronous mode is supported by the USARTx instance. |
652 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
653 | * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput |
653 | * Synchronous mode is supported by the USARTx instance. |
654 | * @param USARTx USART Instance |
654 | * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput |
655 | * @retval Returned value can be one of the following values: |
655 | * @param USARTx USART Instance |
656 | * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT |
656 | * @retval Returned value can be one of the following values: |
657 | * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT |
657 | * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT |
658 | */ |
658 | * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT |
659 | __STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx) |
659 | */ |
660 | { |
660 | __STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(const USART_TypeDef *USARTx) |
661 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL)); |
661 | { |
662 | } |
662 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL)); |
663 | 663 | } |
|
664 | /** |
664 | |
665 | * @brief Select the phase of the clock output on the SCLK pin in synchronous mode |
665 | /** |
666 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
666 | * @brief Select the phase of the clock output on the SCLK pin in synchronous mode |
667 | * Synchronous mode is supported by the USARTx instance. |
667 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
668 | * @rmtoll CR2 CPHA LL_USART_SetClockPhase |
668 | * Synchronous mode is supported by the USARTx instance. |
669 | * @param USARTx USART Instance |
669 | * @rmtoll CR2 CPHA LL_USART_SetClockPhase |
670 | * @param ClockPhase This parameter can be one of the following values: |
670 | * @param USARTx USART Instance |
671 | * @arg @ref LL_USART_PHASE_1EDGE |
671 | * @param ClockPhase This parameter can be one of the following values: |
672 | * @arg @ref LL_USART_PHASE_2EDGE |
672 | * @arg @ref LL_USART_PHASE_1EDGE |
673 | * @retval None |
673 | * @arg @ref LL_USART_PHASE_2EDGE |
674 | */ |
674 | * @retval None |
675 | __STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase) |
675 | */ |
676 | { |
676 | __STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase) |
677 | MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase); |
677 | { |
678 | } |
678 | MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase); |
679 | 679 | } |
|
680 | /** |
680 | |
681 | * @brief Return phase of the clock output on the SCLK pin in synchronous mode |
681 | /** |
682 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
682 | * @brief Return phase of the clock output on the SCLK pin in synchronous mode |
683 | * Synchronous mode is supported by the USARTx instance. |
683 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
684 | * @rmtoll CR2 CPHA LL_USART_GetClockPhase |
684 | * Synchronous mode is supported by the USARTx instance. |
685 | * @param USARTx USART Instance |
685 | * @rmtoll CR2 CPHA LL_USART_GetClockPhase |
686 | * @retval Returned value can be one of the following values: |
686 | * @param USARTx USART Instance |
687 | * @arg @ref LL_USART_PHASE_1EDGE |
687 | * @retval Returned value can be one of the following values: |
688 | * @arg @ref LL_USART_PHASE_2EDGE |
688 | * @arg @ref LL_USART_PHASE_1EDGE |
689 | */ |
689 | * @arg @ref LL_USART_PHASE_2EDGE |
690 | __STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx) |
690 | */ |
691 | { |
691 | __STATIC_INLINE uint32_t LL_USART_GetClockPhase(const USART_TypeDef *USARTx) |
692 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA)); |
692 | { |
693 | } |
693 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA)); |
694 | 694 | } |
|
695 | /** |
695 | |
696 | * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode |
696 | /** |
697 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
697 | * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode |
698 | * Synchronous mode is supported by the USARTx instance. |
698 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
699 | * @rmtoll CR2 CPOL LL_USART_SetClockPolarity |
699 | * Synchronous mode is supported by the USARTx instance. |
700 | * @param USARTx USART Instance |
700 | * @rmtoll CR2 CPOL LL_USART_SetClockPolarity |
701 | * @param ClockPolarity This parameter can be one of the following values: |
701 | * @param USARTx USART Instance |
702 | * @arg @ref LL_USART_POLARITY_LOW |
702 | * @param ClockPolarity This parameter can be one of the following values: |
703 | * @arg @ref LL_USART_POLARITY_HIGH |
703 | * @arg @ref LL_USART_POLARITY_LOW |
704 | * @retval None |
704 | * @arg @ref LL_USART_POLARITY_HIGH |
705 | */ |
705 | * @retval None |
706 | __STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity) |
706 | */ |
707 | { |
707 | __STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity) |
708 | MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity); |
708 | { |
709 | } |
709 | MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity); |
710 | 710 | } |
|
711 | /** |
711 | |
712 | * @brief Return polarity of the clock output on the SCLK pin in synchronous mode |
712 | /** |
713 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
713 | * @brief Return polarity of the clock output on the SCLK pin in synchronous mode |
714 | * Synchronous mode is supported by the USARTx instance. |
714 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
715 | * @rmtoll CR2 CPOL LL_USART_GetClockPolarity |
715 | * Synchronous mode is supported by the USARTx instance. |
716 | * @param USARTx USART Instance |
716 | * @rmtoll CR2 CPOL LL_USART_GetClockPolarity |
717 | * @retval Returned value can be one of the following values: |
717 | * @param USARTx USART Instance |
718 | * @arg @ref LL_USART_POLARITY_LOW |
718 | * @retval Returned value can be one of the following values: |
719 | * @arg @ref LL_USART_POLARITY_HIGH |
719 | * @arg @ref LL_USART_POLARITY_LOW |
720 | */ |
720 | * @arg @ref LL_USART_POLARITY_HIGH |
721 | __STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx) |
721 | */ |
722 | { |
722 | __STATIC_INLINE uint32_t LL_USART_GetClockPolarity(const USART_TypeDef *USARTx) |
723 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL)); |
723 | { |
724 | } |
724 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL)); |
725 | 725 | } |
|
726 | /** |
726 | |
727 | * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse) |
727 | /** |
728 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
728 | * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse) |
729 | * Synchronous mode is supported by the USARTx instance. |
729 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
730 | * @note Call of this function is equivalent to following function call sequence : |
730 | * Synchronous mode is supported by the USARTx instance. |
731 | * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function |
731 | * @note Call of this function is equivalent to following function call sequence : |
732 | * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function |
732 | * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function |
733 | * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function |
733 | * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function |
734 | * @rmtoll CR2 CPHA LL_USART_ConfigClock\n |
734 | * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function |
735 | * CR2 CPOL LL_USART_ConfigClock\n |
735 | * @rmtoll CR2 CPHA LL_USART_ConfigClock\n |
736 | * CR2 LBCL LL_USART_ConfigClock |
736 | * CR2 CPOL LL_USART_ConfigClock\n |
737 | * @param USARTx USART Instance |
737 | * CR2 LBCL LL_USART_ConfigClock |
738 | * @param Phase This parameter can be one of the following values: |
738 | * @param USARTx USART Instance |
739 | * @arg @ref LL_USART_PHASE_1EDGE |
739 | * @param Phase This parameter can be one of the following values: |
740 | * @arg @ref LL_USART_PHASE_2EDGE |
740 | * @arg @ref LL_USART_PHASE_1EDGE |
741 | * @param Polarity This parameter can be one of the following values: |
741 | * @arg @ref LL_USART_PHASE_2EDGE |
742 | * @arg @ref LL_USART_POLARITY_LOW |
742 | * @param Polarity This parameter can be one of the following values: |
743 | * @arg @ref LL_USART_POLARITY_HIGH |
743 | * @arg @ref LL_USART_POLARITY_LOW |
744 | * @param LBCPOutput This parameter can be one of the following values: |
744 | * @arg @ref LL_USART_POLARITY_HIGH |
745 | * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT |
745 | * @param LBCPOutput This parameter can be one of the following values: |
746 | * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT |
746 | * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT |
747 | * @retval None |
747 | * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT |
748 | */ |
748 | * @retval None |
749 | __STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput) |
749 | */ |
750 | { |
750 | __STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput) |
751 | MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput); |
751 | { |
752 | } |
752 | MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput); |
753 | 753 | } |
|
754 | /** |
754 | |
755 | * @brief Enable Clock output on SCLK pin |
755 | /** |
756 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
756 | * @brief Enable Clock output on SCLK pin |
757 | * Synchronous mode is supported by the USARTx instance. |
757 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
758 | * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput |
758 | * Synchronous mode is supported by the USARTx instance. |
759 | * @param USARTx USART Instance |
759 | * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput |
760 | * @retval None |
760 | * @param USARTx USART Instance |
761 | */ |
761 | * @retval None |
762 | __STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx) |
762 | */ |
763 | { |
763 | __STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx) |
764 | SET_BIT(USARTx->CR2, USART_CR2_CLKEN); |
764 | { |
765 | } |
765 | SET_BIT(USARTx->CR2, USART_CR2_CLKEN); |
766 | 766 | } |
|
767 | /** |
767 | |
768 | * @brief Disable Clock output on SCLK pin |
768 | /** |
769 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
769 | * @brief Disable Clock output on SCLK pin |
770 | * Synchronous mode is supported by the USARTx instance. |
770 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
771 | * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput |
771 | * Synchronous mode is supported by the USARTx instance. |
772 | * @param USARTx USART Instance |
772 | * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput |
773 | * @retval None |
773 | * @param USARTx USART Instance |
774 | */ |
774 | * @retval None |
775 | __STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx) |
775 | */ |
776 | { |
776 | __STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx) |
777 | CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN); |
777 | { |
778 | } |
778 | CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN); |
779 | 779 | } |
|
780 | /** |
780 | |
781 | * @brief Indicate if Clock output on SCLK pin is enabled |
781 | /** |
782 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
782 | * @brief Indicate if Clock output on SCLK pin is enabled |
783 | * Synchronous mode is supported by the USARTx instance. |
783 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
784 | * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput |
784 | * Synchronous mode is supported by the USARTx instance. |
785 | * @param USARTx USART Instance |
785 | * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput |
786 | * @retval State of bit (1 or 0). |
786 | * @param USARTx USART Instance |
787 | */ |
787 | * @retval State of bit (1 or 0). |
788 | __STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx) |
788 | */ |
789 | { |
789 | __STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(const USART_TypeDef *USARTx) |
790 | return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN)); |
790 | { |
791 | } |
791 | return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN)); |
792 | 792 | } |
|
793 | /** |
793 | |
794 | * @brief Set the length of the stop bits |
794 | /** |
795 | * @rmtoll CR2 STOP LL_USART_SetStopBitsLength |
795 | * @brief Set the length of the stop bits |
796 | * @param USARTx USART Instance |
796 | * @rmtoll CR2 STOP LL_USART_SetStopBitsLength |
797 | * @param StopBits This parameter can be one of the following values: |
797 | * @param USARTx USART Instance |
798 | * @arg @ref LL_USART_STOPBITS_0_5 |
798 | * @param StopBits This parameter can be one of the following values: |
799 | * @arg @ref LL_USART_STOPBITS_1 |
799 | * @arg @ref LL_USART_STOPBITS_0_5 |
800 | * @arg @ref LL_USART_STOPBITS_1_5 |
800 | * @arg @ref LL_USART_STOPBITS_1 |
801 | * @arg @ref LL_USART_STOPBITS_2 |
801 | * @arg @ref LL_USART_STOPBITS_1_5 |
802 | * @retval None |
802 | * @arg @ref LL_USART_STOPBITS_2 |
803 | */ |
803 | * @retval None |
804 | __STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits) |
804 | */ |
805 | { |
805 | __STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits) |
806 | MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); |
806 | { |
807 | } |
807 | MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); |
808 | 808 | } |
|
809 | /** |
809 | |
810 | * @brief Retrieve the length of the stop bits |
810 | /** |
811 | * @rmtoll CR2 STOP LL_USART_GetStopBitsLength |
811 | * @brief Retrieve the length of the stop bits |
812 | * @param USARTx USART Instance |
812 | * @rmtoll CR2 STOP LL_USART_GetStopBitsLength |
813 | * @retval Returned value can be one of the following values: |
813 | * @param USARTx USART Instance |
814 | * @arg @ref LL_USART_STOPBITS_0_5 |
814 | * @retval Returned value can be one of the following values: |
815 | * @arg @ref LL_USART_STOPBITS_1 |
815 | * @arg @ref LL_USART_STOPBITS_0_5 |
816 | * @arg @ref LL_USART_STOPBITS_1_5 |
816 | * @arg @ref LL_USART_STOPBITS_1 |
817 | * @arg @ref LL_USART_STOPBITS_2 |
817 | * @arg @ref LL_USART_STOPBITS_1_5 |
818 | */ |
818 | * @arg @ref LL_USART_STOPBITS_2 |
819 | __STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx) |
819 | */ |
820 | { |
820 | __STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(const USART_TypeDef *USARTx) |
821 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP)); |
821 | { |
822 | } |
822 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP)); |
823 | 823 | } |
|
824 | /** |
824 | |
825 | * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits) |
825 | /** |
826 | * @note Call of this function is equivalent to following function call sequence : |
826 | * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits) |
827 | * - Data Width configuration using @ref LL_USART_SetDataWidth() function |
827 | * @note Call of this function is equivalent to following function call sequence : |
828 | * - Parity Control and mode configuration using @ref LL_USART_SetParity() function |
828 | * - Data Width configuration using @ref LL_USART_SetDataWidth() function |
829 | * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function |
829 | * - Parity Control and mode configuration using @ref LL_USART_SetParity() function |
830 | * @rmtoll CR1 PS LL_USART_ConfigCharacter\n |
830 | * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function |
831 | * CR1 PCE LL_USART_ConfigCharacter\n |
831 | * @rmtoll CR1 PS LL_USART_ConfigCharacter\n |
832 | * CR1 M LL_USART_ConfigCharacter\n |
832 | * CR1 PCE LL_USART_ConfigCharacter\n |
833 | * CR2 STOP LL_USART_ConfigCharacter |
833 | * CR1 M LL_USART_ConfigCharacter\n |
834 | * @param USARTx USART Instance |
834 | * CR2 STOP LL_USART_ConfigCharacter |
835 | * @param DataWidth This parameter can be one of the following values: |
835 | * @param USARTx USART Instance |
836 | * @arg @ref LL_USART_DATAWIDTH_8B |
836 | * @param DataWidth This parameter can be one of the following values: |
837 | * @arg @ref LL_USART_DATAWIDTH_9B |
837 | * @arg @ref LL_USART_DATAWIDTH_8B |
838 | * @param Parity This parameter can be one of the following values: |
838 | * @arg @ref LL_USART_DATAWIDTH_9B |
839 | * @arg @ref LL_USART_PARITY_NONE |
839 | * @param Parity This parameter can be one of the following values: |
840 | * @arg @ref LL_USART_PARITY_EVEN |
840 | * @arg @ref LL_USART_PARITY_NONE |
841 | * @arg @ref LL_USART_PARITY_ODD |
841 | * @arg @ref LL_USART_PARITY_EVEN |
842 | * @param StopBits This parameter can be one of the following values: |
842 | * @arg @ref LL_USART_PARITY_ODD |
843 | * @arg @ref LL_USART_STOPBITS_0_5 |
843 | * @param StopBits This parameter can be one of the following values: |
844 | * @arg @ref LL_USART_STOPBITS_1 |
844 | * @arg @ref LL_USART_STOPBITS_0_5 |
845 | * @arg @ref LL_USART_STOPBITS_1_5 |
845 | * @arg @ref LL_USART_STOPBITS_1 |
846 | * @arg @ref LL_USART_STOPBITS_2 |
846 | * @arg @ref LL_USART_STOPBITS_1_5 |
847 | * @retval None |
847 | * @arg @ref LL_USART_STOPBITS_2 |
848 | */ |
848 | * @retval None |
849 | __STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity, |
849 | */ |
850 | uint32_t StopBits) |
850 | __STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity, |
851 | { |
851 | uint32_t StopBits) |
852 | MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth); |
852 | { |
853 | MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); |
853 | MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth); |
854 | } |
854 | MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); |
855 | 855 | } |
|
856 | /** |
856 | |
857 | * @brief Set Address of the USART node. |
857 | /** |
858 | * @note This is used in multiprocessor communication during Mute mode or Stop mode, |
858 | * @brief Set Address of the USART node. |
859 | * for wake up with address mark detection. |
859 | * @note This is used in multiprocessor communication during Mute mode or Stop mode, |
860 | * @rmtoll CR2 ADD LL_USART_SetNodeAddress |
860 | * for wake up with address mark detection. |
861 | * @param USARTx USART Instance |
861 | * @rmtoll CR2 ADD LL_USART_SetNodeAddress |
862 | * @param NodeAddress 4 bit Address of the USART node. |
862 | * @param USARTx USART Instance |
863 | * @retval None |
863 | * @param NodeAddress 4 bit Address of the USART node. |
864 | */ |
864 | * @retval None |
865 | __STATIC_INLINE void LL_USART_SetNodeAddress(USART_TypeDef *USARTx, uint32_t NodeAddress) |
865 | */ |
866 | { |
866 | __STATIC_INLINE void LL_USART_SetNodeAddress(USART_TypeDef *USARTx, uint32_t NodeAddress) |
867 | MODIFY_REG(USARTx->CR2, USART_CR2_ADD, (NodeAddress & USART_CR2_ADD)); |
867 | { |
868 | } |
868 | MODIFY_REG(USARTx->CR2, USART_CR2_ADD, (NodeAddress & USART_CR2_ADD)); |
869 | 869 | } |
|
870 | /** |
870 | |
871 | * @brief Return 4 bit Address of the USART node as set in ADD field of CR2. |
871 | /** |
872 | * @note only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant) |
872 | * @brief Return 4 bit Address of the USART node as set in ADD field of CR2. |
873 | * @rmtoll CR2 ADD LL_USART_GetNodeAddress |
873 | * @note only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant) |
874 | * @param USARTx USART Instance |
874 | * @rmtoll CR2 ADD LL_USART_GetNodeAddress |
875 | * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255) |
875 | * @param USARTx USART Instance |
876 | */ |
876 | * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255) |
877 | __STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx) |
877 | */ |
878 | { |
878 | __STATIC_INLINE uint32_t LL_USART_GetNodeAddress(const USART_TypeDef *USARTx) |
879 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD)); |
879 | { |
880 | } |
880 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD)); |
881 | 881 | } |
|
882 | /** |
882 | |
883 | * @brief Enable RTS HW Flow Control |
883 | /** |
884 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
884 | * @brief Enable RTS HW Flow Control |
885 | * Hardware Flow control feature is supported by the USARTx instance. |
885 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
886 | * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl |
886 | * Hardware Flow control feature is supported by the USARTx instance. |
887 | * @param USARTx USART Instance |
887 | * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl |
888 | * @retval None |
888 | * @param USARTx USART Instance |
889 | */ |
889 | * @retval None |
890 | __STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx) |
890 | */ |
891 | { |
891 | __STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx) |
892 | SET_BIT(USARTx->CR3, USART_CR3_RTSE); |
892 | { |
893 | } |
893 | SET_BIT(USARTx->CR3, USART_CR3_RTSE); |
894 | 894 | } |
|
895 | /** |
895 | |
896 | * @brief Disable RTS HW Flow Control |
896 | /** |
897 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
897 | * @brief Disable RTS HW Flow Control |
898 | * Hardware Flow control feature is supported by the USARTx instance. |
898 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
899 | * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl |
899 | * Hardware Flow control feature is supported by the USARTx instance. |
900 | * @param USARTx USART Instance |
900 | * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl |
901 | * @retval None |
901 | * @param USARTx USART Instance |
902 | */ |
902 | * @retval None |
903 | __STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx) |
903 | */ |
904 | { |
904 | __STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx) |
905 | CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE); |
905 | { |
906 | } |
906 | CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE); |
907 | 907 | } |
|
908 | /** |
908 | |
909 | * @brief Enable CTS HW Flow Control |
909 | /** |
910 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
910 | * @brief Enable CTS HW Flow Control |
911 | * Hardware Flow control feature is supported by the USARTx instance. |
911 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
912 | * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl |
912 | * Hardware Flow control feature is supported by the USARTx instance. |
913 | * @param USARTx USART Instance |
913 | * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl |
914 | * @retval None |
914 | * @param USARTx USART Instance |
915 | */ |
915 | * @retval None |
916 | __STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx) |
916 | */ |
917 | { |
917 | __STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx) |
918 | SET_BIT(USARTx->CR3, USART_CR3_CTSE); |
918 | { |
919 | } |
919 | SET_BIT(USARTx->CR3, USART_CR3_CTSE); |
920 | 920 | } |
|
921 | /** |
921 | |
922 | * @brief Disable CTS HW Flow Control |
922 | /** |
923 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
923 | * @brief Disable CTS HW Flow Control |
924 | * Hardware Flow control feature is supported by the USARTx instance. |
924 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
925 | * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl |
925 | * Hardware Flow control feature is supported by the USARTx instance. |
926 | * @param USARTx USART Instance |
926 | * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl |
927 | * @retval None |
927 | * @param USARTx USART Instance |
928 | */ |
928 | * @retval None |
929 | __STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx) |
929 | */ |
930 | { |
930 | __STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx) |
931 | CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE); |
931 | { |
932 | } |
932 | CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE); |
933 | 933 | } |
|
934 | /** |
934 | |
935 | * @brief Configure HW Flow Control mode (both CTS and RTS) |
935 | /** |
936 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
936 | * @brief Configure HW Flow Control mode (both CTS and RTS) |
937 | * Hardware Flow control feature is supported by the USARTx instance. |
937 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
938 | * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n |
938 | * Hardware Flow control feature is supported by the USARTx instance. |
939 | * CR3 CTSE LL_USART_SetHWFlowCtrl |
939 | * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n |
940 | * @param USARTx USART Instance |
940 | * CR3 CTSE LL_USART_SetHWFlowCtrl |
941 | * @param HardwareFlowControl This parameter can be one of the following values: |
941 | * @param USARTx USART Instance |
942 | * @arg @ref LL_USART_HWCONTROL_NONE |
942 | * @param HardwareFlowControl This parameter can be one of the following values: |
943 | * @arg @ref LL_USART_HWCONTROL_RTS |
943 | * @arg @ref LL_USART_HWCONTROL_NONE |
944 | * @arg @ref LL_USART_HWCONTROL_CTS |
944 | * @arg @ref LL_USART_HWCONTROL_RTS |
945 | * @arg @ref LL_USART_HWCONTROL_RTS_CTS |
945 | * @arg @ref LL_USART_HWCONTROL_CTS |
946 | * @retval None |
946 | * @arg @ref LL_USART_HWCONTROL_RTS_CTS |
947 | */ |
947 | * @retval None |
948 | __STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl) |
948 | */ |
949 | { |
949 | __STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl) |
950 | MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl); |
950 | { |
951 | } |
951 | MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl); |
952 | 952 | } |
|
953 | /** |
953 | |
954 | * @brief Return HW Flow Control configuration (both CTS and RTS) |
954 | /** |
955 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
955 | * @brief Return HW Flow Control configuration (both CTS and RTS) |
956 | * Hardware Flow control feature is supported by the USARTx instance. |
956 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
957 | * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n |
957 | * Hardware Flow control feature is supported by the USARTx instance. |
958 | * CR3 CTSE LL_USART_GetHWFlowCtrl |
958 | * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n |
959 | * @param USARTx USART Instance |
959 | * CR3 CTSE LL_USART_GetHWFlowCtrl |
960 | * @retval Returned value can be one of the following values: |
960 | * @param USARTx USART Instance |
961 | * @arg @ref LL_USART_HWCONTROL_NONE |
961 | * @retval Returned value can be one of the following values: |
962 | * @arg @ref LL_USART_HWCONTROL_RTS |
962 | * @arg @ref LL_USART_HWCONTROL_NONE |
963 | * @arg @ref LL_USART_HWCONTROL_CTS |
963 | * @arg @ref LL_USART_HWCONTROL_RTS |
964 | * @arg @ref LL_USART_HWCONTROL_RTS_CTS |
964 | * @arg @ref LL_USART_HWCONTROL_CTS |
965 | */ |
965 | * @arg @ref LL_USART_HWCONTROL_RTS_CTS |
966 | __STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx) |
966 | */ |
967 | { |
967 | __STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(const USART_TypeDef *USARTx) |
968 | return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE)); |
968 | { |
969 | } |
969 | return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE)); |
970 | 970 | } |
|
971 | /** |
971 | |
972 | * @brief Enable One bit sampling method |
972 | /** |
973 | * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp |
973 | * @brief Enable One bit sampling method |
974 | * @param USARTx USART Instance |
974 | * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp |
975 | * @retval None |
975 | * @param USARTx USART Instance |
976 | */ |
976 | * @retval None |
977 | __STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx) |
977 | */ |
978 | { |
978 | __STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx) |
979 | SET_BIT(USARTx->CR3, USART_CR3_ONEBIT); |
979 | { |
980 | } |
980 | SET_BIT(USARTx->CR3, USART_CR3_ONEBIT); |
981 | 981 | } |
|
982 | /** |
982 | |
983 | * @brief Disable One bit sampling method |
983 | /** |
984 | * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp |
984 | * @brief Disable One bit sampling method |
985 | * @param USARTx USART Instance |
985 | * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp |
986 | * @retval None |
986 | * @param USARTx USART Instance |
987 | */ |
987 | * @retval None |
988 | __STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx) |
988 | */ |
989 | { |
989 | __STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx) |
990 | CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT); |
990 | { |
991 | } |
991 | CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT); |
992 | 992 | } |
|
993 | /** |
993 | |
994 | * @brief Indicate if One bit sampling method is enabled |
994 | /** |
995 | * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp |
995 | * @brief Indicate if One bit sampling method is enabled |
996 | * @param USARTx USART Instance |
996 | * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp |
997 | * @retval State of bit (1 or 0). |
997 | * @param USARTx USART Instance |
998 | */ |
998 | * @retval State of bit (1 or 0). |
999 | __STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx) |
999 | */ |
1000 | { |
1000 | __STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(const USART_TypeDef *USARTx) |
1001 | return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT)); |
1001 | { |
1002 | } |
1002 | return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT)); |
1003 | 1003 | } |
|
1004 | /** |
1004 | |
1005 | * @brief Configure USART BRR register for achieving expected Baud Rate value. |
1005 | /** |
1006 | * @note Compute and set USARTDIV value in BRR Register (full BRR content) |
1006 | * @brief Configure USART BRR register for achieving expected Baud Rate value. |
1007 | * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values |
1007 | * @note Compute and set USARTDIV value in BRR Register (full BRR content) |
1008 | * @note Peripheral clock and Baud rate values provided as function parameters should be valid |
1008 | * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values |
1009 | * (Baud rate value != 0) |
1009 | * @note Peripheral clock and Baud rate values provided as function parameters should be valid |
1010 | * @rmtoll BRR BRR LL_USART_SetBaudRate |
1010 | * (Baud rate value != 0) |
1011 | * @param USARTx USART Instance |
1011 | * @rmtoll BRR BRR LL_USART_SetBaudRate |
1012 | * @param PeriphClk Peripheral Clock |
1012 | * @param USARTx USART Instance |
1013 | * @param OverSampling This parameter can be one of the following values: |
1013 | * @param PeriphClk Peripheral Clock |
1014 | * @arg @ref LL_USART_OVERSAMPLING_16 |
1014 | * @param OverSampling This parameter can be one of the following values: |
1015 | * @arg @ref LL_USART_OVERSAMPLING_8 |
1015 | * @arg @ref LL_USART_OVERSAMPLING_16 |
1016 | * @param BaudRate Baud Rate |
1016 | * @arg @ref LL_USART_OVERSAMPLING_8 |
1017 | * @retval None |
1017 | * @param BaudRate Baud Rate |
1018 | */ |
1018 | * @retval None |
1019 | __STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling, |
1019 | */ |
1020 | uint32_t BaudRate) |
1020 | __STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling, |
1021 | { |
1021 | uint32_t BaudRate) |
1022 | if (OverSampling == LL_USART_OVERSAMPLING_8) |
1022 | { |
1023 | { |
1023 | if (OverSampling == LL_USART_OVERSAMPLING_8) |
1024 | USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate)); |
1024 | { |
1025 | } |
1025 | USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate)); |
1026 | else |
1026 | } |
1027 | { |
1027 | else |
1028 | USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate)); |
1028 | { |
1029 | } |
1029 | USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate)); |
1030 | } |
1030 | } |
1031 | 1031 | } |
|
1032 | /** |
1032 | |
1033 | * @brief Return current Baud Rate value, according to USARTDIV present in BRR register |
1033 | /** |
1034 | * (full BRR content), and to used Peripheral Clock and Oversampling mode values |
1034 | * @brief Return current Baud Rate value, according to USARTDIV present in BRR register |
1035 | * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned. |
1035 | * (full BRR content), and to used Peripheral Clock and Oversampling mode values |
1036 | * @rmtoll BRR BRR LL_USART_GetBaudRate |
1036 | * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned. |
1037 | * @param USARTx USART Instance |
1037 | * @rmtoll BRR BRR LL_USART_GetBaudRate |
1038 | * @param PeriphClk Peripheral Clock |
1038 | * @param USARTx USART Instance |
1039 | * @param OverSampling This parameter can be one of the following values: |
1039 | * @param PeriphClk Peripheral Clock |
1040 | * @arg @ref LL_USART_OVERSAMPLING_16 |
1040 | * @param OverSampling This parameter can be one of the following values: |
1041 | * @arg @ref LL_USART_OVERSAMPLING_8 |
1041 | * @arg @ref LL_USART_OVERSAMPLING_16 |
1042 | * @retval Baud Rate |
1042 | * @arg @ref LL_USART_OVERSAMPLING_8 |
1043 | */ |
1043 | * @retval Baud Rate |
1044 | __STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling) |
1044 | */ |
1045 | { |
1045 | __STATIC_INLINE uint32_t LL_USART_GetBaudRate(const USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling) |
1046 | uint32_t usartdiv = 0x0U; |
1046 | { |
1047 | uint32_t brrresult = 0x0U; |
1047 | uint32_t usartdiv = 0x0U; |
1048 | 1048 | uint32_t brrresult = 0x0U; |
|
1049 | usartdiv = USARTx->BRR; |
1049 | |
1050 | 1050 | usartdiv = USARTx->BRR; |
|
1051 | if (OverSampling == LL_USART_OVERSAMPLING_8) |
1051 | |
1052 | { |
1052 | if (OverSampling == LL_USART_OVERSAMPLING_8) |
1053 | if ((usartdiv & 0xFFF7U) != 0U) |
1053 | { |
1054 | { |
1054 | if ((usartdiv & 0xFFF7U) != 0U) |
1055 | usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ; |
1055 | { |
1056 | brrresult = (PeriphClk * 2U) / usartdiv; |
1056 | usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ; |
1057 | } |
1057 | brrresult = (PeriphClk * 2U) / usartdiv; |
1058 | } |
1058 | } |
1059 | else |
1059 | } |
1060 | { |
1060 | else |
1061 | if ((usartdiv & 0xFFFFU) != 0U) |
1061 | { |
1062 | { |
1062 | if ((usartdiv & 0xFFFFU) != 0U) |
1063 | brrresult = PeriphClk / usartdiv; |
1063 | { |
1064 | } |
1064 | brrresult = PeriphClk / usartdiv; |
1065 | } |
1065 | } |
1066 | return (brrresult); |
1066 | } |
1067 | } |
1067 | return (brrresult); |
1068 | 1068 | } |
|
1069 | /** |
1069 | |
1070 | * @} |
1070 | /** |
1071 | */ |
1071 | * @} |
1072 | 1072 | */ |
|
1073 | /** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature |
1073 | |
1074 | * @{ |
1074 | /** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature |
1075 | */ |
1075 | * @{ |
1076 | 1076 | */ |
|
1077 | /** |
1077 | |
1078 | * @brief Enable IrDA mode |
1078 | /** |
1079 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1079 | * @brief Enable IrDA mode |
1080 | * IrDA feature is supported by the USARTx instance. |
1080 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1081 | * @rmtoll CR3 IREN LL_USART_EnableIrda |
1081 | * IrDA feature is supported by the USARTx instance. |
1082 | * @param USARTx USART Instance |
1082 | * @rmtoll CR3 IREN LL_USART_EnableIrda |
1083 | * @retval None |
1083 | * @param USARTx USART Instance |
1084 | */ |
1084 | * @retval None |
1085 | __STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx) |
1085 | */ |
1086 | { |
1086 | __STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx) |
1087 | SET_BIT(USARTx->CR3, USART_CR3_IREN); |
1087 | { |
1088 | } |
1088 | SET_BIT(USARTx->CR3, USART_CR3_IREN); |
1089 | 1089 | } |
|
1090 | /** |
1090 | |
1091 | * @brief Disable IrDA mode |
1091 | /** |
1092 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1092 | * @brief Disable IrDA mode |
1093 | * IrDA feature is supported by the USARTx instance. |
1093 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1094 | * @rmtoll CR3 IREN LL_USART_DisableIrda |
1094 | * IrDA feature is supported by the USARTx instance. |
1095 | * @param USARTx USART Instance |
1095 | * @rmtoll CR3 IREN LL_USART_DisableIrda |
1096 | * @retval None |
1096 | * @param USARTx USART Instance |
1097 | */ |
1097 | * @retval None |
1098 | __STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx) |
1098 | */ |
1099 | { |
1099 | __STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx) |
1100 | CLEAR_BIT(USARTx->CR3, USART_CR3_IREN); |
1100 | { |
1101 | } |
1101 | CLEAR_BIT(USARTx->CR3, USART_CR3_IREN); |
1102 | 1102 | } |
|
1103 | /** |
1103 | |
1104 | * @brief Indicate if IrDA mode is enabled |
1104 | /** |
1105 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1105 | * @brief Indicate if IrDA mode is enabled |
1106 | * IrDA feature is supported by the USARTx instance. |
1106 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1107 | * @rmtoll CR3 IREN LL_USART_IsEnabledIrda |
1107 | * IrDA feature is supported by the USARTx instance. |
1108 | * @param USARTx USART Instance |
1108 | * @rmtoll CR3 IREN LL_USART_IsEnabledIrda |
1109 | * @retval State of bit (1 or 0). |
1109 | * @param USARTx USART Instance |
1110 | */ |
1110 | * @retval State of bit (1 or 0). |
1111 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx) |
1111 | */ |
1112 | { |
1112 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(const USART_TypeDef *USARTx) |
1113 | return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN)); |
1113 | { |
1114 | } |
1114 | return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN)); |
1115 | 1115 | } |
|
1116 | /** |
1116 | |
1117 | * @brief Configure IrDA Power Mode (Normal or Low Power) |
1117 | /** |
1118 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1118 | * @brief Configure IrDA Power Mode (Normal or Low Power) |
1119 | * IrDA feature is supported by the USARTx instance. |
1119 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1120 | * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode |
1120 | * IrDA feature is supported by the USARTx instance. |
1121 | * @param USARTx USART Instance |
1121 | * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode |
1122 | * @param PowerMode This parameter can be one of the following values: |
1122 | * @param USARTx USART Instance |
1123 | * @arg @ref LL_USART_IRDA_POWER_NORMAL |
1123 | * @param PowerMode This parameter can be one of the following values: |
1124 | * @arg @ref LL_USART_IRDA_POWER_LOW |
1124 | * @arg @ref LL_USART_IRDA_POWER_NORMAL |
1125 | * @retval None |
1125 | * @arg @ref LL_USART_IRDA_POWER_LOW |
1126 | */ |
1126 | * @retval None |
1127 | __STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode) |
1127 | */ |
1128 | { |
1128 | __STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode) |
1129 | MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode); |
1129 | { |
1130 | } |
1130 | MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode); |
1131 | 1131 | } |
|
1132 | /** |
1132 | |
1133 | * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power) |
1133 | /** |
1134 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1134 | * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power) |
1135 | * IrDA feature is supported by the USARTx instance. |
1135 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1136 | * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode |
1136 | * IrDA feature is supported by the USARTx instance. |
1137 | * @param USARTx USART Instance |
1137 | * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode |
1138 | * @retval Returned value can be one of the following values: |
1138 | * @param USARTx USART Instance |
1139 | * @arg @ref LL_USART_IRDA_POWER_NORMAL |
1139 | * @retval Returned value can be one of the following values: |
1140 | * @arg @ref LL_USART_PHASE_2EDGE |
1140 | * @arg @ref LL_USART_IRDA_POWER_NORMAL |
1141 | */ |
1141 | * @arg @ref LL_USART_PHASE_2EDGE |
1142 | __STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx) |
1142 | */ |
1143 | { |
1143 | __STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(const USART_TypeDef *USARTx) |
1144 | return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP)); |
1144 | { |
1145 | } |
1145 | return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP)); |
1146 | 1146 | } |
|
1147 | /** |
1147 | |
1148 | * @brief Set Irda prescaler value, used for dividing the USART clock source |
1148 | /** |
1149 | * to achieve the Irda Low Power frequency (8 bits value) |
1149 | * @brief Set Irda prescaler value, used for dividing the USART clock source |
1150 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1150 | * to achieve the Irda Low Power frequency (8 bits value) |
1151 | * IrDA feature is supported by the USARTx instance. |
1151 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1152 | * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler |
1152 | * IrDA feature is supported by the USARTx instance. |
1153 | * @param USARTx USART Instance |
1153 | * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler |
1154 | * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF |
1154 | * @param USARTx USART Instance |
1155 | * @retval None |
1155 | * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF |
1156 | */ |
1156 | * @retval None |
1157 | __STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) |
1157 | */ |
1158 | { |
1158 | __STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) |
1159 | MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); |
1159 | { |
1160 | } |
1160 | MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); |
1161 | 1161 | } |
|
1162 | /** |
1162 | |
1163 | * @brief Return Irda prescaler value, used for dividing the USART clock source |
1163 | /** |
1164 | * to achieve the Irda Low Power frequency (8 bits value) |
1164 | * @brief Return Irda prescaler value, used for dividing the USART clock source |
1165 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1165 | * to achieve the Irda Low Power frequency (8 bits value) |
1166 | * IrDA feature is supported by the USARTx instance. |
1166 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1167 | * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler |
1167 | * IrDA feature is supported by the USARTx instance. |
1168 | * @param USARTx USART Instance |
1168 | * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler |
1169 | * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF) |
1169 | * @param USARTx USART Instance |
1170 | */ |
1170 | * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF) |
1171 | __STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx) |
1171 | */ |
1172 | { |
1172 | __STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(const USART_TypeDef *USARTx) |
1173 | return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); |
1173 | { |
1174 | } |
1174 | return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); |
1175 | 1175 | } |
|
1176 | /** |
1176 | |
1177 | * @} |
1177 | /** |
1178 | */ |
1178 | * @} |
1179 | 1179 | */ |
|
1180 | /** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature |
1180 | |
1181 | * @{ |
1181 | /** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature |
1182 | */ |
1182 | * @{ |
1183 | 1183 | */ |
|
1184 | /** |
1184 | |
1185 | * @brief Enable Smartcard NACK transmission |
1185 | /** |
1186 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1186 | * @brief Enable Smartcard NACK transmission |
1187 | * Smartcard feature is supported by the USARTx instance. |
1187 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1188 | * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK |
1188 | * Smartcard feature is supported by the USARTx instance. |
1189 | * @param USARTx USART Instance |
1189 | * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK |
1190 | * @retval None |
1190 | * @param USARTx USART Instance |
1191 | */ |
1191 | * @retval None |
1192 | __STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx) |
1192 | */ |
1193 | { |
1193 | __STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx) |
1194 | SET_BIT(USARTx->CR3, USART_CR3_NACK); |
1194 | { |
1195 | } |
1195 | SET_BIT(USARTx->CR3, USART_CR3_NACK); |
1196 | 1196 | } |
|
1197 | /** |
1197 | |
1198 | * @brief Disable Smartcard NACK transmission |
1198 | /** |
1199 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1199 | * @brief Disable Smartcard NACK transmission |
1200 | * Smartcard feature is supported by the USARTx instance. |
1200 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1201 | * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK |
1201 | * Smartcard feature is supported by the USARTx instance. |
1202 | * @param USARTx USART Instance |
1202 | * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK |
1203 | * @retval None |
1203 | * @param USARTx USART Instance |
1204 | */ |
1204 | * @retval None |
1205 | __STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx) |
1205 | */ |
1206 | { |
1206 | __STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx) |
1207 | CLEAR_BIT(USARTx->CR3, USART_CR3_NACK); |
1207 | { |
1208 | } |
1208 | CLEAR_BIT(USARTx->CR3, USART_CR3_NACK); |
1209 | 1209 | } |
|
1210 | /** |
1210 | |
1211 | * @brief Indicate if Smartcard NACK transmission is enabled |
1211 | /** |
1212 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1212 | * @brief Indicate if Smartcard NACK transmission is enabled |
1213 | * Smartcard feature is supported by the USARTx instance. |
1213 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1214 | * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK |
1214 | * Smartcard feature is supported by the USARTx instance. |
1215 | * @param USARTx USART Instance |
1215 | * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK |
1216 | * @retval State of bit (1 or 0). |
1216 | * @param USARTx USART Instance |
1217 | */ |
1217 | * @retval State of bit (1 or 0). |
1218 | __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx) |
1218 | */ |
1219 | { |
1219 | __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(const USART_TypeDef *USARTx) |
1220 | return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK)); |
1220 | { |
1221 | } |
1221 | return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK)); |
1222 | 1222 | } |
|
1223 | /** |
1223 | |
1224 | * @brief Enable Smartcard mode |
1224 | /** |
1225 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1225 | * @brief Enable Smartcard mode |
1226 | * Smartcard feature is supported by the USARTx instance. |
1226 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1227 | * @rmtoll CR3 SCEN LL_USART_EnableSmartcard |
1227 | * Smartcard feature is supported by the USARTx instance. |
1228 | * @param USARTx USART Instance |
1228 | * @rmtoll CR3 SCEN LL_USART_EnableSmartcard |
1229 | * @retval None |
1229 | * @param USARTx USART Instance |
1230 | */ |
1230 | * @retval None |
1231 | __STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx) |
1231 | */ |
1232 | { |
1232 | __STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx) |
1233 | SET_BIT(USARTx->CR3, USART_CR3_SCEN); |
1233 | { |
1234 | } |
1234 | SET_BIT(USARTx->CR3, USART_CR3_SCEN); |
1235 | 1235 | } |
|
1236 | /** |
1236 | |
1237 | * @brief Disable Smartcard mode |
1237 | /** |
1238 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1238 | * @brief Disable Smartcard mode |
1239 | * Smartcard feature is supported by the USARTx instance. |
1239 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1240 | * @rmtoll CR3 SCEN LL_USART_DisableSmartcard |
1240 | * Smartcard feature is supported by the USARTx instance. |
1241 | * @param USARTx USART Instance |
1241 | * @rmtoll CR3 SCEN LL_USART_DisableSmartcard |
1242 | * @retval None |
1242 | * @param USARTx USART Instance |
1243 | */ |
1243 | * @retval None |
1244 | __STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx) |
1244 | */ |
1245 | { |
1245 | __STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx) |
1246 | CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN); |
1246 | { |
1247 | } |
1247 | CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN); |
1248 | 1248 | } |
|
1249 | /** |
1249 | |
1250 | * @brief Indicate if Smartcard mode is enabled |
1250 | /** |
1251 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1251 | * @brief Indicate if Smartcard mode is enabled |
1252 | * Smartcard feature is supported by the USARTx instance. |
1252 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1253 | * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard |
1253 | * Smartcard feature is supported by the USARTx instance. |
1254 | * @param USARTx USART Instance |
1254 | * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard |
1255 | * @retval State of bit (1 or 0). |
1255 | * @param USARTx USART Instance |
1256 | */ |
1256 | * @retval State of bit (1 or 0). |
1257 | __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx) |
1257 | */ |
1258 | { |
1258 | __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(const USART_TypeDef *USARTx) |
1259 | return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN)); |
1259 | { |
1260 | } |
1260 | return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN)); |
1261 | 1261 | } |
|
1262 | /** |
1262 | |
1263 | * @brief Set Smartcard prescaler value, used for dividing the USART clock |
1263 | /** |
1264 | * source to provide the SMARTCARD Clock (5 bits value) |
1264 | * @brief Set Smartcard prescaler value, used for dividing the USART clock |
1265 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1265 | * source to provide the SMARTCARD Clock (5 bits value) |
1266 | * Smartcard feature is supported by the USARTx instance. |
1266 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1267 | * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler |
1267 | * Smartcard feature is supported by the USARTx instance. |
1268 | * @param USARTx USART Instance |
1268 | * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler |
1269 | * @param PrescalerValue Value between Min_Data=0 and Max_Data=31 |
1269 | * @param USARTx USART Instance |
1270 | * @retval None |
1270 | * @param PrescalerValue Value between Min_Data=0 and Max_Data=31 |
1271 | */ |
1271 | * @retval None |
1272 | __STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) |
1272 | */ |
1273 | { |
1273 | __STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) |
1274 | MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); |
1274 | { |
1275 | } |
1275 | MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); |
1276 | 1276 | } |
|
1277 | /** |
1277 | |
1278 | * @brief Return Smartcard prescaler value, used for dividing the USART clock |
1278 | /** |
1279 | * source to provide the SMARTCARD Clock (5 bits value) |
1279 | * @brief Return Smartcard prescaler value, used for dividing the USART clock |
1280 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1280 | * source to provide the SMARTCARD Clock (5 bits value) |
1281 | * Smartcard feature is supported by the USARTx instance. |
1281 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1282 | * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler |
1282 | * Smartcard feature is supported by the USARTx instance. |
1283 | * @param USARTx USART Instance |
1283 | * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler |
1284 | * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31) |
1284 | * @param USARTx USART Instance |
1285 | */ |
1285 | * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31) |
1286 | __STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx) |
1286 | */ |
1287 | { |
1287 | __STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(const USART_TypeDef *USARTx) |
1288 | return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); |
1288 | { |
1289 | } |
1289 | return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); |
1290 | 1290 | } |
|
1291 | /** |
1291 | |
1292 | * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods |
1292 | /** |
1293 | * (GT[7:0] bits : Guard time value) |
1293 | * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods |
1294 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1294 | * (GT[7:0] bits : Guard time value) |
1295 | * Smartcard feature is supported by the USARTx instance. |
1295 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1296 | * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime |
1296 | * Smartcard feature is supported by the USARTx instance. |
1297 | * @param USARTx USART Instance |
1297 | * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime |
1298 | * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF |
1298 | * @param USARTx USART Instance |
1299 | * @retval None |
1299 | * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF |
1300 | */ |
1300 | * @retval None |
1301 | __STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime) |
1301 | */ |
1302 | { |
1302 | __STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime) |
1303 | MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_POSITION_GTPR_GT); |
1303 | { |
1304 | } |
1304 | MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_POSITION_GTPR_GT); |
1305 | 1305 | } |
|
1306 | /** |
1306 | |
1307 | * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods |
1307 | /** |
1308 | * (GT[7:0] bits : Guard time value) |
1308 | * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods |
1309 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1309 | * (GT[7:0] bits : Guard time value) |
1310 | * Smartcard feature is supported by the USARTx instance. |
1310 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1311 | * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime |
1311 | * Smartcard feature is supported by the USARTx instance. |
1312 | * @param USARTx USART Instance |
1312 | * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime |
1313 | * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF) |
1313 | * @param USARTx USART Instance |
1314 | */ |
1314 | * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF) |
1315 | __STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx) |
1315 | */ |
1316 | { |
1316 | __STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(const USART_TypeDef *USARTx) |
1317 | return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_POSITION_GTPR_GT); |
1317 | { |
1318 | } |
1318 | return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_POSITION_GTPR_GT); |
1319 | 1319 | } |
|
1320 | /** |
1320 | |
1321 | * @} |
1321 | /** |
1322 | */ |
1322 | * @} |
1323 | 1323 | */ |
|
1324 | /** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature |
1324 | |
1325 | * @{ |
1325 | /** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature |
1326 | */ |
1326 | * @{ |
1327 | 1327 | */ |
|
1328 | /** |
1328 | |
1329 | * @brief Enable Single Wire Half-Duplex mode |
1329 | /** |
1330 | * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1330 | * @brief Enable Single Wire Half-Duplex mode |
1331 | * Half-Duplex mode is supported by the USARTx instance. |
1331 | * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1332 | * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex |
1332 | * Half-Duplex mode is supported by the USARTx instance. |
1333 | * @param USARTx USART Instance |
1333 | * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex |
1334 | * @retval None |
1334 | * @param USARTx USART Instance |
1335 | */ |
1335 | * @retval None |
1336 | __STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx) |
1336 | */ |
1337 | { |
1337 | __STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx) |
1338 | SET_BIT(USARTx->CR3, USART_CR3_HDSEL); |
1338 | { |
1339 | } |
1339 | SET_BIT(USARTx->CR3, USART_CR3_HDSEL); |
1340 | 1340 | } |
|
1341 | /** |
1341 | |
1342 | * @brief Disable Single Wire Half-Duplex mode |
1342 | /** |
1343 | * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1343 | * @brief Disable Single Wire Half-Duplex mode |
1344 | * Half-Duplex mode is supported by the USARTx instance. |
1344 | * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1345 | * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex |
1345 | * Half-Duplex mode is supported by the USARTx instance. |
1346 | * @param USARTx USART Instance |
1346 | * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex |
1347 | * @retval None |
1347 | * @param USARTx USART Instance |
1348 | */ |
1348 | * @retval None |
1349 | __STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx) |
1349 | */ |
1350 | { |
1350 | __STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx) |
1351 | CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL); |
1351 | { |
1352 | } |
1352 | CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL); |
1353 | 1353 | } |
|
1354 | /** |
1354 | |
1355 | * @brief Indicate if Single Wire Half-Duplex mode is enabled |
1355 | /** |
1356 | * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1356 | * @brief Indicate if Single Wire Half-Duplex mode is enabled |
1357 | * Half-Duplex mode is supported by the USARTx instance. |
1357 | * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1358 | * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex |
1358 | * Half-Duplex mode is supported by the USARTx instance. |
1359 | * @param USARTx USART Instance |
1359 | * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex |
1360 | * @retval State of bit (1 or 0). |
1360 | * @param USARTx USART Instance |
1361 | */ |
1361 | * @retval State of bit (1 or 0). |
1362 | __STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx) |
1362 | */ |
1363 | { |
1363 | __STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(const USART_TypeDef *USARTx) |
1364 | return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL)); |
1364 | { |
1365 | } |
1365 | return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL)); |
1366 | 1366 | } |
|
1367 | /** |
1367 | |
1368 | * @} |
1368 | /** |
1369 | */ |
1369 | * @} |
1370 | 1370 | */ |
|
1371 | /** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature |
1371 | |
1372 | * @{ |
1372 | /** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature |
1373 | */ |
1373 | * @{ |
1374 | 1374 | */ |
|
1375 | /** |
1375 | |
1376 | * @brief Set LIN Break Detection Length |
1376 | /** |
1377 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1377 | * @brief Set LIN Break Detection Length |
1378 | * LIN feature is supported by the USARTx instance. |
1378 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1379 | * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen |
1379 | * LIN feature is supported by the USARTx instance. |
1380 | * @param USARTx USART Instance |
1380 | * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen |
1381 | * @param LINBDLength This parameter can be one of the following values: |
1381 | * @param USARTx USART Instance |
1382 | * @arg @ref LL_USART_LINBREAK_DETECT_10B |
1382 | * @param LINBDLength This parameter can be one of the following values: |
1383 | * @arg @ref LL_USART_LINBREAK_DETECT_11B |
1383 | * @arg @ref LL_USART_LINBREAK_DETECT_10B |
1384 | * @retval None |
1384 | * @arg @ref LL_USART_LINBREAK_DETECT_11B |
1385 | */ |
1385 | * @retval None |
1386 | __STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength) |
1386 | */ |
1387 | { |
1387 | __STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength) |
1388 | MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength); |
1388 | { |
1389 | } |
1389 | MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength); |
1390 | 1390 | } |
|
1391 | /** |
1391 | |
1392 | * @brief Return LIN Break Detection Length |
1392 | /** |
1393 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1393 | * @brief Return LIN Break Detection Length |
1394 | * LIN feature is supported by the USARTx instance. |
1394 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1395 | * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen |
1395 | * LIN feature is supported by the USARTx instance. |
1396 | * @param USARTx USART Instance |
1396 | * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen |
1397 | * @retval Returned value can be one of the following values: |
1397 | * @param USARTx USART Instance |
1398 | * @arg @ref LL_USART_LINBREAK_DETECT_10B |
1398 | * @retval Returned value can be one of the following values: |
1399 | * @arg @ref LL_USART_LINBREAK_DETECT_11B |
1399 | * @arg @ref LL_USART_LINBREAK_DETECT_10B |
1400 | */ |
1400 | * @arg @ref LL_USART_LINBREAK_DETECT_11B |
1401 | __STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx) |
1401 | */ |
1402 | { |
1402 | __STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(const USART_TypeDef *USARTx) |
1403 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL)); |
1403 | { |
1404 | } |
1404 | return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL)); |
1405 | 1405 | } |
|
1406 | /** |
1406 | |
1407 | * @brief Enable LIN mode |
1407 | /** |
1408 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1408 | * @brief Enable LIN mode |
1409 | * LIN feature is supported by the USARTx instance. |
1409 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1410 | * @rmtoll CR2 LINEN LL_USART_EnableLIN |
1410 | * LIN feature is supported by the USARTx instance. |
1411 | * @param USARTx USART Instance |
1411 | * @rmtoll CR2 LINEN LL_USART_EnableLIN |
1412 | * @retval None |
1412 | * @param USARTx USART Instance |
1413 | */ |
1413 | * @retval None |
1414 | __STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx) |
1414 | */ |
1415 | { |
1415 | __STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx) |
1416 | SET_BIT(USARTx->CR2, USART_CR2_LINEN); |
1416 | { |
1417 | } |
1417 | SET_BIT(USARTx->CR2, USART_CR2_LINEN); |
1418 | 1418 | } |
|
1419 | /** |
1419 | |
1420 | * @brief Disable LIN mode |
1420 | /** |
1421 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1421 | * @brief Disable LIN mode |
1422 | * LIN feature is supported by the USARTx instance. |
1422 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1423 | * @rmtoll CR2 LINEN LL_USART_DisableLIN |
1423 | * LIN feature is supported by the USARTx instance. |
1424 | * @param USARTx USART Instance |
1424 | * @rmtoll CR2 LINEN LL_USART_DisableLIN |
1425 | * @retval None |
1425 | * @param USARTx USART Instance |
1426 | */ |
1426 | * @retval None |
1427 | __STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx) |
1427 | */ |
1428 | { |
1428 | __STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx) |
1429 | CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN); |
1429 | { |
1430 | } |
1430 | CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN); |
1431 | 1431 | } |
|
1432 | /** |
1432 | |
1433 | * @brief Indicate if LIN mode is enabled |
1433 | /** |
1434 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1434 | * @brief Indicate if LIN mode is enabled |
1435 | * LIN feature is supported by the USARTx instance. |
1435 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1436 | * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN |
1436 | * LIN feature is supported by the USARTx instance. |
1437 | * @param USARTx USART Instance |
1437 | * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN |
1438 | * @retval State of bit (1 or 0). |
1438 | * @param USARTx USART Instance |
1439 | */ |
1439 | * @retval State of bit (1 or 0). |
1440 | __STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx) |
1440 | */ |
1441 | { |
1441 | __STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(const USART_TypeDef *USARTx) |
1442 | return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN)); |
1442 | { |
1443 | } |
1443 | return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN)); |
1444 | 1444 | } |
|
1445 | /** |
1445 | |
1446 | * @} |
1446 | /** |
1447 | */ |
1447 | * @} |
1448 | 1448 | */ |
|
1449 | /** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services |
1449 | |
1450 | * @{ |
1450 | /** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services |
1451 | */ |
1451 | * @{ |
1452 | 1452 | */ |
|
1453 | /** |
1453 | |
1454 | * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART) |
1454 | /** |
1455 | * @note In UART mode, the following bits must be kept cleared: |
1455 | * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART) |
1456 | * - LINEN bit in the USART_CR2 register, |
1456 | * @note In UART mode, the following bits must be kept cleared: |
1457 | * - CLKEN bit in the USART_CR2 register, |
1457 | * - LINEN bit in the USART_CR2 register, |
1458 | * - SCEN bit in the USART_CR3 register, |
1458 | * - CLKEN bit in the USART_CR2 register, |
1459 | * - IREN bit in the USART_CR3 register, |
1459 | * - SCEN bit in the USART_CR3 register, |
1460 | * - HDSEL bit in the USART_CR3 register. |
1460 | * - IREN bit in the USART_CR3 register, |
1461 | * @note Call of this function is equivalent to following function call sequence : |
1461 | * - HDSEL bit in the USART_CR3 register. |
1462 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1462 | * @note Call of this function is equivalent to following function call sequence : |
1463 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1463 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1464 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1464 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1465 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1465 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1466 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1466 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1467 | * @note Other remaining configurations items related to Asynchronous Mode |
1467 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1468 | * (as Baud Rate, Word length, Parity, ...) should be set using |
1468 | * @note Other remaining configurations items related to Asynchronous Mode |
1469 | * dedicated functions |
1469 | * (as Baud Rate, Word length, Parity, ...) should be set using |
1470 | * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n |
1470 | * dedicated functions |
1471 | * CR2 CLKEN LL_USART_ConfigAsyncMode\n |
1471 | * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n |
1472 | * CR3 SCEN LL_USART_ConfigAsyncMode\n |
1472 | * CR2 CLKEN LL_USART_ConfigAsyncMode\n |
1473 | * CR3 IREN LL_USART_ConfigAsyncMode\n |
1473 | * CR3 SCEN LL_USART_ConfigAsyncMode\n |
1474 | * CR3 HDSEL LL_USART_ConfigAsyncMode |
1474 | * CR3 IREN LL_USART_ConfigAsyncMode\n |
1475 | * @param USARTx USART Instance |
1475 | * CR3 HDSEL LL_USART_ConfigAsyncMode |
1476 | * @retval None |
1476 | * @param USARTx USART Instance |
1477 | */ |
1477 | * @retval None |
1478 | __STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx) |
1478 | */ |
1479 | { |
1479 | __STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx) |
1480 | /* In Asynchronous mode, the following bits must be kept cleared: |
1480 | { |
1481 | - LINEN, CLKEN bits in the USART_CR2 register, |
1481 | /* In Asynchronous mode, the following bits must be kept cleared: |
1482 | - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ |
1482 | - LINEN, CLKEN bits in the USART_CR2 register, |
1483 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); |
1483 | - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ |
1484 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); |
1484 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); |
1485 | } |
1485 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); |
1486 | 1486 | } |
|
1487 | /** |
1487 | |
1488 | * @brief Perform basic configuration of USART for enabling use in Synchronous Mode |
1488 | /** |
1489 | * @note In Synchronous mode, the following bits must be kept cleared: |
1489 | * @brief Perform basic configuration of USART for enabling use in Synchronous Mode |
1490 | * - LINEN bit in the USART_CR2 register, |
1490 | * @note In Synchronous mode, the following bits must be kept cleared: |
1491 | * - SCEN bit in the USART_CR3 register, |
1491 | * - LINEN bit in the USART_CR2 register, |
1492 | * - IREN bit in the USART_CR3 register, |
1492 | * - SCEN bit in the USART_CR3 register, |
1493 | * - HDSEL bit in the USART_CR3 register. |
1493 | * - IREN bit in the USART_CR3 register, |
1494 | * This function also sets the USART in Synchronous mode. |
1494 | * - HDSEL bit in the USART_CR3 register. |
1495 | * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not |
1495 | * This function also sets the USART in Synchronous mode. |
1496 | * Synchronous mode is supported by the USARTx instance. |
1496 | * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not |
1497 | * @note Call of this function is equivalent to following function call sequence : |
1497 | * Synchronous mode is supported by the USARTx instance. |
1498 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1498 | * @note Call of this function is equivalent to following function call sequence : |
1499 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1499 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1500 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1500 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1501 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1501 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1502 | * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function |
1502 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1503 | * @note Other remaining configurations items related to Synchronous Mode |
1503 | * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function |
1504 | * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using |
1504 | * @note Other remaining configurations items related to Synchronous Mode |
1505 | * dedicated functions |
1505 | * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using |
1506 | * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n |
1506 | * dedicated functions |
1507 | * CR2 CLKEN LL_USART_ConfigSyncMode\n |
1507 | * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n |
1508 | * CR3 SCEN LL_USART_ConfigSyncMode\n |
1508 | * CR2 CLKEN LL_USART_ConfigSyncMode\n |
1509 | * CR3 IREN LL_USART_ConfigSyncMode\n |
1509 | * CR3 SCEN LL_USART_ConfigSyncMode\n |
1510 | * CR3 HDSEL LL_USART_ConfigSyncMode |
1510 | * CR3 IREN LL_USART_ConfigSyncMode\n |
1511 | * @param USARTx USART Instance |
1511 | * CR3 HDSEL LL_USART_ConfigSyncMode |
1512 | * @retval None |
1512 | * @param USARTx USART Instance |
1513 | */ |
1513 | * @retval None |
1514 | __STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx) |
1514 | */ |
1515 | { |
1515 | __STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx) |
1516 | /* In Synchronous mode, the following bits must be kept cleared: |
1516 | { |
1517 | - LINEN bit in the USART_CR2 register, |
1517 | /* In Synchronous mode, the following bits must be kept cleared: |
1518 | - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ |
1518 | - LINEN bit in the USART_CR2 register, |
1519 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); |
1519 | - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ |
1520 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); |
1520 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); |
1521 | /* set the UART/USART in Synchronous mode */ |
1521 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); |
1522 | SET_BIT(USARTx->CR2, USART_CR2_CLKEN); |
1522 | /* set the UART/USART in Synchronous mode */ |
1523 | } |
1523 | SET_BIT(USARTx->CR2, USART_CR2_CLKEN); |
1524 | 1524 | } |
|
1525 | /** |
1525 | |
1526 | * @brief Perform basic configuration of USART for enabling use in LIN Mode |
1526 | /** |
1527 | * @note In LIN mode, the following bits must be kept cleared: |
1527 | * @brief Perform basic configuration of USART for enabling use in LIN Mode |
1528 | * - STOP and CLKEN bits in the USART_CR2 register, |
1528 | * @note In LIN mode, the following bits must be kept cleared: |
1529 | * - SCEN bit in the USART_CR3 register, |
1529 | * - STOP and CLKEN bits in the USART_CR2 register, |
1530 | * - IREN bit in the USART_CR3 register, |
1530 | * - SCEN bit in the USART_CR3 register, |
1531 | * - HDSEL bit in the USART_CR3 register. |
1531 | * - IREN bit in the USART_CR3 register, |
1532 | * This function also set the UART/USART in LIN mode. |
1532 | * - HDSEL bit in the USART_CR3 register. |
1533 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1533 | * This function also set the UART/USART in LIN mode. |
1534 | * LIN feature is supported by the USARTx instance. |
1534 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1535 | * @note Call of this function is equivalent to following function call sequence : |
1535 | * LIN feature is supported by the USARTx instance. |
1536 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1536 | * @note Call of this function is equivalent to following function call sequence : |
1537 | * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function |
1537 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1538 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1538 | * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function |
1539 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1539 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1540 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1540 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1541 | * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function |
1541 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1542 | * @note Other remaining configurations items related to LIN Mode |
1542 | * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function |
1543 | * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using |
1543 | * @note Other remaining configurations items related to LIN Mode |
1544 | * dedicated functions |
1544 | * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using |
1545 | * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n |
1545 | * dedicated functions |
1546 | * CR2 STOP LL_USART_ConfigLINMode\n |
1546 | * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n |
1547 | * CR2 LINEN LL_USART_ConfigLINMode\n |
1547 | * CR2 STOP LL_USART_ConfigLINMode\n |
1548 | * CR3 IREN LL_USART_ConfigLINMode\n |
1548 | * CR2 LINEN LL_USART_ConfigLINMode\n |
1549 | * CR3 SCEN LL_USART_ConfigLINMode\n |
1549 | * CR3 IREN LL_USART_ConfigLINMode\n |
1550 | * CR3 HDSEL LL_USART_ConfigLINMode |
1550 | * CR3 SCEN LL_USART_ConfigLINMode\n |
1551 | * @param USARTx USART Instance |
1551 | * CR3 HDSEL LL_USART_ConfigLINMode |
1552 | * @retval None |
1552 | * @param USARTx USART Instance |
1553 | */ |
1553 | * @retval None |
1554 | __STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx) |
1554 | */ |
1555 | { |
1555 | __STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx) |
1556 | /* In LIN mode, the following bits must be kept cleared: |
1556 | { |
1557 | - STOP and CLKEN bits in the USART_CR2 register, |
1557 | /* In LIN mode, the following bits must be kept cleared: |
1558 | - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ |
1558 | - STOP and CLKEN bits in the USART_CR2 register, |
1559 | CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP)); |
1559 | - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ |
1560 | CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL)); |
1560 | CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP)); |
1561 | /* Set the UART/USART in LIN mode */ |
1561 | CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL)); |
1562 | SET_BIT(USARTx->CR2, USART_CR2_LINEN); |
1562 | /* Set the UART/USART in LIN mode */ |
1563 | } |
1563 | SET_BIT(USARTx->CR2, USART_CR2_LINEN); |
1564 | 1564 | } |
|
1565 | /** |
1565 | |
1566 | * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode |
1566 | /** |
1567 | * @note In Half Duplex mode, the following bits must be kept cleared: |
1567 | * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode |
1568 | * - LINEN bit in the USART_CR2 register, |
1568 | * @note In Half Duplex mode, the following bits must be kept cleared: |
1569 | * - CLKEN bit in the USART_CR2 register, |
1569 | * - LINEN bit in the USART_CR2 register, |
1570 | * - SCEN bit in the USART_CR3 register, |
1570 | * - CLKEN bit in the USART_CR2 register, |
1571 | * - IREN bit in the USART_CR3 register, |
1571 | * - SCEN bit in the USART_CR3 register, |
1572 | * This function also sets the UART/USART in Half Duplex mode. |
1572 | * - IREN bit in the USART_CR3 register, |
1573 | * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1573 | * This function also sets the UART/USART in Half Duplex mode. |
1574 | * Half-Duplex mode is supported by the USARTx instance. |
1574 | * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not |
1575 | * @note Call of this function is equivalent to following function call sequence : |
1575 | * Half-Duplex mode is supported by the USARTx instance. |
1576 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1576 | * @note Call of this function is equivalent to following function call sequence : |
1577 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1577 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1578 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1578 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1579 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1579 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1580 | * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function |
1580 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1581 | * @note Other remaining configurations items related to Half Duplex Mode |
1581 | * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function |
1582 | * (as Baud Rate, Word length, Parity, ...) should be set using |
1582 | * @note Other remaining configurations items related to Half Duplex Mode |
1583 | * dedicated functions |
1583 | * (as Baud Rate, Word length, Parity, ...) should be set using |
1584 | * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n |
1584 | * dedicated functions |
1585 | * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n |
1585 | * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n |
1586 | * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n |
1586 | * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n |
1587 | * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n |
1587 | * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n |
1588 | * CR3 IREN LL_USART_ConfigHalfDuplexMode |
1588 | * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n |
1589 | * @param USARTx USART Instance |
1589 | * CR3 IREN LL_USART_ConfigHalfDuplexMode |
1590 | * @retval None |
1590 | * @param USARTx USART Instance |
1591 | */ |
1591 | * @retval None |
1592 | __STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx) |
1592 | */ |
1593 | { |
1593 | __STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx) |
1594 | /* In Half Duplex mode, the following bits must be kept cleared: |
1594 | { |
1595 | - LINEN and CLKEN bits in the USART_CR2 register, |
1595 | /* In Half Duplex mode, the following bits must be kept cleared: |
1596 | - SCEN and IREN bits in the USART_CR3 register.*/ |
1596 | - LINEN and CLKEN bits in the USART_CR2 register, |
1597 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); |
1597 | - SCEN and IREN bits in the USART_CR3 register.*/ |
1598 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN)); |
1598 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); |
1599 | /* set the UART/USART in Half Duplex mode */ |
1599 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN)); |
1600 | SET_BIT(USARTx->CR3, USART_CR3_HDSEL); |
1600 | /* set the UART/USART in Half Duplex mode */ |
1601 | } |
1601 | SET_BIT(USARTx->CR3, USART_CR3_HDSEL); |
1602 | 1602 | } |
|
1603 | /** |
1603 | |
1604 | * @brief Perform basic configuration of USART for enabling use in Smartcard Mode |
1604 | /** |
1605 | * @note In Smartcard mode, the following bits must be kept cleared: |
1605 | * @brief Perform basic configuration of USART for enabling use in Smartcard Mode |
1606 | * - LINEN bit in the USART_CR2 register, |
1606 | * @note In Smartcard mode, the following bits must be kept cleared: |
1607 | * - IREN bit in the USART_CR3 register, |
1607 | * - LINEN bit in the USART_CR2 register, |
1608 | * - HDSEL bit in the USART_CR3 register. |
1608 | * - IREN bit in the USART_CR3 register, |
1609 | * This function also configures Stop bits to 1.5 bits and |
1609 | * - HDSEL bit in the USART_CR3 register. |
1610 | * sets the USART in Smartcard mode (SCEN bit). |
1610 | * This function also configures Stop bits to 1.5 bits and |
1611 | * Clock Output is also enabled (CLKEN). |
1611 | * sets the USART in Smartcard mode (SCEN bit). |
1612 | * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1612 | * Clock Output is also enabled (CLKEN). |
1613 | * Smartcard feature is supported by the USARTx instance. |
1613 | * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not |
1614 | * @note Call of this function is equivalent to following function call sequence : |
1614 | * Smartcard feature is supported by the USARTx instance. |
1615 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1615 | * @note Call of this function is equivalent to following function call sequence : |
1616 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1616 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1617 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1617 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1618 | * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function |
1618 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1619 | * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function |
1619 | * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function |
1620 | * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function |
1620 | * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function |
1621 | * @note Other remaining configurations items related to Smartcard Mode |
1621 | * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function |
1622 | * (as Baud Rate, Word length, Parity, ...) should be set using |
1622 | * @note Other remaining configurations items related to Smartcard Mode |
1623 | * dedicated functions |
1623 | * (as Baud Rate, Word length, Parity, ...) should be set using |
1624 | * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n |
1624 | * dedicated functions |
1625 | * CR2 STOP LL_USART_ConfigSmartcardMode\n |
1625 | * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n |
1626 | * CR2 CLKEN LL_USART_ConfigSmartcardMode\n |
1626 | * CR2 STOP LL_USART_ConfigSmartcardMode\n |
1627 | * CR3 HDSEL LL_USART_ConfigSmartcardMode\n |
1627 | * CR2 CLKEN LL_USART_ConfigSmartcardMode\n |
1628 | * CR3 SCEN LL_USART_ConfigSmartcardMode |
1628 | * CR3 HDSEL LL_USART_ConfigSmartcardMode\n |
1629 | * @param USARTx USART Instance |
1629 | * CR3 SCEN LL_USART_ConfigSmartcardMode |
1630 | * @retval None |
1630 | * @param USARTx USART Instance |
1631 | */ |
1631 | * @retval None |
1632 | __STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx) |
1632 | */ |
1633 | { |
1633 | __STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx) |
1634 | /* In Smartcard mode, the following bits must be kept cleared: |
1634 | { |
1635 | - LINEN bit in the USART_CR2 register, |
1635 | /* In Smartcard mode, the following bits must be kept cleared: |
1636 | - IREN and HDSEL bits in the USART_CR3 register.*/ |
1636 | - LINEN bit in the USART_CR2 register, |
1637 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); |
1637 | - IREN and HDSEL bits in the USART_CR3 register.*/ |
1638 | CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL)); |
1638 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); |
1639 | /* Configure Stop bits to 1.5 bits */ |
1639 | CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL)); |
1640 | /* Synchronous mode is activated by default */ |
1640 | /* Configure Stop bits to 1.5 bits */ |
1641 | SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN)); |
1641 | /* Synchronous mode is activated by default */ |
1642 | /* set the UART/USART in Smartcard mode */ |
1642 | SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN)); |
1643 | SET_BIT(USARTx->CR3, USART_CR3_SCEN); |
1643 | /* set the UART/USART in Smartcard mode */ |
1644 | } |
1644 | SET_BIT(USARTx->CR3, USART_CR3_SCEN); |
1645 | 1645 | } |
|
1646 | /** |
1646 | |
1647 | * @brief Perform basic configuration of USART for enabling use in Irda Mode |
1647 | /** |
1648 | * @note In IRDA mode, the following bits must be kept cleared: |
1648 | * @brief Perform basic configuration of USART for enabling use in Irda Mode |
1649 | * - LINEN bit in the USART_CR2 register, |
1649 | * @note In IRDA mode, the following bits must be kept cleared: |
1650 | * - STOP and CLKEN bits in the USART_CR2 register, |
1650 | * - LINEN bit in the USART_CR2 register, |
1651 | * - SCEN bit in the USART_CR3 register, |
1651 | * - STOP and CLKEN bits in the USART_CR2 register, |
1652 | * - HDSEL bit in the USART_CR3 register. |
1652 | * - SCEN bit in the USART_CR3 register, |
1653 | * This function also sets the UART/USART in IRDA mode (IREN bit). |
1653 | * - HDSEL bit in the USART_CR3 register. |
1654 | * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1654 | * This function also sets the UART/USART in IRDA mode (IREN bit). |
1655 | * IrDA feature is supported by the USARTx instance. |
1655 | * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not |
1656 | * @note Call of this function is equivalent to following function call sequence : |
1656 | * IrDA feature is supported by the USARTx instance. |
1657 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1657 | * @note Call of this function is equivalent to following function call sequence : |
1658 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1658 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1659 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1659 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1660 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1660 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1661 | * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function |
1661 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1662 | * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function |
1662 | * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function |
1663 | * @note Other remaining configurations items related to Irda Mode |
1663 | * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function |
1664 | * (as Baud Rate, Word length, Power mode, ...) should be set using |
1664 | * @note Other remaining configurations items related to Irda Mode |
1665 | * dedicated functions |
1665 | * (as Baud Rate, Word length, Power mode, ...) should be set using |
1666 | * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n |
1666 | * dedicated functions |
1667 | * CR2 CLKEN LL_USART_ConfigIrdaMode\n |
1667 | * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n |
1668 | * CR2 STOP LL_USART_ConfigIrdaMode\n |
1668 | * CR2 CLKEN LL_USART_ConfigIrdaMode\n |
1669 | * CR3 SCEN LL_USART_ConfigIrdaMode\n |
1669 | * CR2 STOP LL_USART_ConfigIrdaMode\n |
1670 | * CR3 HDSEL LL_USART_ConfigIrdaMode\n |
1670 | * CR3 SCEN LL_USART_ConfigIrdaMode\n |
1671 | * CR3 IREN LL_USART_ConfigIrdaMode |
1671 | * CR3 HDSEL LL_USART_ConfigIrdaMode\n |
1672 | * @param USARTx USART Instance |
1672 | * CR3 IREN LL_USART_ConfigIrdaMode |
1673 | * @retval None |
1673 | * @param USARTx USART Instance |
1674 | */ |
1674 | * @retval None |
1675 | __STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx) |
1675 | */ |
1676 | { |
1676 | __STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx) |
1677 | /* In IRDA mode, the following bits must be kept cleared: |
1677 | { |
1678 | - LINEN, STOP and CLKEN bits in the USART_CR2 register, |
1678 | /* In IRDA mode, the following bits must be kept cleared: |
1679 | - SCEN and HDSEL bits in the USART_CR3 register.*/ |
1679 | - LINEN, STOP and CLKEN bits in the USART_CR2 register, |
1680 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP)); |
1680 | - SCEN and HDSEL bits in the USART_CR3 register.*/ |
1681 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL)); |
1681 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP)); |
1682 | /* set the UART/USART in IRDA mode */ |
1682 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL)); |
1683 | SET_BIT(USARTx->CR3, USART_CR3_IREN); |
1683 | /* set the UART/USART in IRDA mode */ |
1684 | } |
1684 | SET_BIT(USARTx->CR3, USART_CR3_IREN); |
1685 | 1685 | } |
|
1686 | /** |
1686 | |
1687 | * @brief Perform basic configuration of USART for enabling use in Multi processor Mode |
1687 | /** |
1688 | * (several USARTs connected in a network, one of the USARTs can be the master, |
1688 | * @brief Perform basic configuration of USART for enabling use in Multi processor Mode |
1689 | * its TX output connected to the RX inputs of the other slaves USARTs). |
1689 | * (several USARTs connected in a network, one of the USARTs can be the master, |
1690 | * @note In MultiProcessor mode, the following bits must be kept cleared: |
1690 | * its TX output connected to the RX inputs of the other slaves USARTs). |
1691 | * - LINEN bit in the USART_CR2 register, |
1691 | * @note In MultiProcessor mode, the following bits must be kept cleared: |
1692 | * - CLKEN bit in the USART_CR2 register, |
1692 | * - LINEN bit in the USART_CR2 register, |
1693 | * - SCEN bit in the USART_CR3 register, |
1693 | * - CLKEN bit in the USART_CR2 register, |
1694 | * - IREN bit in the USART_CR3 register, |
1694 | * - SCEN bit in the USART_CR3 register, |
1695 | * - HDSEL bit in the USART_CR3 register. |
1695 | * - IREN bit in the USART_CR3 register, |
1696 | * @note Call of this function is equivalent to following function call sequence : |
1696 | * - HDSEL bit in the USART_CR3 register. |
1697 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1697 | * @note Call of this function is equivalent to following function call sequence : |
1698 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1698 | * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function |
1699 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1699 | * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function |
1700 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1700 | * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function |
1701 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1701 | * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function |
1702 | * @note Other remaining configurations items related to Multi processor Mode |
1702 | * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function |
1703 | * (as Baud Rate, Wake Up Method, Node address, ...) should be set using |
1703 | * @note Other remaining configurations items related to Multi processor Mode |
1704 | * dedicated functions |
1704 | * (as Baud Rate, Wake Up Method, Node address, ...) should be set using |
1705 | * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n |
1705 | * dedicated functions |
1706 | * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n |
1706 | * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n |
1707 | * CR3 SCEN LL_USART_ConfigMultiProcessMode\n |
1707 | * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n |
1708 | * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n |
1708 | * CR3 SCEN LL_USART_ConfigMultiProcessMode\n |
1709 | * CR3 IREN LL_USART_ConfigMultiProcessMode |
1709 | * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n |
1710 | * @param USARTx USART Instance |
1710 | * CR3 IREN LL_USART_ConfigMultiProcessMode |
1711 | * @retval None |
1711 | * @param USARTx USART Instance |
1712 | */ |
1712 | * @retval None |
1713 | __STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx) |
1713 | */ |
1714 | { |
1714 | __STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx) |
1715 | /* In Multi Processor mode, the following bits must be kept cleared: |
1715 | { |
1716 | - LINEN and CLKEN bits in the USART_CR2 register, |
1716 | /* In Multi Processor mode, the following bits must be kept cleared: |
1717 | - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ |
1717 | - LINEN and CLKEN bits in the USART_CR2 register, |
1718 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); |
1718 | - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ |
1719 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); |
1719 | CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); |
1720 | } |
1720 | CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); |
1721 | 1721 | } |
|
1722 | /** |
1722 | |
1723 | * @} |
1723 | /** |
1724 | */ |
1724 | * @} |
1725 | 1725 | */ |
|
1726 | /** @defgroup USART_LL_EF_FLAG_Management FLAG_Management |
1726 | |
1727 | * @{ |
1727 | /** @defgroup USART_LL_EF_FLAG_Management FLAG_Management |
1728 | */ |
1728 | * @{ |
1729 | 1729 | */ |
|
1730 | /** |
1730 | |
1731 | * @brief Check if the USART Parity Error Flag is set or not |
1731 | /** |
1732 | * @rmtoll SR PE LL_USART_IsActiveFlag_PE |
1732 | * @brief Check if the USART Parity Error Flag is set or not |
1733 | * @param USARTx USART Instance |
1733 | * @rmtoll SR PE LL_USART_IsActiveFlag_PE |
1734 | * @retval State of bit (1 or 0). |
1734 | * @param USARTx USART Instance |
1735 | */ |
1735 | * @retval State of bit (1 or 0). |
1736 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx) |
1736 | */ |
1737 | { |
1737 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(const USART_TypeDef *USARTx) |
1738 | return (READ_BIT(USARTx->SR, USART_SR_PE) == (USART_SR_PE)); |
1738 | { |
1739 | } |
1739 | return (READ_BIT(USARTx->SR, USART_SR_PE) == (USART_SR_PE)); |
1740 | 1740 | } |
|
1741 | /** |
1741 | |
1742 | * @brief Check if the USART Framing Error Flag is set or not |
1742 | /** |
1743 | * @rmtoll SR FE LL_USART_IsActiveFlag_FE |
1743 | * @brief Check if the USART Framing Error Flag is set or not |
1744 | * @param USARTx USART Instance |
1744 | * @rmtoll SR FE LL_USART_IsActiveFlag_FE |
1745 | * @retval State of bit (1 or 0). |
1745 | * @param USARTx USART Instance |
1746 | */ |
1746 | * @retval State of bit (1 or 0). |
1747 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx) |
1747 | */ |
1748 | { |
1748 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(const USART_TypeDef *USARTx) |
1749 | return (READ_BIT(USARTx->SR, USART_SR_FE) == (USART_SR_FE)); |
1749 | { |
1750 | } |
1750 | return (READ_BIT(USARTx->SR, USART_SR_FE) == (USART_SR_FE)); |
1751 | 1751 | } |
|
1752 | /** |
1752 | |
1753 | * @brief Check if the USART Noise error detected Flag is set or not |
1753 | /** |
1754 | * @rmtoll SR NF LL_USART_IsActiveFlag_NE |
1754 | * @brief Check if the USART Noise error detected Flag is set or not |
1755 | * @param USARTx USART Instance |
1755 | * @rmtoll SR NF LL_USART_IsActiveFlag_NE |
1756 | * @retval State of bit (1 or 0). |
1756 | * @param USARTx USART Instance |
1757 | */ |
1757 | * @retval State of bit (1 or 0). |
1758 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx) |
1758 | */ |
1759 | { |
1759 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(const USART_TypeDef *USARTx) |
1760 | return (READ_BIT(USARTx->SR, USART_SR_NE) == (USART_SR_NE)); |
1760 | { |
1761 | } |
1761 | return (READ_BIT(USARTx->SR, USART_SR_NE) == (USART_SR_NE)); |
1762 | 1762 | } |
|
1763 | /** |
1763 | |
1764 | * @brief Check if the USART OverRun Error Flag is set or not |
1764 | /** |
1765 | * @rmtoll SR ORE LL_USART_IsActiveFlag_ORE |
1765 | * @brief Check if the USART OverRun Error Flag is set or not |
1766 | * @param USARTx USART Instance |
1766 | * @rmtoll SR ORE LL_USART_IsActiveFlag_ORE |
1767 | * @retval State of bit (1 or 0). |
1767 | * @param USARTx USART Instance |
1768 | */ |
1768 | * @retval State of bit (1 or 0). |
1769 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx) |
1769 | */ |
1770 | { |
1770 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(const USART_TypeDef *USARTx) |
1771 | return (READ_BIT(USARTx->SR, USART_SR_ORE) == (USART_SR_ORE)); |
1771 | { |
1772 | } |
1772 | return (READ_BIT(USARTx->SR, USART_SR_ORE) == (USART_SR_ORE)); |
1773 | 1773 | } |
|
1774 | /** |
1774 | |
1775 | * @brief Check if the USART IDLE line detected Flag is set or not |
1775 | /** |
1776 | * @rmtoll SR IDLE LL_USART_IsActiveFlag_IDLE |
1776 | * @brief Check if the USART IDLE line detected Flag is set or not |
1777 | * @param USARTx USART Instance |
1777 | * @rmtoll SR IDLE LL_USART_IsActiveFlag_IDLE |
1778 | * @retval State of bit (1 or 0). |
1778 | * @param USARTx USART Instance |
1779 | */ |
1779 | * @retval State of bit (1 or 0). |
1780 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx) |
1780 | */ |
1781 | { |
1781 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(const USART_TypeDef *USARTx) |
1782 | return (READ_BIT(USARTx->SR, USART_SR_IDLE) == (USART_SR_IDLE)); |
1782 | { |
1783 | } |
1783 | return (READ_BIT(USARTx->SR, USART_SR_IDLE) == (USART_SR_IDLE)); |
1784 | 1784 | } |
|
1785 | /** |
1785 | |
1786 | * @brief Check if the USART Read Data Register Not Empty Flag is set or not |
1786 | /** |
1787 | * @rmtoll SR RXNE LL_USART_IsActiveFlag_RXNE |
1787 | * @brief Check if the USART Read Data Register Not Empty Flag is set or not |
1788 | * @param USARTx USART Instance |
1788 | * @rmtoll SR RXNE LL_USART_IsActiveFlag_RXNE |
1789 | * @retval State of bit (1 or 0). |
1789 | * @param USARTx USART Instance |
1790 | */ |
1790 | * @retval State of bit (1 or 0). |
1791 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx) |
1791 | */ |
1792 | { |
1792 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(const USART_TypeDef *USARTx) |
1793 | return (READ_BIT(USARTx->SR, USART_SR_RXNE) == (USART_SR_RXNE)); |
1793 | { |
1794 | } |
1794 | return (READ_BIT(USARTx->SR, USART_SR_RXNE) == (USART_SR_RXNE)); |
1795 | 1795 | } |
|
1796 | /** |
1796 | |
1797 | * @brief Check if the USART Transmission Complete Flag is set or not |
1797 | /** |
1798 | * @rmtoll SR TC LL_USART_IsActiveFlag_TC |
1798 | * @brief Check if the USART Transmission Complete Flag is set or not |
1799 | * @param USARTx USART Instance |
1799 | * @rmtoll SR TC LL_USART_IsActiveFlag_TC |
1800 | * @retval State of bit (1 or 0). |
1800 | * @param USARTx USART Instance |
1801 | */ |
1801 | * @retval State of bit (1 or 0). |
1802 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx) |
1802 | */ |
1803 | { |
1803 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(const USART_TypeDef *USARTx) |
1804 | return (READ_BIT(USARTx->SR, USART_SR_TC) == (USART_SR_TC)); |
1804 | { |
1805 | } |
1805 | return (READ_BIT(USARTx->SR, USART_SR_TC) == (USART_SR_TC)); |
1806 | 1806 | } |
|
1807 | /** |
1807 | |
1808 | * @brief Check if the USART Transmit Data Register Empty Flag is set or not |
1808 | /** |
1809 | * @rmtoll SR TXE LL_USART_IsActiveFlag_TXE |
1809 | * @brief Check if the USART Transmit Data Register Empty Flag is set or not |
1810 | * @param USARTx USART Instance |
1810 | * @rmtoll SR TXE LL_USART_IsActiveFlag_TXE |
1811 | * @retval State of bit (1 or 0). |
1811 | * @param USARTx USART Instance |
1812 | */ |
1812 | * @retval State of bit (1 or 0). |
1813 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx) |
1813 | */ |
1814 | { |
1814 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(const USART_TypeDef *USARTx) |
1815 | return (READ_BIT(USARTx->SR, USART_SR_TXE) == (USART_SR_TXE)); |
1815 | { |
1816 | } |
1816 | return (READ_BIT(USARTx->SR, USART_SR_TXE) == (USART_SR_TXE)); |
1817 | 1817 | } |
|
1818 | /** |
1818 | |
1819 | * @brief Check if the USART LIN Break Detection Flag is set or not |
1819 | /** |
1820 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1820 | * @brief Check if the USART LIN Break Detection Flag is set or not |
1821 | * LIN feature is supported by the USARTx instance. |
1821 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1822 | * @rmtoll SR LBD LL_USART_IsActiveFlag_LBD |
1822 | * LIN feature is supported by the USARTx instance. |
1823 | * @param USARTx USART Instance |
1823 | * @rmtoll SR LBD LL_USART_IsActiveFlag_LBD |
1824 | * @retval State of bit (1 or 0). |
1824 | * @param USARTx USART Instance |
1825 | */ |
1825 | * @retval State of bit (1 or 0). |
1826 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx) |
1826 | */ |
1827 | { |
1827 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(const USART_TypeDef *USARTx) |
1828 | return (READ_BIT(USARTx->SR, USART_SR_LBD) == (USART_SR_LBD)); |
1828 | { |
1829 | } |
1829 | return (READ_BIT(USARTx->SR, USART_SR_LBD) == (USART_SR_LBD)); |
1830 | 1830 | } |
|
1831 | /** |
1831 | |
1832 | * @brief Check if the USART CTS Flag is set or not |
1832 | /** |
1833 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
1833 | * @brief Check if the USART CTS Flag is set or not |
1834 | * Hardware Flow control feature is supported by the USARTx instance. |
1834 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
1835 | * @rmtoll SR CTS LL_USART_IsActiveFlag_nCTS |
1835 | * Hardware Flow control feature is supported by the USARTx instance. |
1836 | * @param USARTx USART Instance |
1836 | * @rmtoll SR CTS LL_USART_IsActiveFlag_nCTS |
1837 | * @retval State of bit (1 or 0). |
1837 | * @param USARTx USART Instance |
1838 | */ |
1838 | * @retval State of bit (1 or 0). |
1839 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx) |
1839 | */ |
1840 | { |
1840 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(const USART_TypeDef *USARTx) |
1841 | return (READ_BIT(USARTx->SR, USART_SR_CTS) == (USART_SR_CTS)); |
1841 | { |
1842 | } |
1842 | return (READ_BIT(USARTx->SR, USART_SR_CTS) == (USART_SR_CTS)); |
1843 | 1843 | } |
|
1844 | /** |
1844 | |
1845 | * @brief Check if the USART Send Break Flag is set or not |
1845 | /** |
1846 | * @rmtoll CR1 SBK LL_USART_IsActiveFlag_SBK |
1846 | * @brief Check if the USART Send Break Flag is set or not |
1847 | * @param USARTx USART Instance |
1847 | * @rmtoll CR1 SBK LL_USART_IsActiveFlag_SBK |
1848 | * @retval State of bit (1 or 0). |
1848 | * @param USARTx USART Instance |
1849 | */ |
1849 | * @retval State of bit (1 or 0). |
1850 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx) |
1850 | */ |
1851 | { |
1851 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(const USART_TypeDef *USARTx) |
1852 | return (READ_BIT(USARTx->CR1, USART_CR1_SBK) == (USART_CR1_SBK)); |
1852 | { |
1853 | } |
1853 | return (READ_BIT(USARTx->CR1, USART_CR1_SBK) == (USART_CR1_SBK)); |
1854 | 1854 | } |
|
1855 | /** |
1855 | |
1856 | * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not |
1856 | /** |
1857 | * @rmtoll CR1 RWU LL_USART_IsActiveFlag_RWU |
1857 | * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not |
1858 | * @param USARTx USART Instance |
1858 | * @rmtoll CR1 RWU LL_USART_IsActiveFlag_RWU |
1859 | * @retval State of bit (1 or 0). |
1859 | * @param USARTx USART Instance |
1860 | */ |
1860 | * @retval State of bit (1 or 0). |
1861 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx) |
1861 | */ |
1862 | { |
1862 | __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(const USART_TypeDef *USARTx) |
1863 | return (READ_BIT(USARTx->CR1, USART_CR1_RWU) == (USART_CR1_RWU)); |
1863 | { |
1864 | } |
1864 | return (READ_BIT(USARTx->CR1, USART_CR1_RWU) == (USART_CR1_RWU)); |
1865 | 1865 | } |
|
1866 | /** |
1866 | |
1867 | * @brief Clear Parity Error Flag |
1867 | /** |
1868 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1868 | * @brief Clear Parity Error Flag |
1869 | * register followed by a read access to the USARTx_DR register. |
1869 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1870 | * @note Please also consider that when clearing this flag, other flags as |
1870 | * register followed by a read access to the USARTx_DR register. |
1871 | * NE, FE, ORE, IDLE would also be cleared. |
1871 | * @note Please also consider that when clearing this flag, other flags as |
1872 | * @rmtoll SR PE LL_USART_ClearFlag_PE |
1872 | * NE, FE, ORE, IDLE would also be cleared. |
1873 | * @param USARTx USART Instance |
1873 | * @rmtoll SR PE LL_USART_ClearFlag_PE |
1874 | * @retval None |
1874 | * @param USARTx USART Instance |
1875 | */ |
1875 | * @retval None |
1876 | __STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx) |
1876 | */ |
1877 | { |
1877 | __STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx) |
1878 | __IO uint32_t tmpreg; |
1878 | { |
1879 | tmpreg = USARTx->SR; |
1879 | __IO uint32_t tmpreg; |
1880 | (void) tmpreg; |
1880 | tmpreg = USARTx->SR; |
1881 | tmpreg = USARTx->DR; |
1881 | (void) tmpreg; |
1882 | (void) tmpreg; |
1882 | tmpreg = USARTx->DR; |
1883 | } |
1883 | (void) tmpreg; |
1884 | 1884 | } |
|
1885 | /** |
1885 | |
1886 | * @brief Clear Framing Error Flag |
1886 | /** |
1887 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1887 | * @brief Clear Framing Error Flag |
1888 | * register followed by a read access to the USARTx_DR register. |
1888 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1889 | * @note Please also consider that when clearing this flag, other flags as |
1889 | * register followed by a read access to the USARTx_DR register. |
1890 | * PE, NE, ORE, IDLE would also be cleared. |
1890 | * @note Please also consider that when clearing this flag, other flags as |
1891 | * @rmtoll SR FE LL_USART_ClearFlag_FE |
1891 | * PE, NE, ORE, IDLE would also be cleared. |
1892 | * @param USARTx USART Instance |
1892 | * @rmtoll SR FE LL_USART_ClearFlag_FE |
1893 | * @retval None |
1893 | * @param USARTx USART Instance |
1894 | */ |
1894 | * @retval None |
1895 | __STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx) |
1895 | */ |
1896 | { |
1896 | __STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx) |
1897 | __IO uint32_t tmpreg; |
1897 | { |
1898 | tmpreg = USARTx->SR; |
1898 | __IO uint32_t tmpreg; |
1899 | (void) tmpreg; |
1899 | tmpreg = USARTx->SR; |
1900 | tmpreg = USARTx->DR; |
1900 | (void) tmpreg; |
1901 | (void) tmpreg; |
1901 | tmpreg = USARTx->DR; |
1902 | } |
1902 | (void) tmpreg; |
1903 | 1903 | } |
|
1904 | /** |
1904 | |
1905 | * @brief Clear Noise detected Flag |
1905 | /** |
1906 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1906 | * @brief Clear Noise detected Flag |
1907 | * register followed by a read access to the USARTx_DR register. |
1907 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1908 | * @note Please also consider that when clearing this flag, other flags as |
1908 | * register followed by a read access to the USARTx_DR register. |
1909 | * PE, FE, ORE, IDLE would also be cleared. |
1909 | * @note Please also consider that when clearing this flag, other flags as |
1910 | * @rmtoll SR NF LL_USART_ClearFlag_NE |
1910 | * PE, FE, ORE, IDLE would also be cleared. |
1911 | * @param USARTx USART Instance |
1911 | * @rmtoll SR NF LL_USART_ClearFlag_NE |
1912 | * @retval None |
1912 | * @param USARTx USART Instance |
1913 | */ |
1913 | * @retval None |
1914 | __STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx) |
1914 | */ |
1915 | { |
1915 | __STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx) |
1916 | __IO uint32_t tmpreg; |
1916 | { |
1917 | tmpreg = USARTx->SR; |
1917 | __IO uint32_t tmpreg; |
1918 | (void) tmpreg; |
1918 | tmpreg = USARTx->SR; |
1919 | tmpreg = USARTx->DR; |
1919 | (void) tmpreg; |
1920 | (void) tmpreg; |
1920 | tmpreg = USARTx->DR; |
1921 | } |
1921 | (void) tmpreg; |
1922 | 1922 | } |
|
1923 | /** |
1923 | |
1924 | * @brief Clear OverRun Error Flag |
1924 | /** |
1925 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1925 | * @brief Clear OverRun Error Flag |
1926 | * register followed by a read access to the USARTx_DR register. |
1926 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1927 | * @note Please also consider that when clearing this flag, other flags as |
1927 | * register followed by a read access to the USARTx_DR register. |
1928 | * PE, NE, FE, IDLE would also be cleared. |
1928 | * @note Please also consider that when clearing this flag, other flags as |
1929 | * @rmtoll SR ORE LL_USART_ClearFlag_ORE |
1929 | * PE, NE, FE, IDLE would also be cleared. |
1930 | * @param USARTx USART Instance |
1930 | * @rmtoll SR ORE LL_USART_ClearFlag_ORE |
1931 | * @retval None |
1931 | * @param USARTx USART Instance |
1932 | */ |
1932 | * @retval None |
1933 | __STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx) |
1933 | */ |
1934 | { |
1934 | __STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx) |
1935 | __IO uint32_t tmpreg; |
1935 | { |
1936 | tmpreg = USARTx->SR; |
1936 | __IO uint32_t tmpreg; |
1937 | (void) tmpreg; |
1937 | tmpreg = USARTx->SR; |
1938 | tmpreg = USARTx->DR; |
1938 | (void) tmpreg; |
1939 | (void) tmpreg; |
1939 | tmpreg = USARTx->DR; |
1940 | } |
1940 | (void) tmpreg; |
1941 | 1941 | } |
|
1942 | /** |
1942 | |
1943 | * @brief Clear IDLE line detected Flag |
1943 | /** |
1944 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1944 | * @brief Clear IDLE line detected Flag |
1945 | * register followed by a read access to the USARTx_DR register. |
1945 | * @note Clearing this flag is done by a read access to the USARTx_SR |
1946 | * @note Please also consider that when clearing this flag, other flags as |
1946 | * register followed by a read access to the USARTx_DR register. |
1947 | * PE, NE, FE, ORE would also be cleared. |
1947 | * @note Please also consider that when clearing this flag, other flags as |
1948 | * @rmtoll SR IDLE LL_USART_ClearFlag_IDLE |
1948 | * PE, NE, FE, ORE would also be cleared. |
1949 | * @param USARTx USART Instance |
1949 | * @rmtoll SR IDLE LL_USART_ClearFlag_IDLE |
1950 | * @retval None |
1950 | * @param USARTx USART Instance |
1951 | */ |
1951 | * @retval None |
1952 | __STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx) |
1952 | */ |
1953 | { |
1953 | __STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx) |
1954 | __IO uint32_t tmpreg; |
1954 | { |
1955 | tmpreg = USARTx->SR; |
1955 | __IO uint32_t tmpreg; |
1956 | (void) tmpreg; |
1956 | tmpreg = USARTx->SR; |
1957 | tmpreg = USARTx->DR; |
1957 | (void) tmpreg; |
1958 | (void) tmpreg; |
1958 | tmpreg = USARTx->DR; |
1959 | } |
1959 | (void) tmpreg; |
1960 | 1960 | } |
|
1961 | /** |
1961 | |
1962 | * @brief Clear Transmission Complete Flag |
1962 | /** |
1963 | * @rmtoll SR TC LL_USART_ClearFlag_TC |
1963 | * @brief Clear Transmission Complete Flag |
1964 | * @param USARTx USART Instance |
1964 | * @rmtoll SR TC LL_USART_ClearFlag_TC |
1965 | * @retval None |
1965 | * @param USARTx USART Instance |
1966 | */ |
1966 | * @retval None |
1967 | __STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx) |
1967 | */ |
1968 | { |
1968 | __STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx) |
1969 | WRITE_REG(USARTx->SR, ~(USART_SR_TC)); |
1969 | { |
1970 | } |
1970 | WRITE_REG(USARTx->SR, ~(USART_SR_TC)); |
1971 | 1971 | } |
|
1972 | /** |
1972 | |
1973 | * @brief Clear RX Not Empty Flag |
1973 | /** |
1974 | * @rmtoll SR RXNE LL_USART_ClearFlag_RXNE |
1974 | * @brief Clear RX Not Empty Flag |
1975 | * @param USARTx USART Instance |
1975 | * @rmtoll SR RXNE LL_USART_ClearFlag_RXNE |
1976 | * @retval None |
1976 | * @param USARTx USART Instance |
1977 | */ |
1977 | * @retval None |
1978 | __STATIC_INLINE void LL_USART_ClearFlag_RXNE(USART_TypeDef *USARTx) |
1978 | */ |
1979 | { |
1979 | __STATIC_INLINE void LL_USART_ClearFlag_RXNE(USART_TypeDef *USARTx) |
1980 | WRITE_REG(USARTx->SR, ~(USART_SR_RXNE)); |
1980 | { |
1981 | } |
1981 | WRITE_REG(USARTx->SR, ~(USART_SR_RXNE)); |
1982 | 1982 | } |
|
1983 | /** |
1983 | |
1984 | * @brief Clear LIN Break Detection Flag |
1984 | /** |
1985 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1985 | * @brief Clear LIN Break Detection Flag |
1986 | * LIN feature is supported by the USARTx instance. |
1986 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
1987 | * @rmtoll SR LBD LL_USART_ClearFlag_LBD |
1987 | * LIN feature is supported by the USARTx instance. |
1988 | * @param USARTx USART Instance |
1988 | * @rmtoll SR LBD LL_USART_ClearFlag_LBD |
1989 | * @retval None |
1989 | * @param USARTx USART Instance |
1990 | */ |
1990 | * @retval None |
1991 | __STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx) |
1991 | */ |
1992 | { |
1992 | __STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx) |
1993 | WRITE_REG(USARTx->SR, ~(USART_SR_LBD)); |
1993 | { |
1994 | } |
1994 | WRITE_REG(USARTx->SR, ~(USART_SR_LBD)); |
1995 | 1995 | } |
|
1996 | /** |
1996 | |
1997 | * @brief Clear CTS Interrupt Flag |
1997 | /** |
1998 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
1998 | * @brief Clear CTS Interrupt Flag |
1999 | * Hardware Flow control feature is supported by the USARTx instance. |
1999 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2000 | * @rmtoll SR CTS LL_USART_ClearFlag_nCTS |
2000 | * Hardware Flow control feature is supported by the USARTx instance. |
2001 | * @param USARTx USART Instance |
2001 | * @rmtoll SR CTS LL_USART_ClearFlag_nCTS |
2002 | * @retval None |
2002 | * @param USARTx USART Instance |
2003 | */ |
2003 | * @retval None |
2004 | __STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx) |
2004 | */ |
2005 | { |
2005 | __STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx) |
2006 | WRITE_REG(USARTx->SR, ~(USART_SR_CTS)); |
2006 | { |
2007 | } |
2007 | WRITE_REG(USARTx->SR, ~(USART_SR_CTS)); |
2008 | 2008 | } |
|
2009 | /** |
2009 | |
2010 | * @} |
2010 | /** |
2011 | */ |
2011 | * @} |
2012 | 2012 | */ |
|
2013 | /** @defgroup USART_LL_EF_IT_Management IT_Management |
2013 | |
2014 | * @{ |
2014 | /** @defgroup USART_LL_EF_IT_Management IT_Management |
2015 | */ |
2015 | * @{ |
2016 | 2016 | */ |
|
2017 | /** |
2017 | |
2018 | * @brief Enable IDLE Interrupt |
2018 | /** |
2019 | * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE |
2019 | * @brief Enable IDLE Interrupt |
2020 | * @param USARTx USART Instance |
2020 | * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE |
2021 | * @retval None |
2021 | * @param USARTx USART Instance |
2022 | */ |
2022 | * @retval None |
2023 | __STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx) |
2023 | */ |
2024 | { |
2024 | __STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx) |
2025 | SET_BIT(USARTx->CR1, USART_CR1_IDLEIE); |
2025 | { |
2026 | } |
2026 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_IDLEIE); |
2027 | 2027 | } |
|
2028 | /** |
2028 | |
2029 | * @brief Enable RX Not Empty Interrupt |
2029 | /** |
2030 | * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE |
2030 | * @brief Enable RX Not Empty Interrupt |
2031 | * @param USARTx USART Instance |
2031 | * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE |
2032 | * @retval None |
2032 | * @param USARTx USART Instance |
2033 | */ |
2033 | * @retval None |
2034 | __STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx) |
2034 | */ |
2035 | { |
2035 | __STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx) |
2036 | SET_BIT(USARTx->CR1, USART_CR1_RXNEIE); |
2036 | { |
2037 | } |
2037 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_RXNEIE); |
2038 | 2038 | } |
|
2039 | /** |
2039 | |
2040 | * @brief Enable Transmission Complete Interrupt |
2040 | /** |
2041 | * @rmtoll CR1 TCIE LL_USART_EnableIT_TC |
2041 | * @brief Enable Transmission Complete Interrupt |
2042 | * @param USARTx USART Instance |
2042 | * @rmtoll CR1 TCIE LL_USART_EnableIT_TC |
2043 | * @retval None |
2043 | * @param USARTx USART Instance |
2044 | */ |
2044 | * @retval None |
2045 | __STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx) |
2045 | */ |
2046 | { |
2046 | __STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx) |
2047 | SET_BIT(USARTx->CR1, USART_CR1_TCIE); |
2047 | { |
2048 | } |
2048 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_TCIE); |
2049 | 2049 | } |
|
2050 | /** |
2050 | |
2051 | * @brief Enable TX Empty Interrupt |
2051 | /** |
2052 | * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE |
2052 | * @brief Enable TX Empty Interrupt |
2053 | * @param USARTx USART Instance |
2053 | * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE |
2054 | * @retval None |
2054 | * @param USARTx USART Instance |
2055 | */ |
2055 | * @retval None |
2056 | __STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx) |
2056 | */ |
2057 | { |
2057 | __STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx) |
2058 | SET_BIT(USARTx->CR1, USART_CR1_TXEIE); |
2058 | { |
2059 | } |
2059 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_TXEIE); |
2060 | 2060 | } |
|
2061 | /** |
2061 | |
2062 | * @brief Enable Parity Error Interrupt |
2062 | /** |
2063 | * @rmtoll CR1 PEIE LL_USART_EnableIT_PE |
2063 | * @brief Enable Parity Error Interrupt |
2064 | * @param USARTx USART Instance |
2064 | * @rmtoll CR1 PEIE LL_USART_EnableIT_PE |
2065 | * @retval None |
2065 | * @param USARTx USART Instance |
2066 | */ |
2066 | * @retval None |
2067 | __STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx) |
2067 | */ |
2068 | { |
2068 | __STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx) |
2069 | SET_BIT(USARTx->CR1, USART_CR1_PEIE); |
2069 | { |
2070 | } |
2070 | ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_PEIE); |
2071 | 2071 | } |
|
2072 | /** |
2072 | |
2073 | * @brief Enable LIN Break Detection Interrupt |
2073 | /** |
2074 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
2074 | * @brief Enable LIN Break Detection Interrupt |
2075 | * LIN feature is supported by the USARTx instance. |
2075 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
2076 | * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD |
2076 | * LIN feature is supported by the USARTx instance. |
2077 | * @param USARTx USART Instance |
2077 | * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD |
2078 | * @retval None |
2078 | * @param USARTx USART Instance |
2079 | */ |
2079 | * @retval None |
2080 | __STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx) |
2080 | */ |
2081 | { |
2081 | __STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx) |
2082 | SET_BIT(USARTx->CR2, USART_CR2_LBDIE); |
2082 | { |
2083 | } |
2083 | SET_BIT(USARTx->CR2, USART_CR2_LBDIE); |
2084 | 2084 | } |
|
2085 | /** |
2085 | |
2086 | * @brief Enable Error Interrupt |
2086 | /** |
2087 | * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing |
2087 | * @brief Enable Error Interrupt |
2088 | * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). |
2088 | * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing |
2089 | * 0: Interrupt is inhibited |
2089 | * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). |
2090 | * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. |
2090 | * 0: Interrupt is inhibited |
2091 | * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR |
2091 | * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. |
2092 | * @param USARTx USART Instance |
2092 | * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR |
2093 | * @retval None |
2093 | * @param USARTx USART Instance |
2094 | */ |
2094 | * @retval None |
2095 | __STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx) |
2095 | */ |
2096 | { |
2096 | __STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx) |
2097 | SET_BIT(USARTx->CR3, USART_CR3_EIE); |
2097 | { |
2098 | } |
2098 | ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_EIE); |
2099 | 2099 | } |
|
2100 | /** |
2100 | |
2101 | * @brief Enable CTS Interrupt |
2101 | /** |
2102 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2102 | * @brief Enable CTS Interrupt |
2103 | * Hardware Flow control feature is supported by the USARTx instance. |
2103 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2104 | * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS |
2104 | * Hardware Flow control feature is supported by the USARTx instance. |
2105 | * @param USARTx USART Instance |
2105 | * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS |
2106 | * @retval None |
2106 | * @param USARTx USART Instance |
2107 | */ |
2107 | * @retval None |
2108 | __STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx) |
2108 | */ |
2109 | { |
2109 | __STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx) |
2110 | SET_BIT(USARTx->CR3, USART_CR3_CTSIE); |
2110 | { |
2111 | } |
2111 | ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_CTSIE); |
2112 | 2112 | } |
|
2113 | /** |
2113 | |
2114 | * @brief Disable IDLE Interrupt |
2114 | /** |
2115 | * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE |
2115 | * @brief Disable IDLE Interrupt |
2116 | * @param USARTx USART Instance |
2116 | * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE |
2117 | * @retval None |
2117 | * @param USARTx USART Instance |
2118 | */ |
2118 | * @retval None |
2119 | __STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx) |
2119 | */ |
2120 | { |
2120 | __STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx) |
2121 | CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE); |
2121 | { |
2122 | } |
2122 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE); |
2123 | 2123 | } |
|
2124 | /** |
2124 | |
2125 | * @brief Disable RX Not Empty Interrupt |
2125 | /** |
2126 | * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE |
2126 | * @brief Disable RX Not Empty Interrupt |
2127 | * @param USARTx USART Instance |
2127 | * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE |
2128 | * @retval None |
2128 | * @param USARTx USART Instance |
2129 | */ |
2129 | * @retval None |
2130 | __STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx) |
2130 | */ |
2131 | { |
2131 | __STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx) |
2132 | CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE); |
2132 | { |
2133 | } |
2133 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE); |
2134 | 2134 | } |
|
2135 | /** |
2135 | |
2136 | * @brief Disable Transmission Complete Interrupt |
2136 | /** |
2137 | * @rmtoll CR1 TCIE LL_USART_DisableIT_TC |
2137 | * @brief Disable Transmission Complete Interrupt |
2138 | * @param USARTx USART Instance |
2138 | * @rmtoll CR1 TCIE LL_USART_DisableIT_TC |
2139 | * @retval None |
2139 | * @param USARTx USART Instance |
2140 | */ |
2140 | * @retval None |
2141 | __STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx) |
2141 | */ |
2142 | { |
2142 | __STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx) |
2143 | CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE); |
2143 | { |
2144 | } |
2144 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE); |
2145 | 2145 | } |
|
2146 | /** |
2146 | |
2147 | * @brief Disable TX Empty Interrupt |
2147 | /** |
2148 | * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE |
2148 | * @brief Disable TX Empty Interrupt |
2149 | * @param USARTx USART Instance |
2149 | * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE |
2150 | * @retval None |
2150 | * @param USARTx USART Instance |
2151 | */ |
2151 | * @retval None |
2152 | __STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx) |
2152 | */ |
2153 | { |
2153 | __STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx) |
2154 | CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE); |
2154 | { |
2155 | } |
2155 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE); |
2156 | 2156 | } |
|
2157 | /** |
2157 | |
2158 | * @brief Disable Parity Error Interrupt |
2158 | /** |
2159 | * @rmtoll CR1 PEIE LL_USART_DisableIT_PE |
2159 | * @brief Disable Parity Error Interrupt |
2160 | * @param USARTx USART Instance |
2160 | * @rmtoll CR1 PEIE LL_USART_DisableIT_PE |
2161 | * @retval None |
2161 | * @param USARTx USART Instance |
2162 | */ |
2162 | * @retval None |
2163 | __STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx) |
2163 | */ |
2164 | { |
2164 | __STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx) |
2165 | CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE); |
2165 | { |
2166 | } |
2166 | ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE); |
2167 | 2167 | } |
|
2168 | /** |
2168 | |
2169 | * @brief Disable LIN Break Detection Interrupt |
2169 | /** |
2170 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
2170 | * @brief Disable LIN Break Detection Interrupt |
2171 | * LIN feature is supported by the USARTx instance. |
2171 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
2172 | * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD |
2172 | * LIN feature is supported by the USARTx instance. |
2173 | * @param USARTx USART Instance |
2173 | * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD |
2174 | * @retval None |
2174 | * @param USARTx USART Instance |
2175 | */ |
2175 | * @retval None |
2176 | __STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx) |
2176 | */ |
2177 | { |
2177 | __STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx) |
2178 | CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE); |
2178 | { |
2179 | } |
2179 | CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE); |
2180 | 2180 | } |
|
2181 | /** |
2181 | |
2182 | * @brief Disable Error Interrupt |
2182 | /** |
2183 | * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing |
2183 | * @brief Disable Error Interrupt |
2184 | * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). |
2184 | * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing |
2185 | * 0: Interrupt is inhibited |
2185 | * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). |
2186 | * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. |
2186 | * 0: Interrupt is inhibited |
2187 | * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR |
2187 | * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. |
2188 | * @param USARTx USART Instance |
2188 | * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR |
2189 | * @retval None |
2189 | * @param USARTx USART Instance |
2190 | */ |
2190 | * @retval None |
2191 | __STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx) |
2191 | */ |
2192 | { |
2192 | __STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx) |
2193 | CLEAR_BIT(USARTx->CR3, USART_CR3_EIE); |
2193 | { |
2194 | } |
2194 | ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_EIE); |
2195 | 2195 | } |
|
2196 | /** |
2196 | |
2197 | * @brief Disable CTS Interrupt |
2197 | /** |
2198 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2198 | * @brief Disable CTS Interrupt |
2199 | * Hardware Flow control feature is supported by the USARTx instance. |
2199 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2200 | * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS |
2200 | * Hardware Flow control feature is supported by the USARTx instance. |
2201 | * @param USARTx USART Instance |
2201 | * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS |
2202 | * @retval None |
2202 | * @param USARTx USART Instance |
2203 | */ |
2203 | * @retval None |
2204 | __STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx) |
2204 | */ |
2205 | { |
2205 | __STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx) |
2206 | CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE); |
2206 | { |
2207 | } |
2207 | ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE); |
2208 | 2208 | } |
|
2209 | /** |
2209 | |
2210 | * @brief Check if the USART IDLE Interrupt source is enabled or disabled. |
2210 | /** |
2211 | * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE |
2211 | * @brief Check if the USART IDLE Interrupt source is enabled or disabled. |
2212 | * @param USARTx USART Instance |
2212 | * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE |
2213 | * @retval State of bit (1 or 0). |
2213 | * @param USARTx USART Instance |
2214 | */ |
2214 | * @retval State of bit (1 or 0). |
2215 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx) |
2215 | */ |
2216 | { |
2216 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(const USART_TypeDef *USARTx) |
2217 | return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE)); |
2217 | { |
2218 | } |
2218 | return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE)); |
2219 | 2219 | } |
|
2220 | /** |
2220 | |
2221 | * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled. |
2221 | /** |
2222 | * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE |
2222 | * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled. |
2223 | * @param USARTx USART Instance |
2223 | * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE |
2224 | * @retval State of bit (1 or 0). |
2224 | * @param USARTx USART Instance |
2225 | */ |
2225 | * @retval State of bit (1 or 0). |
2226 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx) |
2226 | */ |
2227 | { |
2227 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(const USART_TypeDef *USARTx) |
2228 | return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE)); |
2228 | { |
2229 | } |
2229 | return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE)); |
2230 | 2230 | } |
|
2231 | /** |
2231 | |
2232 | * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled. |
2232 | /** |
2233 | * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC |
2233 | * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled. |
2234 | * @param USARTx USART Instance |
2234 | * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC |
2235 | * @retval State of bit (1 or 0). |
2235 | * @param USARTx USART Instance |
2236 | */ |
2236 | * @retval State of bit (1 or 0). |
2237 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx) |
2237 | */ |
2238 | { |
2238 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(const USART_TypeDef *USARTx) |
2239 | return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE)); |
2239 | { |
2240 | } |
2240 | return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE)); |
2241 | 2241 | } |
|
2242 | /** |
2242 | |
2243 | * @brief Check if the USART TX Empty Interrupt is enabled or disabled. |
2243 | /** |
2244 | * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE |
2244 | * @brief Check if the USART TX Empty Interrupt is enabled or disabled. |
2245 | * @param USARTx USART Instance |
2245 | * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE |
2246 | * @retval State of bit (1 or 0). |
2246 | * @param USARTx USART Instance |
2247 | */ |
2247 | * @retval State of bit (1 or 0). |
2248 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx) |
2248 | */ |
2249 | { |
2249 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(const USART_TypeDef *USARTx) |
2250 | return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE)); |
2250 | { |
2251 | } |
2251 | return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE)); |
2252 | 2252 | } |
|
2253 | /** |
2253 | |
2254 | * @brief Check if the USART Parity Error Interrupt is enabled or disabled. |
2254 | /** |
2255 | * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE |
2255 | * @brief Check if the USART Parity Error Interrupt is enabled or disabled. |
2256 | * @param USARTx USART Instance |
2256 | * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE |
2257 | * @retval State of bit (1 or 0). |
2257 | * @param USARTx USART Instance |
2258 | */ |
2258 | * @retval State of bit (1 or 0). |
2259 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx) |
2259 | */ |
2260 | { |
2260 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(const USART_TypeDef *USARTx) |
2261 | return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE)); |
2261 | { |
2262 | } |
2262 | return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE)); |
2263 | 2263 | } |
|
2264 | /** |
2264 | |
2265 | * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled. |
2265 | /** |
2266 | * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
2266 | * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled. |
2267 | * LIN feature is supported by the USARTx instance. |
2267 | * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not |
2268 | * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD |
2268 | * LIN feature is supported by the USARTx instance. |
2269 | * @param USARTx USART Instance |
2269 | * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD |
2270 | * @retval State of bit (1 or 0). |
2270 | * @param USARTx USART Instance |
2271 | */ |
2271 | * @retval State of bit (1 or 0). |
2272 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx) |
2272 | */ |
2273 | { |
2273 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(const USART_TypeDef *USARTx) |
2274 | return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE)); |
2274 | { |
2275 | } |
2275 | return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE)); |
2276 | 2276 | } |
|
2277 | /** |
2277 | |
2278 | * @brief Check if the USART Error Interrupt is enabled or disabled. |
2278 | /** |
2279 | * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR |
2279 | * @brief Check if the USART Error Interrupt is enabled or disabled. |
2280 | * @param USARTx USART Instance |
2280 | * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR |
2281 | * @retval State of bit (1 or 0). |
2281 | * @param USARTx USART Instance |
2282 | */ |
2282 | * @retval State of bit (1 or 0). |
2283 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx) |
2283 | */ |
2284 | { |
2284 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(const USART_TypeDef *USARTx) |
2285 | return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE)); |
2285 | { |
2286 | } |
2286 | return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE)); |
2287 | 2287 | } |
|
2288 | /** |
2288 | |
2289 | * @brief Check if the USART CTS Interrupt is enabled or disabled. |
2289 | /** |
2290 | * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2290 | * @brief Check if the USART CTS Interrupt is enabled or disabled. |
2291 | * Hardware Flow control feature is supported by the USARTx instance. |
2291 | * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not |
2292 | * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS |
2292 | * Hardware Flow control feature is supported by the USARTx instance. |
2293 | * @param USARTx USART Instance |
2293 | * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS |
2294 | * @retval State of bit (1 or 0). |
2294 | * @param USARTx USART Instance |
2295 | */ |
2295 | * @retval State of bit (1 or 0). |
2296 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx) |
2296 | */ |
2297 | { |
2297 | __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(const USART_TypeDef *USARTx) |
2298 | return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE)); |
2298 | { |
2299 | } |
2299 | return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE)); |
2300 | 2300 | } |
|
2301 | /** |
2301 | |
2302 | * @} |
2302 | /** |
2303 | */ |
2303 | * @} |
2304 | 2304 | */ |
|
2305 | /** @defgroup USART_LL_EF_DMA_Management DMA_Management |
2305 | |
2306 | * @{ |
2306 | /** @defgroup USART_LL_EF_DMA_Management DMA_Management |
2307 | */ |
2307 | * @{ |
2308 | 2308 | */ |
|
2309 | /** |
2309 | |
2310 | * @brief Enable DMA Mode for reception |
2310 | /** |
2311 | * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX |
2311 | * @brief Enable DMA Mode for reception |
2312 | * @param USARTx USART Instance |
2312 | * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX |
2313 | * @retval None |
2313 | * @param USARTx USART Instance |
2314 | */ |
2314 | * @retval None |
2315 | __STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx) |
2315 | */ |
2316 | { |
2316 | __STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx) |
2317 | SET_BIT(USARTx->CR3, USART_CR3_DMAR); |
2317 | { |
2318 | } |
2318 | ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_DMAR); |
2319 | 2319 | } |
|
2320 | /** |
2320 | |
2321 | * @brief Disable DMA Mode for reception |
2321 | /** |
2322 | * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX |
2322 | * @brief Disable DMA Mode for reception |
2323 | * @param USARTx USART Instance |
2323 | * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX |
2324 | * @retval None |
2324 | * @param USARTx USART Instance |
2325 | */ |
2325 | * @retval None |
2326 | __STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx) |
2326 | */ |
2327 | { |
2327 | __STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx) |
2328 | CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR); |
2328 | { |
2329 | } |
2329 | ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR); |
2330 | 2330 | } |
|
2331 | /** |
2331 | |
2332 | * @brief Check if DMA Mode is enabled for reception |
2332 | /** |
2333 | * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX |
2333 | * @brief Check if DMA Mode is enabled for reception |
2334 | * @param USARTx USART Instance |
2334 | * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX |
2335 | * @retval State of bit (1 or 0). |
2335 | * @param USARTx USART Instance |
2336 | */ |
2336 | * @retval State of bit (1 or 0). |
2337 | __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx) |
2337 | */ |
2338 | { |
2338 | __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(const USART_TypeDef *USARTx) |
2339 | return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR)); |
2339 | { |
2340 | } |
2340 | return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR)); |
2341 | 2341 | } |
|
2342 | /** |
2342 | |
2343 | * @brief Enable DMA Mode for transmission |
2343 | /** |
2344 | * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX |
2344 | * @brief Enable DMA Mode for transmission |
2345 | * @param USARTx USART Instance |
2345 | * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX |
2346 | * @retval None |
2346 | * @param USARTx USART Instance |
2347 | */ |
2347 | * @retval None |
2348 | __STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx) |
2348 | */ |
2349 | { |
2349 | __STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx) |
2350 | SET_BIT(USARTx->CR3, USART_CR3_DMAT); |
2350 | { |
2351 | } |
2351 | ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_DMAT); |
2352 | 2352 | } |
|
2353 | /** |
2353 | |
2354 | * @brief Disable DMA Mode for transmission |
2354 | /** |
2355 | * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX |
2355 | * @brief Disable DMA Mode for transmission |
2356 | * @param USARTx USART Instance |
2356 | * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX |
2357 | * @retval None |
2357 | * @param USARTx USART Instance |
2358 | */ |
2358 | * @retval None |
2359 | __STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx) |
2359 | */ |
2360 | { |
2360 | __STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx) |
2361 | CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT); |
2361 | { |
2362 | } |
2362 | ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT); |
2363 | 2363 | } |
|
2364 | /** |
2364 | |
2365 | * @brief Check if DMA Mode is enabled for transmission |
2365 | /** |
2366 | * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX |
2366 | * @brief Check if DMA Mode is enabled for transmission |
2367 | * @param USARTx USART Instance |
2367 | * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX |
2368 | * @retval State of bit (1 or 0). |
2368 | * @param USARTx USART Instance |
2369 | */ |
2369 | * @retval State of bit (1 or 0). |
2370 | __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx) |
2370 | */ |
2371 | { |
2371 | __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(const USART_TypeDef *USARTx) |
2372 | return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT)); |
2372 | { |
2373 | } |
2373 | return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT)); |
2374 | 2374 | } |
|
2375 | /** |
2375 | |
2376 | * @brief Get the data register address used for DMA transfer |
2376 | /** |
2377 | * @rmtoll DR DR LL_USART_DMA_GetRegAddr |
2377 | * @brief Get the data register address used for DMA transfer |
2378 | * @note Address of Data Register is valid for both Transmit and Receive transfers. |
2378 | * @rmtoll DR DR LL_USART_DMA_GetRegAddr |
2379 | * @param USARTx USART Instance |
2379 | * @note Address of Data Register is valid for both Transmit and Receive transfers. |
2380 | * @retval Address of data register |
2380 | * @param USARTx USART Instance |
2381 | */ |
2381 | * @retval Address of data register |
2382 | __STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx) |
2382 | */ |
2383 | { |
2383 | __STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(const USART_TypeDef *USARTx) |
2384 | /* return address of DR register */ |
2384 | { |
2385 | return ((uint32_t) & (USARTx->DR)); |
2385 | /* return address of DR register */ |
2386 | } |
2386 | return ((uint32_t) &(USARTx->DR)); |
2387 | 2387 | } |
|
2388 | /** |
2388 | |
2389 | * @} |
2389 | /** |
2390 | */ |
2390 | * @} |
2391 | 2391 | */ |
|
2392 | /** @defgroup USART_LL_EF_Data_Management Data_Management |
2392 | |
2393 | * @{ |
2393 | /** @defgroup USART_LL_EF_Data_Management Data_Management |
2394 | */ |
2394 | * @{ |
2395 | 2395 | */ |
|
2396 | /** |
2396 | |
2397 | * @brief Read Receiver Data register (Receive Data value, 8 bits) |
2397 | /** |
2398 | * @rmtoll DR DR LL_USART_ReceiveData8 |
2398 | * @brief Read Receiver Data register (Receive Data value, 8 bits) |
2399 | * @param USARTx USART Instance |
2399 | * @rmtoll DR DR LL_USART_ReceiveData8 |
2400 | * @retval Value between Min_Data=0x00 and Max_Data=0xFF |
2400 | * @param USARTx USART Instance |
2401 | */ |
2401 | * @retval Value between Min_Data=0x00 and Max_Data=0xFF |
2402 | __STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx) |
2402 | */ |
2403 | { |
2403 | __STATIC_INLINE uint8_t LL_USART_ReceiveData8(const USART_TypeDef *USARTx) |
2404 | return (uint8_t)(READ_BIT(USARTx->DR, USART_DR_DR)); |
2404 | { |
2405 | } |
2405 | return (uint8_t)(READ_BIT(USARTx->DR, USART_DR_DR)); |
2406 | 2406 | } |
|
2407 | /** |
2407 | |
2408 | * @brief Read Receiver Data register (Receive Data value, 9 bits) |
2408 | /** |
2409 | * @rmtoll DR DR LL_USART_ReceiveData9 |
2409 | * @brief Read Receiver Data register (Receive Data value, 9 bits) |
2410 | * @param USARTx USART Instance |
2410 | * @rmtoll DR DR LL_USART_ReceiveData9 |
2411 | * @retval Value between Min_Data=0x00 and Max_Data=0x1FF |
2411 | * @param USARTx USART Instance |
2412 | */ |
2412 | * @retval Value between Min_Data=0x00 and Max_Data=0x1FF |
2413 | __STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx) |
2413 | */ |
2414 | { |
2414 | __STATIC_INLINE uint16_t LL_USART_ReceiveData9(const USART_TypeDef *USARTx) |
2415 | return (uint16_t)(READ_BIT(USARTx->DR, USART_DR_DR)); |
2415 | { |
2416 | } |
2416 | return (uint16_t)(READ_BIT(USARTx->DR, USART_DR_DR)); |
2417 | 2417 | } |
|
2418 | /** |
2418 | |
2419 | * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits) |
2419 | /** |
2420 | * @rmtoll DR DR LL_USART_TransmitData8 |
2420 | * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits) |
2421 | * @param USARTx USART Instance |
2421 | * @rmtoll DR DR LL_USART_TransmitData8 |
2422 | * @param Value between Min_Data=0x00 and Max_Data=0xFF |
2422 | * @param USARTx USART Instance |
2423 | * @retval None |
2423 | * @param Value between Min_Data=0x00 and Max_Data=0xFF |
2424 | */ |
2424 | * @retval None |
2425 | __STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value) |
2425 | */ |
2426 | { |
2426 | __STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value) |
2427 | USARTx->DR = Value; |
2427 | { |
2428 | } |
2428 | USARTx->DR = Value; |
2429 | 2429 | } |
|
2430 | /** |
2430 | |
2431 | * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits) |
2431 | /** |
2432 | * @rmtoll DR DR LL_USART_TransmitData9 |
2432 | * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits) |
2433 | * @param USARTx USART Instance |
2433 | * @rmtoll DR DR LL_USART_TransmitData9 |
2434 | * @param Value between Min_Data=0x00 and Max_Data=0x1FF |
2434 | * @param USARTx USART Instance |
2435 | * @retval None |
2435 | * @param Value between Min_Data=0x00 and Max_Data=0x1FF |
2436 | */ |
2436 | * @retval None |
2437 | __STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value) |
2437 | */ |
2438 | { |
2438 | __STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value) |
2439 | USARTx->DR = Value & 0x1FFU; |
2439 | { |
2440 | } |
2440 | USARTx->DR = Value & 0x1FFU; |
2441 | 2441 | } |
|
2442 | /** |
2442 | |
2443 | * @} |
2443 | /** |
2444 | */ |
2444 | * @} |
2445 | 2445 | */ |
|
2446 | /** @defgroup USART_LL_EF_Execution Execution |
2446 | |
2447 | * @{ |
2447 | /** @defgroup USART_LL_EF_Execution Execution |
2448 | */ |
2448 | * @{ |
2449 | 2449 | */ |
|
2450 | /** |
2450 | |
2451 | * @brief Request Break sending |
2451 | /** |
2452 | * @rmtoll CR1 SBK LL_USART_RequestBreakSending |
2452 | * @brief Request Break sending |
2453 | * @param USARTx USART Instance |
2453 | * @rmtoll CR1 SBK LL_USART_RequestBreakSending |
2454 | * @retval None |
2454 | * @param USARTx USART Instance |
2455 | */ |
2455 | * @retval None |
2456 | __STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx) |
2456 | */ |
2457 | { |
2457 | __STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx) |
2458 | SET_BIT(USARTx->CR1, USART_CR1_SBK); |
2458 | { |
2459 | } |
2459 | SET_BIT(USARTx->CR1, USART_CR1_SBK); |
2460 | 2460 | } |
|
2461 | /** |
2461 | |
2462 | * @brief Put USART in Mute mode |
2462 | /** |
2463 | * @rmtoll CR1 RWU LL_USART_RequestEnterMuteMode |
2463 | * @brief Put USART in Mute mode |
2464 | * @param USARTx USART Instance |
2464 | * @rmtoll CR1 RWU LL_USART_RequestEnterMuteMode |
2465 | * @retval None |
2465 | * @param USARTx USART Instance |
2466 | */ |
2466 | * @retval None |
2467 | __STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx) |
2467 | */ |
2468 | { |
2468 | __STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx) |
2469 | SET_BIT(USARTx->CR1, USART_CR1_RWU); |
2469 | { |
2470 | } |
2470 | SET_BIT(USARTx->CR1, USART_CR1_RWU); |
2471 | 2471 | } |
|
2472 | /** |
2472 | |
2473 | * @brief Put USART in Active mode |
2473 | /** |
2474 | * @rmtoll CR1 RWU LL_USART_RequestExitMuteMode |
2474 | * @brief Put USART in Active mode |
2475 | * @param USARTx USART Instance |
2475 | * @rmtoll CR1 RWU LL_USART_RequestExitMuteMode |
2476 | * @retval None |
2476 | * @param USARTx USART Instance |
2477 | */ |
2477 | * @retval None |
2478 | __STATIC_INLINE void LL_USART_RequestExitMuteMode(USART_TypeDef *USARTx) |
2478 | */ |
2479 | { |
2479 | __STATIC_INLINE void LL_USART_RequestExitMuteMode(USART_TypeDef *USARTx) |
2480 | CLEAR_BIT(USARTx->CR1, USART_CR1_RWU); |
2480 | { |
2481 | } |
2481 | CLEAR_BIT(USARTx->CR1, USART_CR1_RWU); |
2482 | 2482 | } |
|
2483 | /** |
2483 | |
2484 | * @} |
2484 | /** |
2485 | */ |
2485 | * @} |
2486 | 2486 | */ |
|
2487 | #if defined(USE_FULL_LL_DRIVER) |
2487 | |
2488 | /** @defgroup USART_LL_EF_Init Initialization and de-initialization functions |
2488 | #if defined(USE_FULL_LL_DRIVER) |
2489 | * @{ |
2489 | /** @defgroup USART_LL_EF_Init Initialization and de-initialization functions |
2490 | */ |
2490 | * @{ |
2491 | ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx); |
2491 | */ |
2492 | ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct); |
2492 | ErrorStatus LL_USART_DeInit(const USART_TypeDef *USARTx); |
2493 | void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct); |
2493 | ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, const LL_USART_InitTypeDef *USART_InitStruct); |
2494 | ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct); |
2494 | void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct); |
2495 | void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct); |
2495 | ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, const LL_USART_ClockInitTypeDef *USART_ClockInitStruct); |
2496 | /** |
2496 | void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct); |
2497 | * @} |
2497 | /** |
2498 | */ |
2498 | * @} |
2499 | #endif /* USE_FULL_LL_DRIVER */ |
2499 | */ |
2500 | 2500 | #endif /* USE_FULL_LL_DRIVER */ |
|
2501 | /** |
2501 | |
2502 | * @} |
2502 | /** |
2503 | */ |
2503 | * @} |
2504 | 2504 | */ |
|
2505 | /** |
2505 | |
2506 | * @} |
2506 | /** |
2507 | */ |
2507 | * @} |
2508 | 2508 | */ |
|
2509 | #endif /* USART1 || USART2|| USART3 || UART4 || UART5 */ |
2509 | |
2510 | 2510 | #endif /* USART1 || USART2|| USART3 || UART4 || UART5 */ |
|
2511 | /** |
2511 | |
2512 | * @} |
2512 | /** |
2513 | */ |
2513 | * @} |
2514 | 2514 | */ |
|
2515 | #ifdef __cplusplus |
2515 | |
2516 | } |
2516 | #ifdef __cplusplus |
2517 | #endif |
2517 | } |
2518 | 2518 | #endif |
|
2519 | #endif /* __STM32L1xx_LL_USART_H */ |
2519 | |
2520 | 2520 | #endif /* __STM32L1xx_LL_USART_H */ |
|
2521 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
2521 |