py32f002b_ll_adc.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. /**
  2. ******************************************************************************
  3. * @file py32f002b_ll_adc.c
  4. * @author MCU Application Team
  5. * @brief ADC LL module driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by Puya under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. #if defined(USE_FULL_LL_DRIVER)
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "py32f002b_ll_adc.h"
  33. #include "py32f002b_ll_bus.h"
  34. #ifdef USE_FULL_ASSERT
  35. #include "py32_assert.h"
  36. #else
  37. #define assert_param(expr) ((void)0U)
  38. #endif
  39. /** @addtogroup PY32F002B_LL_Driver
  40. * @{
  41. */
  42. #if defined (ADC1)
  43. /** @addtogroup ADC_LL ADC
  44. * @{
  45. */
  46. /* Private types -------------------------------------------------------------*/
  47. /* Private variables ---------------------------------------------------------*/
  48. /* Private constants ---------------------------------------------------------*/
  49. /** @addtogroup ADC_LL_Private_Constants
  50. * @{
  51. */
  52. /* Definitions of ADC hardware constraints delays */
  53. /* Note: Only ADC IP HW delays are defined in ADC LL driver driver, */
  54. /* not timeout values: */
  55. /* Timeout values for ADC operations are dependent to device clock */
  56. /* configuration (system clock versus ADC clock), */
  57. /* and therefore must be defined in user application. */
  58. /* Refer to @ref ADC_LL_EC_HW_DELAYS for description of ADC timeout */
  59. /* values definition. */
  60. /* Unit: CPU cycles. */
  61. #define ADC_CLOCK_RATIO_VS_CPU_HIGHEST ((uint32_t) 512U * 16U * 4U)
  62. #define ADC_TIMEOUT_DISABLE_CPU_CYCLES (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 1U)
  63. #define ADC_TIMEOUT_STOP_CONVERSION_CPU_CYCLES (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 1U)
  64. /**
  65. * @}
  66. */
  67. /* Private macros ------------------------------------------------------------*/
  68. /** @addtogroup ADC_LL_Private_Macros ADC Private Macros
  69. * @{
  70. */
  71. /* Check of parameters for configuration of ADC hierarchical scope: */
  72. /* common to several ADC instances. */
  73. /* Check of parameters for configuration of ADC hierarchical scope: */
  74. /* ADC instance. */
  75. #define IS_LL_ADC_CLOCK(__CLOCK__) \
  76. ( ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV64) \
  77. || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV32) \
  78. || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV16) \
  79. || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV8) \
  80. || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV4) \
  81. || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV2) \
  82. || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV1) \
  83. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV64) \
  84. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV32) \
  85. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV16) \
  86. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV8) \
  87. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV4) \
  88. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV2) \
  89. || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_HSI_DIV1) \
  90. )
  91. #define IS_LL_ADC_RESOLUTION(__RESOLUTION__) \
  92. ( ((__RESOLUTION__) == LL_ADC_RESOLUTION_12B) \
  93. || ((__RESOLUTION__) == LL_ADC_RESOLUTION_10B) \
  94. || ((__RESOLUTION__) == LL_ADC_RESOLUTION_8B) \
  95. || ((__RESOLUTION__) == LL_ADC_RESOLUTION_6B) \
  96. )
  97. #define IS_LL_ADC_DATA_ALIGN(__DATA_ALIGN__) \
  98. ( ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_RIGHT) \
  99. || ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_LEFT) \
  100. )
  101. #define IS_LL_ADC_LOW_POWER(__LOW_POWER__) \
  102. ( ((__LOW_POWER__) == LL_ADC_LP_MODE_NONE) \
  103. || ((__LOW_POWER__) == LL_ADC_LP_AUTOWAIT) \
  104. )
  105. /* Check of parameters for configuration of ADC hierarchical scope: */
  106. /* ADC group regular */
  107. #define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
  108. ( ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
  109. || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO) \
  110. || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH4) \
  111. )
  112. #define IS_LL_ADC_REG_CONTINUOUS_MODE(__REG_CONTINUOUS_MODE__) \
  113. ( ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_SINGLE) \
  114. || ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_CONTINUOUS) \
  115. )
  116. #define IS_LL_ADC_REG_OVR_DATA_BEHAVIOR(__REG_OVR_DATA_BEHAVIOR__) \
  117. ( ((__REG_OVR_DATA_BEHAVIOR__) == LL_ADC_REG_OVR_DATA_PRESERVED) \
  118. || ((__REG_OVR_DATA_BEHAVIOR__) == LL_ADC_REG_OVR_DATA_OVERWRITTEN) \
  119. )
  120. #define IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(__REG_SEQ_DISCONT_MODE__) \
  121. ( ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_DISABLE) \
  122. || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_1RANK) \
  123. )
  124. /**
  125. * @}
  126. */
  127. /* Private function prototypes -----------------------------------------------*/
  128. /* Exported functions --------------------------------------------------------*/
  129. /** @defgroup ADC_LL_Exported_Functions ADC Exported Functions
  130. * @{
  131. */
  132. /** @addtogroup ADC_LL_EF_Init
  133. * @{
  134. */
  135. /**
  136. * @brief De-initialize registers of all ADC instances belonging to
  137. * the same ADC common instance to their default reset values.
  138. * @note This function is performing a hard reset, using high level
  139. * clock source RCC ADC reset.
  140. * @param ADCxy_COMMON ADC common instance
  141. * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
  142. * @retval An ErrorStatus enumeration value:
  143. * - SUCCESS: ADC common registers are de-initialized
  144. * - ERROR: not applicable
  145. */
  146. ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON)
  147. {
  148. /* Check the parameters */
  149. assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
  150. /* Force reset of ADC clock (core clock) */
  151. LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_ADC1);
  152. /* Release reset of ADC clock (core clock) */
  153. LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_ADC1);
  154. return SUCCESS;
  155. }
  156. /**
  157. * @brief De-initialize registers of the selected ADC instance
  158. * to their default reset values.
  159. * @note To reset all ADC instances quickly (perform a hard reset),
  160. * use function @ref LL_ADC_CommonDeInit().
  161. * @note If this functions returns error status, it means that ADC instance
  162. * is in an unknown state.
  163. * In this case, perform a hard reset using high level
  164. * clock source RCC ADC reset.
  165. * Refer to function @ref LL_ADC_CommonDeInit().
  166. * @param ADCx ADC instance
  167. * @retval An ErrorStatus enumeration value:
  168. * - SUCCESS: ADC registers are de-initialized
  169. * - ERROR: ADC registers are not de-initialized
  170. */
  171. ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx)
  172. {
  173. ErrorStatus status = SUCCESS;
  174. __IO uint32_t timeout_cpu_cycles = 0U;
  175. /* Check the parameters */
  176. assert_param(IS_ADC_ALL_INSTANCE(ADCx));
  177. /* Disable ADC instance if not already disabled. */
  178. if(LL_ADC_IsEnabled(ADCx) == 1U)
  179. {
  180. /* Set ADC group regular trigger source to SW start to ensure to not */
  181. /* have an external trigger event occurring during the conversion stop */
  182. /* ADC disable process. */
  183. LL_ADC_REG_SetTriggerSource(ADCx, LL_ADC_REG_TRIG_SOFTWARE);
  184. /* Stop potential ADC conversion on going on ADC group regular. */
  185. if(LL_ADC_REG_IsConversionOngoing(ADCx) != 0U)
  186. {
  187. if(LL_ADC_REG_IsStopConversionOngoing(ADCx) == 0U)
  188. {
  189. LL_ADC_REG_StopConversion(ADCx);
  190. }
  191. }
  192. /* Wait for ADC conversions are effectively stopped */
  193. timeout_cpu_cycles = ADC_TIMEOUT_STOP_CONVERSION_CPU_CYCLES;
  194. while (LL_ADC_REG_IsStopConversionOngoing(ADCx) == 1U)
  195. {
  196. if(timeout_cpu_cycles-- == 0U)
  197. {
  198. /* Time-out error */
  199. status = ERROR;
  200. }
  201. }
  202. /* Disable the ADC instance */
  203. LL_ADC_Disable(ADCx);
  204. /* Wait for ADC instance is effectively disabled */
  205. timeout_cpu_cycles = ADC_TIMEOUT_DISABLE_CPU_CYCLES;
  206. while (LL_ADC_IsDisableOngoing(ADCx) == 1U)
  207. {
  208. if(timeout_cpu_cycles-- == 0U)
  209. {
  210. /* Time-out error */
  211. status = ERROR;
  212. }
  213. }
  214. }
  215. /* Check whether ADC state is compliant with expected state */
  216. if(READ_BIT(ADCx->CR,(ADC_CR_ADSTP | ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN ))== 0U)
  217. {
  218. /* ========== Reset ADC registers ========== */
  219. /* Reset register IER */
  220. CLEAR_BIT(ADCx->IER,
  221. ( LL_ADC_IT_EOC
  222. | LL_ADC_IT_EOS
  223. | LL_ADC_IT_OVR
  224. | LL_ADC_IT_EOSMP
  225. | LL_ADC_IT_AWD )
  226. );
  227. /* Reset register ISR */
  228. SET_BIT(ADCx->ISR,
  229. ( LL_ADC_FLAG_EOC
  230. | LL_ADC_FLAG_EOS
  231. | LL_ADC_FLAG_OVR
  232. | LL_ADC_FLAG_EOSMP
  233. | LL_ADC_FLAG_AWD )
  234. );
  235. /* Reset register CR */
  236. /* Bits ADC_CR_VREFBUFF_SEL, ADC_CR_VREF_BUFFERE */
  237. CLEAR_BIT(ADCx->CR,(ADC_CR_VREFBUFF_SEL | ADC_CR_VREF_BUFFERE) );
  238. /* Reset register CFGR1 */
  239. CLEAR_BIT(ADCx->CFGR1,
  240. ( ADC_CFGR1_AWDCH | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL | ADC_CFGR1_DISCEN
  241. | ADC_CFGR1_WAIT | ADC_CFGR1_CONT | ADC_CFGR1_OVRMOD
  242. | ADC_CFGR1_EXTEN | ADC_CFGR1_EXTSEL | ADC_CFGR1_ALIGN | ADC_CFGR1_RESSEL
  243. | ADC_CFGR1_SCANDIR )
  244. );
  245. /* Reset register CFGR2 */
  246. /* Note: Update of ADC clock mode is conditioned to ADC state disabled: */
  247. /* already done above. */
  248. CLEAR_BIT(ADCx->CFGR2, ADC_CFGR2_CKMODE);
  249. /* Reset register SMPR */
  250. CLEAR_BIT(ADCx->SMPR, ADC_SMPR_SMP);
  251. /* Reset register TR */
  252. MODIFY_REG(ADCx->TR, ADC_TR_HT | ADC_TR_LT, ADC_TR_HT);
  253. /* Reset register CHSELR */
  254. #if defined(ADC_CHSELR_CHSEL10)
  255. CLEAR_BIT(ADCx->CHSELR,
  256. ( ADC_CHSELR_CHSEL10 | ADC_CHSELR_CHSEL9 | ADC_CHSELR_CHSEL8
  257. | ADC_CHSELR_CHSEL7 | ADC_CHSELR_CHSEL6 | ADC_CHSELR_CHSEL5 | ADC_CHSELR_CHSEL4
  258. | ADC_CHSELR_CHSEL3 | ADC_CHSELR_CHSEL2 | ADC_CHSELR_CHSEL1 | ADC_CHSELR_CHSEL0 )
  259. );
  260. #else
  261. CLEAR_BIT(ADCx->CHSELR,
  262. ( ADC_CHSELR_CHSEL9 | ADC_CHSELR_CHSEL8
  263. | ADC_CHSELR_CHSEL7 | ADC_CHSELR_CHSEL6 | ADC_CHSELR_CHSEL5 | ADC_CHSELR_CHSEL4
  264. | ADC_CHSELR_CHSEL3 | ADC_CHSELR_CHSEL2 | ADC_CHSELR_CHSEL1 | ADC_CHSELR_CHSEL0 )
  265. );
  266. #endif
  267. /* Reset register CCR */
  268. CLEAR_BIT(__LL_ADC_COMMON_INSTANCE(ADC1)->CCR,ADC_CCR_TSEN | ADC_CCR_VREFEN);
  269. /* Reset register DR */
  270. /* bits in access mode read only, no direct reset applicable */
  271. }
  272. else
  273. {
  274. /* ADC instance is in an unknown state */
  275. /* Need to performing a hard reset of ADC instance, using high level */
  276. /* clock source RCC ADC reset. */
  277. status = ERROR;
  278. }
  279. return status;
  280. }
  281. /**
  282. * @brief Initialize some features of ADC instance.
  283. * @note These parameters have an impact on ADC scope: ADC instance.
  284. * Refer to corresponding unitary functions into
  285. * @ref ADC_LL_EF_Configuration_ADC_Instance .
  286. * @note After using this function, some other features must be configured
  287. * using LL unitary functions.
  288. * The minimum configuration remaining to be done is:
  289. * - Set ADC group regular sequencer:
  290. * map channel on rank corresponding to channel number.
  291. * Refer to function @ref LL_ADC_REG_SetSequencerChannels();
  292. * - Set ADC channel sampling time
  293. * Refer to function LL_ADC_SetChannelSamplingTime();
  294. * @param ADCx ADC instance
  295. * @param ADC_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
  296. * @retval An ErrorStatus enumeration value:
  297. * - SUCCESS: ADC registers are initialized
  298. * - ERROR: ADC registers are not initialized
  299. */
  300. ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct)
  301. {
  302. ErrorStatus status = SUCCESS;
  303. /* Check the parameters */
  304. assert_param(IS_ADC_ALL_INSTANCE(ADCx));
  305. assert_param(IS_LL_ADC_CLOCK(ADC_InitStruct->Clock));
  306. assert_param(IS_LL_ADC_RESOLUTION(ADC_InitStruct->Resolution));
  307. assert_param(IS_LL_ADC_DATA_ALIGN(ADC_InitStruct->DataAlignment));
  308. assert_param(IS_LL_ADC_LOW_POWER(ADC_InitStruct->LowPowerMode));
  309. /* Note: Hardware constraint (refer to description of this function): */
  310. /* ADC instance must be disabled. */
  311. if(LL_ADC_IsEnabled(ADCx) == 0U)
  312. {
  313. /* Configuration of ADC hierarchical scope: */
  314. /* - ADC instance */
  315. /* - Set ADC data resolution */
  316. /* - Set ADC conversion data alignment */
  317. /* - Set ADC low power mode */
  318. MODIFY_REG(ADCx->CFGR1,
  319. ADC_CFGR1_RESSEL
  320. | ADC_CFGR1_ALIGN
  321. | ADC_CFGR1_WAIT
  322. ,
  323. ADC_InitStruct->Resolution
  324. | ADC_InitStruct->DataAlignment
  325. | ADC_InitStruct->LowPowerMode
  326. );
  327. MODIFY_REG(ADCx->CFGR2,
  328. ADC_CFGR2_CKMODE
  329. ,
  330. ADC_InitStruct->Clock
  331. );
  332. }
  333. else
  334. {
  335. /* Initialization error: ADC instance is not disabled. */
  336. status = ERROR;
  337. }
  338. return status;
  339. }
  340. /**
  341. * @brief Set each @ref LL_ADC_InitTypeDef field to default value.
  342. * @param ADC_InitStruct Pointer to a @ref LL_ADC_InitTypeDef structure
  343. * whose fields will be set to default values.
  344. * @retval None
  345. */
  346. void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct)
  347. {
  348. /* Set ADC_InitStruct fields to default values */
  349. /* Set fields of ADC instance */
  350. ADC_InitStruct->Clock = LL_ADC_CLOCK_SYNC_PCLK_DIV2;
  351. ADC_InitStruct->Resolution = LL_ADC_RESOLUTION_12B;
  352. ADC_InitStruct->DataAlignment = LL_ADC_DATA_ALIGN_RIGHT;
  353. ADC_InitStruct->LowPowerMode = LL_ADC_LP_MODE_NONE;
  354. }
  355. /**
  356. * @brief Initialize some features of ADC group regular.
  357. * @note These parameters have an impact on ADC scope: ADC group regular.
  358. * Refer to corresponding unitary functions into
  359. * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
  360. * (functions with prefix "REG").
  361. * @note After using this function, other features must be configured
  362. * using LL unitary functions.
  363. * The minimum configuration remaining to be done is:
  364. * - Set ADC group regular sequencer:
  365. * map channel on rank corresponding to channel number.
  366. * Refer to function @ref LL_ADC_REG_SetSequencerChannels();
  367. * - Set ADC channel sampling time
  368. * Refer to function LL_ADC_SetChannelSamplingTime();
  369. * @note Depending on devices and packages, DMA may not be available.
  370. * Refer to device datasheet for DMA availability.
  371. * @param ADCx ADC instance
  372. * @param ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
  373. * @retval An ErrorStatus enumeration value:
  374. * - SUCCESS: ADC registers are initialized
  375. * - ERROR: ADC registers are not initialized
  376. */
  377. ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
  378. {
  379. ErrorStatus status = SUCCESS;
  380. /* Check the parameters */
  381. assert_param(IS_ADC_ALL_INSTANCE(ADCx));
  382. assert_param(IS_LL_ADC_REG_TRIG_SOURCE(ADC_REG_InitStruct->TriggerSource));
  383. assert_param(IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(ADC_REG_InitStruct->SequencerDiscont));
  384. assert_param(IS_LL_ADC_REG_CONTINUOUS_MODE(ADC_REG_InitStruct->ContinuousMode));
  385. assert_param(IS_LL_ADC_REG_OVR_DATA_BEHAVIOR(ADC_REG_InitStruct->Overrun));
  386. /* Note: Hardware constraint (refer to description of this function): */
  387. /* ADC instance must be disabled. */
  388. if(LL_ADC_IsEnabled(ADCx) == 0U)
  389. {
  390. /* Configuration of ADC hierarchical scope: */
  391. /* - ADC group regular */
  392. /* - Set ADC group regular trigger source */
  393. /* - Set ADC group regular sequencer discontinuous mode */
  394. /* - Set ADC group regular continuous mode */
  395. /* - Set ADC group regular overrun behavior */
  396. MODIFY_REG(ADCx->CFGR1,
  397. ADC_CFGR1_EXTSEL
  398. | ADC_CFGR1_EXTEN
  399. | ADC_CFGR1_DISCEN
  400. | ADC_CFGR1_CONT
  401. | ADC_CFGR1_OVRMOD
  402. ,
  403. ADC_REG_InitStruct->TriggerSource
  404. | ADC_REG_InitStruct->SequencerDiscont
  405. | ADC_REG_InitStruct->ContinuousMode
  406. | ADC_REG_InitStruct->Overrun
  407. );
  408. }
  409. else
  410. {
  411. /* Initialization error: ADC instance is not disabled. */
  412. status = ERROR;
  413. }
  414. return status;
  415. }
  416. /**
  417. * @brief Set each @ref LL_ADC_REG_InitTypeDef field to default value.
  418. * @param ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
  419. * whose fields will be set to default values.
  420. * @retval None
  421. */
  422. void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
  423. {
  424. /* Set ADC_REG_InitStruct fields to default values */
  425. /* Set fields of ADC group regular */
  426. ADC_REG_InitStruct->TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
  427. ADC_REG_InitStruct->SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
  428. ADC_REG_InitStruct->ContinuousMode = LL_ADC_REG_CONV_SINGLE;
  429. ADC_REG_InitStruct->Overrun = LL_ADC_REG_OVR_DATA_OVERWRITTEN;
  430. }
  431. /**
  432. * @}
  433. */
  434. /**
  435. * @}
  436. */
  437. /**
  438. * @}
  439. */
  440. #endif /* ADC1 */
  441. /**
  442. * @}
  443. */
  444. #endif /* USE_FULL_LL_DRIVER */
  445. /************************ (C) COPYRIGHT Puya *****END OF FILE****/