stm32l4xx_ll_usart.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_usart.c
  4. * @author MCD Application Team
  5. * @brief USART LL module driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. #if defined(USE_FULL_LL_DRIVER)
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "stm32l4xx_ll_usart.h"
  21. #include "stm32l4xx_ll_rcc.h"
  22. #include "stm32l4xx_ll_bus.h"
  23. #ifdef USE_FULL_ASSERT
  24. #include "stm32_assert.h"
  25. #else
  26. #define assert_param(expr) ((void)0U)
  27. #endif /* USE_FULL_ASSERT */
  28. /** @addtogroup STM32L4xx_LL_Driver
  29. * @{
  30. */
  31. #if defined(USART1) || defined(USART2) || defined(USART3) || defined(UART4) || defined(UART5)
  32. /** @addtogroup USART_LL
  33. * @{
  34. */
  35. /* Private types -------------------------------------------------------------*/
  36. /* Private variables ---------------------------------------------------------*/
  37. /* Private constants ---------------------------------------------------------*/
  38. /** @addtogroup USART_LL_Private_Constants
  39. * @{
  40. */
  41. /* Definition of default baudrate value used for USART initialisation */
  42. #define USART_DEFAULT_BAUDRATE (9600U)
  43. /**
  44. * @}
  45. */
  46. /* Private macros ------------------------------------------------------------*/
  47. /** @addtogroup USART_LL_Private_Macros
  48. * @{
  49. */
  50. #if defined(USART_PRESC_PRESCALER)
  51. #define IS_LL_USART_PRESCALER(__VALUE__) (((__VALUE__) == LL_USART_PRESCALER_DIV1) \
  52. || ((__VALUE__) == LL_USART_PRESCALER_DIV2) \
  53. || ((__VALUE__) == LL_USART_PRESCALER_DIV4) \
  54. || ((__VALUE__) == LL_USART_PRESCALER_DIV6) \
  55. || ((__VALUE__) == LL_USART_PRESCALER_DIV8) \
  56. || ((__VALUE__) == LL_USART_PRESCALER_DIV10) \
  57. || ((__VALUE__) == LL_USART_PRESCALER_DIV12) \
  58. || ((__VALUE__) == LL_USART_PRESCALER_DIV16) \
  59. || ((__VALUE__) == LL_USART_PRESCALER_DIV32) \
  60. || ((__VALUE__) == LL_USART_PRESCALER_DIV64) \
  61. || ((__VALUE__) == LL_USART_PRESCALER_DIV128) \
  62. || ((__VALUE__) == LL_USART_PRESCALER_DIV256))
  63. #endif /* USART_PRESC_PRESCALER */
  64. /* __BAUDRATE__ The maximum Baud Rate is derived from the maximum clock available
  65. * divided by the smallest oversampling used on the USART (i.e. 8) */
  66. #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
  67. #define IS_LL_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) <= 15000000U)
  68. #else
  69. #define IS_LL_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) <= 10000000U)
  70. #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
  71. /* __VALUE__ In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d. */
  72. #define IS_LL_USART_BRR_MIN(__VALUE__) ((__VALUE__) >= 16U)
  73. #define IS_LL_USART_DIRECTION(__VALUE__) (((__VALUE__) == LL_USART_DIRECTION_NONE) \
  74. || ((__VALUE__) == LL_USART_DIRECTION_RX) \
  75. || ((__VALUE__) == LL_USART_DIRECTION_TX) \
  76. || ((__VALUE__) == LL_USART_DIRECTION_TX_RX))
  77. #define IS_LL_USART_PARITY(__VALUE__) (((__VALUE__) == LL_USART_PARITY_NONE) \
  78. || ((__VALUE__) == LL_USART_PARITY_EVEN) \
  79. || ((__VALUE__) == LL_USART_PARITY_ODD))
  80. #define IS_LL_USART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_USART_DATAWIDTH_7B) \
  81. || ((__VALUE__) == LL_USART_DATAWIDTH_8B) \
  82. || ((__VALUE__) == LL_USART_DATAWIDTH_9B))
  83. #define IS_LL_USART_OVERSAMPLING(__VALUE__) (((__VALUE__) == LL_USART_OVERSAMPLING_16) \
  84. || ((__VALUE__) == LL_USART_OVERSAMPLING_8))
  85. #define IS_LL_USART_LASTBITCLKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_LASTCLKPULSE_NO_OUTPUT) \
  86. || ((__VALUE__) == LL_USART_LASTCLKPULSE_OUTPUT))
  87. #define IS_LL_USART_CLOCKPHASE(__VALUE__) (((__VALUE__) == LL_USART_PHASE_1EDGE) \
  88. || ((__VALUE__) == LL_USART_PHASE_2EDGE))
  89. #define IS_LL_USART_CLOCKPOLARITY(__VALUE__) (((__VALUE__) == LL_USART_POLARITY_LOW) \
  90. || ((__VALUE__) == LL_USART_POLARITY_HIGH))
  91. #define IS_LL_USART_CLOCKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_CLOCK_DISABLE) \
  92. || ((__VALUE__) == LL_USART_CLOCK_ENABLE))
  93. #define IS_LL_USART_STOPBITS(__VALUE__) (((__VALUE__) == LL_USART_STOPBITS_0_5) \
  94. || ((__VALUE__) == LL_USART_STOPBITS_1) \
  95. || ((__VALUE__) == LL_USART_STOPBITS_1_5) \
  96. || ((__VALUE__) == LL_USART_STOPBITS_2))
  97. #define IS_LL_USART_HWCONTROL(__VALUE__) (((__VALUE__) == LL_USART_HWCONTROL_NONE) \
  98. || ((__VALUE__) == LL_USART_HWCONTROL_RTS) \
  99. || ((__VALUE__) == LL_USART_HWCONTROL_CTS) \
  100. || ((__VALUE__) == LL_USART_HWCONTROL_RTS_CTS))
  101. /**
  102. * @}
  103. */
  104. /* Private function prototypes -----------------------------------------------*/
  105. /* Exported functions --------------------------------------------------------*/
  106. /** @addtogroup USART_LL_Exported_Functions
  107. * @{
  108. */
  109. /** @addtogroup USART_LL_EF_Init
  110. * @{
  111. */
  112. /**
  113. * @brief De-initialize USART registers (Registers restored to their default values).
  114. * @param USARTx USART Instance
  115. * @retval An ErrorStatus enumeration value:
  116. * - SUCCESS: USART registers are de-initialized
  117. * - ERROR: USART registers are not de-initialized
  118. */
  119. ErrorStatus LL_USART_DeInit(const USART_TypeDef *USARTx)
  120. {
  121. ErrorStatus status = SUCCESS;
  122. /* Check the parameters */
  123. assert_param(IS_UART_INSTANCE(USARTx));
  124. if (USARTx == USART1)
  125. {
  126. /* Force reset of USART clock */
  127. LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART1);
  128. /* Release reset of USART clock */
  129. LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART1);
  130. }
  131. else if (USARTx == USART2)
  132. {
  133. /* Force reset of USART clock */
  134. LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART2);
  135. /* Release reset of USART clock */
  136. LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART2);
  137. }
  138. #if defined(USART3)
  139. else if (USARTx == USART3)
  140. {
  141. /* Force reset of USART clock */
  142. LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART3);
  143. /* Release reset of USART clock */
  144. LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART3);
  145. }
  146. #endif /* USART3 */
  147. #if defined(UART4)
  148. else if (USARTx == UART4)
  149. {
  150. /* Force reset of UART clock */
  151. LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART4);
  152. /* Release reset of UART clock */
  153. LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART4);
  154. }
  155. #endif /* UART4 */
  156. #if defined(UART5)
  157. else if (USARTx == UART5)
  158. {
  159. /* Force reset of UART clock */
  160. LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART5);
  161. /* Release reset of UART clock */
  162. LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART5);
  163. }
  164. #endif /* UART5 */
  165. else
  166. {
  167. status = ERROR;
  168. }
  169. return (status);
  170. }
  171. /**
  172. * @brief Initialize USART registers according to the specified
  173. * parameters in USART_InitStruct.
  174. * @note As some bits in USART configuration registers can only be written when
  175. * the USART is disabled (USART_CR1_UE bit =0), USART Peripheral should be in disabled state prior calling
  176. * this function. Otherwise, ERROR result will be returned.
  177. * @note Baud rate value stored in USART_InitStruct BaudRate field, should be valid (different from 0).
  178. * @param USARTx USART Instance
  179. * @param USART_InitStruct pointer to a LL_USART_InitTypeDef structure
  180. * that contains the configuration information for the specified USART peripheral.
  181. * @retval An ErrorStatus enumeration value:
  182. * - SUCCESS: USART registers are initialized according to USART_InitStruct content
  183. * - ERROR: Problem occurred during USART Registers initialization
  184. */
  185. ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, const LL_USART_InitTypeDef *USART_InitStruct)
  186. {
  187. ErrorStatus status = ERROR;
  188. uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO;
  189. /* Check the parameters */
  190. assert_param(IS_UART_INSTANCE(USARTx));
  191. #if defined(USART_PRESC_PRESCALER)
  192. assert_param(IS_LL_USART_PRESCALER(USART_InitStruct->PrescalerValue));
  193. #endif /* USART_PRESC_PRESCALER */
  194. assert_param(IS_LL_USART_BAUDRATE(USART_InitStruct->BaudRate));
  195. assert_param(IS_LL_USART_DATAWIDTH(USART_InitStruct->DataWidth));
  196. assert_param(IS_LL_USART_STOPBITS(USART_InitStruct->StopBits));
  197. assert_param(IS_LL_USART_PARITY(USART_InitStruct->Parity));
  198. assert_param(IS_LL_USART_DIRECTION(USART_InitStruct->TransferDirection));
  199. assert_param(IS_LL_USART_HWCONTROL(USART_InitStruct->HardwareFlowControl));
  200. assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling));
  201. /* USART needs to be in disabled state, in order to be able to configure some bits in
  202. CRx registers */
  203. if (LL_USART_IsEnabled(USARTx) == 0U)
  204. {
  205. /*---------------------------- USART CR1 Configuration ---------------------
  206. * Configure USARTx CR1 (USART Word Length, Parity, Mode and Oversampling bits) with parameters:
  207. * - DataWidth: USART_CR1_M bits according to USART_InitStruct->DataWidth value
  208. * - Parity: USART_CR1_PCE, USART_CR1_PS bits according to USART_InitStruct->Parity value
  209. * - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to USART_InitStruct->TransferDirection value
  210. * - Oversampling: USART_CR1_OVER8 bit according to USART_InitStruct->OverSampling value.
  211. */
  212. MODIFY_REG(USARTx->CR1,
  213. (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS |
  214. USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8),
  215. (USART_InitStruct->DataWidth | USART_InitStruct->Parity |
  216. USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling));
  217. /*---------------------------- USART CR2 Configuration ---------------------
  218. * Configure USARTx CR2 (Stop bits) with parameters:
  219. * - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value.
  220. * - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit().
  221. */
  222. LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits);
  223. /*---------------------------- USART CR3 Configuration ---------------------
  224. * Configure USARTx CR3 (Hardware Flow Control) with parameters:
  225. * - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to
  226. * USART_InitStruct->HardwareFlowControl value.
  227. */
  228. LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl);
  229. /*---------------------------- USART BRR Configuration ---------------------
  230. * Retrieve Clock frequency used for USART Peripheral
  231. */
  232. if (USARTx == USART1)
  233. {
  234. periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART1_CLKSOURCE);
  235. }
  236. else if (USARTx == USART2)
  237. {
  238. periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART2_CLKSOURCE);
  239. }
  240. #if defined(USART3)
  241. else if (USARTx == USART3)
  242. {
  243. periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART3_CLKSOURCE);
  244. }
  245. #endif /* USART3 */
  246. #if defined(UART4)
  247. else if (USARTx == UART4)
  248. {
  249. periphclk = LL_RCC_GetUARTClockFreq(LL_RCC_UART4_CLKSOURCE);
  250. }
  251. #endif /* UART4 */
  252. #if defined(UART5)
  253. else if (USARTx == UART5)
  254. {
  255. periphclk = LL_RCC_GetUARTClockFreq(LL_RCC_UART5_CLKSOURCE);
  256. }
  257. #endif /* UART5 */
  258. else
  259. {
  260. /* Nothing to do, as error code is already assigned to ERROR value */
  261. }
  262. /* Configure the USART Baud Rate :
  263. #if defined(USART_PRESC_PRESCALER)
  264. - prescaler value is required
  265. #endif
  266. - valid baud rate value (different from 0) is required
  267. - Peripheral clock as returned by RCC service, should be valid (different from 0).
  268. */
  269. if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO)
  270. && (USART_InitStruct->BaudRate != 0U))
  271. {
  272. status = SUCCESS;
  273. LL_USART_SetBaudRate(USARTx,
  274. periphclk,
  275. #if defined(USART_PRESC_PRESCALER)
  276. USART_InitStruct->PrescalerValue,
  277. #endif /* USART_PRESC_PRESCALER */
  278. USART_InitStruct->OverSampling,
  279. USART_InitStruct->BaudRate);
  280. /* Check BRR is greater than or equal to 16d */
  281. assert_param(IS_LL_USART_BRR_MIN(USARTx->BRR));
  282. }
  283. #if defined(USART_PRESC_PRESCALER)
  284. /*---------------------------- USART PRESC Configuration -----------------------
  285. * Configure USARTx PRESC (Prescaler) with parameters:
  286. * - PrescalerValue: USART_PRESC_PRESCALER bits according to USART_InitStruct->PrescalerValue value.
  287. */
  288. LL_USART_SetPrescaler(USARTx, USART_InitStruct->PrescalerValue);
  289. #endif /* USART_PRESC_PRESCALER */
  290. }
  291. /* Endif (=> USART not in Disabled state => return ERROR) */
  292. return (status);
  293. }
  294. /**
  295. * @brief Set each @ref LL_USART_InitTypeDef field to default value.
  296. * @param USART_InitStruct pointer to a @ref LL_USART_InitTypeDef structure
  297. * whose fields will be set to default values.
  298. * @retval None
  299. */
  300. void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct)
  301. {
  302. /* Set USART_InitStruct fields to default values */
  303. #if defined(USART_PRESC_PRESCALER)
  304. USART_InitStruct->PrescalerValue = LL_USART_PRESCALER_DIV1;
  305. #endif /* USART_PRESC_PRESCALER */
  306. USART_InitStruct->BaudRate = USART_DEFAULT_BAUDRATE;
  307. USART_InitStruct->DataWidth = LL_USART_DATAWIDTH_8B;
  308. USART_InitStruct->StopBits = LL_USART_STOPBITS_1;
  309. USART_InitStruct->Parity = LL_USART_PARITY_NONE ;
  310. USART_InitStruct->TransferDirection = LL_USART_DIRECTION_TX_RX;
  311. USART_InitStruct->HardwareFlowControl = LL_USART_HWCONTROL_NONE;
  312. USART_InitStruct->OverSampling = LL_USART_OVERSAMPLING_16;
  313. }
  314. /**
  315. * @brief Initialize USART Clock related settings according to the
  316. * specified parameters in the USART_ClockInitStruct.
  317. * @note As some bits in USART configuration registers can only be written when
  318. * the USART is disabled (USART_CR1_UE bit =0), USART Peripheral should be in disabled state prior calling
  319. * this function. Otherwise, ERROR result will be returned.
  320. * @param USARTx USART Instance
  321. * @param USART_ClockInitStruct pointer to a @ref LL_USART_ClockInitTypeDef structure
  322. * that contains the Clock configuration information for the specified USART peripheral.
  323. * @retval An ErrorStatus enumeration value:
  324. * - SUCCESS: USART registers related to Clock settings are initialized according
  325. * to USART_ClockInitStruct content
  326. * - ERROR: Problem occurred during USART Registers initialization
  327. */
  328. ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, const LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
  329. {
  330. ErrorStatus status = SUCCESS;
  331. /* Check USART Instance and Clock signal output parameters */
  332. assert_param(IS_UART_INSTANCE(USARTx));
  333. assert_param(IS_LL_USART_CLOCKOUTPUT(USART_ClockInitStruct->ClockOutput));
  334. /* USART needs to be in disabled state, in order to be able to configure some bits in
  335. CRx registers */
  336. if (LL_USART_IsEnabled(USARTx) == 0U)
  337. {
  338. #if defined(USART_CR2_SLVEN)
  339. /* Ensure USART instance is USART capable */
  340. assert_param(IS_USART_INSTANCE(USARTx));
  341. /* Check clock related parameters */
  342. assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity));
  343. assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase));
  344. assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse));
  345. /*---------------------------- USART CR2 Configuration -----------------------
  346. * Configure USARTx CR2 (Clock signal related bits) with parameters:
  347. * - Clock Output: USART_CR2_CLKEN bit according to USART_ClockInitStruct->ClockOutput value
  348. * - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value
  349. * - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value
  350. * - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value.
  351. */
  352. MODIFY_REG(USARTx->CR2,
  353. USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL,
  354. USART_ClockInitStruct->ClockOutput | USART_ClockInitStruct->ClockPolarity |
  355. USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse);
  356. #else
  357. /* If USART Clock signal is disabled */
  358. if (USART_ClockInitStruct->ClockOutput == LL_USART_CLOCK_DISABLE)
  359. {
  360. /* Deactivate Clock signal delivery :
  361. * - Disable Clock Output: USART_CR2_CLKEN cleared
  362. */
  363. LL_USART_DisableSCLKOutput(USARTx);
  364. }
  365. else
  366. {
  367. /* Ensure USART instance is USART capable */
  368. assert_param(IS_USART_INSTANCE(USARTx));
  369. /* Check clock related parameters */
  370. assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity));
  371. assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase));
  372. assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse));
  373. /*---------------------------- USART CR2 Configuration -----------------------
  374. * Configure USARTx CR2 (Clock signal related bits) with parameters:
  375. * - Enable Clock Output: USART_CR2_CLKEN set
  376. * - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value
  377. * - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value
  378. * - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value.
  379. */
  380. MODIFY_REG(USARTx->CR2,
  381. USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL,
  382. USART_CR2_CLKEN | USART_ClockInitStruct->ClockPolarity |
  383. USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse);
  384. }
  385. #endif /* USART_CR2_SLVEN */
  386. }
  387. /* Else (USART not in Disabled state => return ERROR */
  388. else
  389. {
  390. status = ERROR;
  391. }
  392. return (status);
  393. }
  394. /**
  395. * @brief Set each field of a @ref LL_USART_ClockInitTypeDef type structure to default value.
  396. * @param USART_ClockInitStruct pointer to a @ref LL_USART_ClockInitTypeDef structure
  397. * whose fields will be set to default values.
  398. * @retval None
  399. */
  400. void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
  401. {
  402. /* Set LL_USART_ClockInitStruct fields with default values */
  403. USART_ClockInitStruct->ClockOutput = LL_USART_CLOCK_DISABLE;
  404. USART_ClockInitStruct->ClockPolarity = LL_USART_POLARITY_LOW; /* Not relevant when ClockOutput =
  405. LL_USART_CLOCK_DISABLE */
  406. USART_ClockInitStruct->ClockPhase = LL_USART_PHASE_1EDGE; /* Not relevant when ClockOutput =
  407. LL_USART_CLOCK_DISABLE */
  408. USART_ClockInitStruct->LastBitClockPulse = LL_USART_LASTCLKPULSE_NO_OUTPUT; /* Not relevant when ClockOutput =
  409. LL_USART_CLOCK_DISABLE */
  410. }
  411. /**
  412. * @}
  413. */
  414. /**
  415. * @}
  416. */
  417. /**
  418. * @}
  419. */
  420. #endif /* USART1 || USART2 || USART3 || UART4 || UART5 */
  421. /**
  422. * @}
  423. */
  424. #endif /* USE_FULL_LL_DRIVER */