em_adc.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /***************************************************************************//**
  2. * @file
  3. * @brief Analog to Digital Converter (ADC) peripheral API
  4. * @author Energy Micro AS
  5. * @version 3.0.0
  6. *******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
  9. *******************************************************************************
  10. *
  11. * Permission is granted to anyone to use this software for any purpose,
  12. * including commercial applications, and to alter it and redistribute it
  13. * freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not
  16. * claim that you wrote the original software.
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. * 3. This notice may not be removed or altered from any source distribution.
  20. *
  21. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  22. * obligation to support this Software. Energy Micro AS is providing the
  23. * Software "AS IS", with no express or implied warranties of any kind,
  24. * including, but not limited to, any implied warranties of merchantability
  25. * or fitness for any particular purpose or warranties against infringement
  26. * of any proprietary rights of a third party.
  27. *
  28. * Energy Micro AS will not be liable for any consequential, incidental, or
  29. * special damages, or any other relief, or for any claim by any third party,
  30. * arising from your use of this Software.
  31. *
  32. ******************************************************************************/
  33. #ifndef __EM_ADC_H
  34. #define __EM_ADC_H
  35. #include <stdbool.h>
  36. #include "em_part.h"
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /***************************************************************************//**
  41. * @addtogroup EM_Library
  42. * @{
  43. ******************************************************************************/
  44. /***************************************************************************//**
  45. * @addtogroup ADC
  46. * @{
  47. ******************************************************************************/
  48. /*******************************************************************************
  49. ******************************** ENUMS ************************************
  50. ******************************************************************************/
  51. /** Acquisition time (in ADC clock cycles). */
  52. typedef enum
  53. {
  54. adcAcqTime1 = _ADC_SINGLECTRL_AT_1CYCLE, /**< 1 clock cycle. */
  55. adcAcqTime2 = _ADC_SINGLECTRL_AT_2CYCLES, /**< 2 clock cycles. */
  56. adcAcqTime4 = _ADC_SINGLECTRL_AT_4CYCLES, /**< 4 clock cycles. */
  57. adcAcqTime8 = _ADC_SINGLECTRL_AT_8CYCLES, /**< 8 clock cycles. */
  58. adcAcqTime16 = _ADC_SINGLECTRL_AT_16CYCLES, /**< 16 clock cycles. */
  59. adcAcqTime32 = _ADC_SINGLECTRL_AT_32CYCLES, /**< 32 clock cycles. */
  60. adcAcqTime64 = _ADC_SINGLECTRL_AT_64CYCLES, /**< 64 clock cycles. */
  61. adcAcqTime128 = _ADC_SINGLECTRL_AT_128CYCLES, /**< 128 clock cycles. */
  62. adcAcqTime256 = _ADC_SINGLECTRL_AT_256CYCLES /**< 256 clock cycles. */
  63. } ADC_AcqTime_TypeDef;
  64. /** Lowpass filter mode. */
  65. typedef enum
  66. {
  67. /** No filter or decoupling capacitor. */
  68. adcLPFilterBypass = _ADC_CTRL_LPFMODE_BYPASS,
  69. /** On-chip RC filter. */
  70. adcLPFilterRC = _ADC_CTRL_LPFMODE_RCFILT,
  71. /** On-chip decoupling capacitor. */
  72. adcLPFilterDeCap = _ADC_CTRL_LPFMODE_DECAP
  73. } ADC_LPFilter_TypeDef;
  74. /** Oversample rate select. */
  75. typedef enum
  76. {
  77. /** 2 samples per conversion result. */
  78. adcOvsRateSel2 = _ADC_CTRL_OVSRSEL_X2,
  79. /** 4 samples per conversion result. */
  80. adcOvsRateSel4 = _ADC_CTRL_OVSRSEL_X4,
  81. /** 8 samples per conversion result. */
  82. adcOvsRateSel8 = _ADC_CTRL_OVSRSEL_X8,
  83. /** 16 samples per conversion result. */
  84. adcOvsRateSel16 = _ADC_CTRL_OVSRSEL_X16,
  85. /** 32 samples per conversion result. */
  86. adcOvsRateSel32 = _ADC_CTRL_OVSRSEL_X32,
  87. /** 64 samples per conversion result. */
  88. adcOvsRateSel64 = _ADC_CTRL_OVSRSEL_X64,
  89. /** 128 samples per conversion result. */
  90. adcOvsRateSel128 = _ADC_CTRL_OVSRSEL_X128,
  91. /** 256 samples per conversion result. */
  92. adcOvsRateSel256 = _ADC_CTRL_OVSRSEL_X256,
  93. /** 512 samples per conversion result. */
  94. adcOvsRateSel512 = _ADC_CTRL_OVSRSEL_X512,
  95. /** 1024 samples per conversion result. */
  96. adcOvsRateSel1024 = _ADC_CTRL_OVSRSEL_X1024,
  97. /** 2048 samples per conversion result. */
  98. adcOvsRateSel2048 = _ADC_CTRL_OVSRSEL_X2048,
  99. /** 4096 samples per conversion result. */
  100. adcOvsRateSel4096 = _ADC_CTRL_OVSRSEL_X4096
  101. } ADC_OvsRateSel_TypeDef;
  102. /** Peripheral Reflex System signal used to trigger single sample. */
  103. typedef enum
  104. {
  105. adcPRSSELCh0 = _ADC_SINGLECTRL_PRSSEL_PRSCH0, /**< PRS channel 0. */
  106. adcPRSSELCh1 = _ADC_SINGLECTRL_PRSSEL_PRSCH1, /**< PRS channel 1. */
  107. adcPRSSELCh2 = _ADC_SINGLECTRL_PRSSEL_PRSCH2, /**< PRS channel 2. */
  108. adcPRSSELCh3 = _ADC_SINGLECTRL_PRSSEL_PRSCH3, /**< PRS channel 3. */
  109. adcPRSSELCh4 = _ADC_SINGLECTRL_PRSSEL_PRSCH4, /**< PRS channel 4. */
  110. adcPRSSELCh5 = _ADC_SINGLECTRL_PRSSEL_PRSCH5, /**< PRS channel 5. */
  111. adcPRSSELCh6 = _ADC_SINGLECTRL_PRSSEL_PRSCH6, /**< PRS channel 6. */
  112. adcPRSSELCh7 = _ADC_SINGLECTRL_PRSSEL_PRSCH7 /**< PRS channel 7. */
  113. } ADC_PRSSEL_TypeDef;
  114. /** Reference to ADC sample. */
  115. typedef enum
  116. {
  117. /** Internal 1.25V reference. */
  118. adcRef1V25 = _ADC_SINGLECTRL_REF_1V25,
  119. /** Internal 2.5V reference. */
  120. adcRef2V5 = _ADC_SINGLECTRL_REF_2V5,
  121. /** Buffered VDD. */
  122. adcRefVDD = _ADC_SINGLECTRL_REF_VDD,
  123. /** Internal differential 5V reference. */
  124. adcRef5VDIFF = _ADC_SINGLECTRL_REF_5VDIFF,
  125. /** Single ended ext. ref. from pin 6. */
  126. adcRefExtSingle = _ADC_SINGLECTRL_REF_EXTSINGLE,
  127. /** Differential ext. ref. from pin 6 and 7. */
  128. adcRef2xExtDiff = _ADC_SINGLECTRL_REF_2XEXTDIFF,
  129. /** Unbuffered 2xVDD. */
  130. adcRef2xVDD = _ADC_SINGLECTRL_REF_2XVDD
  131. } ADC_Ref_TypeDef;
  132. /** Sample resolution. */
  133. typedef enum
  134. {
  135. adcRes12Bit = _ADC_SINGLECTRL_RES_12BIT, /**< 12 bit sampling. */
  136. adcRes8Bit = _ADC_SINGLECTRL_RES_8BIT, /**< 8 bit sampling. */
  137. adcRes6Bit = _ADC_SINGLECTRL_RES_6BIT, /**< 6 bit sampling. */
  138. adcResOVS = _ADC_SINGLECTRL_RES_OVS /**< Oversampling. */
  139. } ADC_Res_TypeDef;
  140. /** Single sample input selection. */
  141. typedef enum
  142. {
  143. /* Differential mode disabled */
  144. adcSingleInpCh0 = _ADC_SINGLECTRL_INPUTSEL_CH0, /**< Channel 0. */
  145. adcSingleInpCh1 = _ADC_SINGLECTRL_INPUTSEL_CH1, /**< Channel 1. */
  146. adcSingleInpCh2 = _ADC_SINGLECTRL_INPUTSEL_CH2, /**< Channel 2. */
  147. adcSingleInpCh3 = _ADC_SINGLECTRL_INPUTSEL_CH3, /**< Channel 3. */
  148. adcSingleInpCh4 = _ADC_SINGLECTRL_INPUTSEL_CH4, /**< Channel 4. */
  149. adcSingleInpCh5 = _ADC_SINGLECTRL_INPUTSEL_CH5, /**< Channel 5. */
  150. adcSingleInpCh6 = _ADC_SINGLECTRL_INPUTSEL_CH6, /**< Channel 6. */
  151. adcSingleInpCh7 = _ADC_SINGLECTRL_INPUTSEL_CH7, /**< Channel 7. */
  152. adcSingleInpTemp = _ADC_SINGLECTRL_INPUTSEL_TEMP, /**< Temperature reference. */
  153. adcSingleInpVDDDiv3 = _ADC_SINGLECTRL_INPUTSEL_VDDDIV3, /**< VDD divided by 3. */
  154. adcSingleInpVDD = _ADC_SINGLECTRL_INPUTSEL_VDD, /**< VDD. */
  155. adcSingleInpVSS = _ADC_SINGLECTRL_INPUTSEL_VSS, /**< VSS. */
  156. adcSingleInpVrefDiv2 = _ADC_SINGLECTRL_INPUTSEL_VREFDIV2, /**< Vref divided by 2. */
  157. adcSingleInpDACOut0 = _ADC_SINGLECTRL_INPUTSEL_DAC0OUT0, /**< DAC output 0. */
  158. adcSingleInpDACOut1 = _ADC_SINGLECTRL_INPUTSEL_DAC0OUT1, /**< DAC output 1. */
  159. /* TBD: Use define when available */
  160. adcSingleInpATEST = 15, /**< ATEST. */
  161. /* Differential mode enabled */
  162. adcSingleInpCh0Ch1 = _ADC_SINGLECTRL_INPUTSEL_CH0CH1, /**< Positive Ch0, negative Ch1. */
  163. adcSingleInpCh2Ch3 = _ADC_SINGLECTRL_INPUTSEL_CH2CH3, /**< Positive Ch2, negative Ch3. */
  164. adcSingleInpCh4Ch5 = _ADC_SINGLECTRL_INPUTSEL_CH4CH5, /**< Positive Ch4, negative Ch5. */
  165. adcSingleInpCh6Ch7 = _ADC_SINGLECTRL_INPUTSEL_CH6CH7, /**< Positive Ch6, negative Ch7. */
  166. /* TBD: Use define when available */
  167. adcSingleInpDiff0 = 4 /**< Differential 0. */
  168. } ADC_SingleInput_TypeDef;
  169. /** Acquisition time (in ADC clock cycles). */
  170. typedef enum
  171. {
  172. /** Start single conversion. */
  173. adcStartSingle = ADC_CMD_SINGLESTART,
  174. /** Start scan sequence. */
  175. adcStartScan = ADC_CMD_SCANSTART,
  176. /**
  177. * Start scan sequence and single conversion, typically used when tailgating
  178. * single conversion after scan sequence.
  179. */
  180. adcStartScanAndSingle = ADC_CMD_SCANSTART | ADC_CMD_SINGLESTART
  181. } ADC_Start_TypeDef;
  182. /** Warm-up mode. */
  183. typedef enum
  184. {
  185. /** ADC shutdown after each conversion. */
  186. adcWarmupNormal = _ADC_CTRL_WARMUPMODE_NORMAL,
  187. /** Do not warm-up bandgap references. */
  188. adcWarmupFastBG = _ADC_CTRL_WARMUPMODE_FASTBG,
  189. /** Reference selected for scan mode kept warm.*/
  190. adcWarmupKeepScanRefWarm = _ADC_CTRL_WARMUPMODE_KEEPSCANREFWARM,
  191. /** ADC and reference selected for scan mode kept warm.*/
  192. adcWarmupKeepADCWarm = _ADC_CTRL_WARMUPMODE_KEEPADCWARM
  193. } ADC_Warmup_TypeDef;
  194. /*******************************************************************************
  195. ******************************* STRUCTS ***********************************
  196. ******************************************************************************/
  197. /** ADC init structure, common for single conversion and scan sequence. */
  198. typedef struct
  199. {
  200. /**
  201. * Oversampling rate select. In order to have any effect, oversampling must
  202. * be enabled for single/scan mode.
  203. */
  204. ADC_OvsRateSel_TypeDef ovsRateSel;
  205. /** Lowpass or decoupling capacitor filter to use. */
  206. ADC_LPFilter_TypeDef lpfMode;
  207. /** Warm-up mode to use for ADC. */
  208. ADC_Warmup_TypeDef warmUpMode;
  209. /**
  210. * Timebase used for ADC warm up. Select N to give (N+1)HFPERCLK cycles.
  211. * (Additional delay is added for bandgap references, please refer to the
  212. * reference manual.) Normally, N should be selected so that the timebase
  213. * is at least 1 us. See ADC_TimebaseCalc() for a way to obtain
  214. * a suggested timebase of at least 1 us.
  215. */
  216. uint8_t timebase;
  217. /** Clock division factor N, ADC clock = HFPERCLK / (N + 1). */
  218. uint8_t prescale;
  219. /** Enable/disable conversion tailgating. */
  220. bool tailgate;
  221. } ADC_Init_TypeDef;
  222. /** Default config for ADC init structure. */
  223. #define ADC_INIT_DEFAULT \
  224. { adcOvsRateSel2, /* 2x oversampling (if enabled). */ \
  225. adcLPFilterBypass, /* No input filter selected. */ \
  226. adcWarmupNormal, /* ADC shutdown after each conversion. */ \
  227. _ADC_CTRL_TIMEBASE_DEFAULT, /* Use HW default value. */ \
  228. _ADC_CTRL_PRESC_DEFAULT, /* Use HW default value. */ \
  229. false /* Do not use tailgate. */ \
  230. }
  231. /** Scan sequence init structure. */
  232. typedef struct
  233. {
  234. /**
  235. * Peripheral reflex system trigger selection. Only applicable if @p prsEnable
  236. * is enabled.
  237. */
  238. ADC_PRSSEL_TypeDef prsSel;
  239. /** Acquisition time (in ADC clock cycles). */
  240. ADC_AcqTime_TypeDef acqTime;
  241. /**
  242. * Sample reference selection. Notice that for external references, the
  243. * ADC calibration register must be set explicitly.
  244. */
  245. ADC_Ref_TypeDef reference;
  246. /** Sample resolution. */
  247. ADC_Res_TypeDef resolution;
  248. /**
  249. * Input scan selection. If single ended (@p diff is false), use logical
  250. * combination of ADC_SCANCTRL_INPUTMASK_CHx defines. If differential input
  251. * (@p diff is true), use logical combination of ADC_SCANCTRL_INPUTMASK_CHxCHy
  252. * defines. (Notice underscore prefix for defines used.)
  253. */
  254. uint32_t input;
  255. /** Select if single ended or differential input. */
  256. bool diff;
  257. /** Peripheral reflex system trigger enable. */
  258. bool prsEnable;
  259. /** Select if left adjustment should be done. */
  260. bool leftAdjust;
  261. /** Select if continuous conversion until explicit stop. */
  262. bool rep;
  263. } ADC_InitScan_TypeDef;
  264. /** Default config for ADC scan init structure. */
  265. #define ADC_INITSCAN_DEFAULT \
  266. { adcPRSSELCh0, /* PRS ch0 (if enabled). */ \
  267. adcAcqTime1, /* 1 ADC_CLK cycle acquisition time. */ \
  268. adcRef1V25, /* 1.25V internal reference. */ \
  269. adcRes12Bit, /* 12 bit resolution. */ \
  270. 0, /* No input selected. */ \
  271. false, /* Single ended input. */ \
  272. false, /* PRS disabled. */ \
  273. false, /* Right adjust. */ \
  274. false /* Deactivate conversion after one scan sequence. */ \
  275. }
  276. /** Single conversion init structure. */
  277. typedef struct
  278. {
  279. /**
  280. * Peripheral reflex system trigger selection. Only applicable if @p prsEnable
  281. * is enabled.
  282. */
  283. ADC_PRSSEL_TypeDef prsSel;
  284. /** Acquisition time (in ADC clock cycles). */
  285. ADC_AcqTime_TypeDef acqTime;
  286. /**
  287. * Sample reference selection. Notice that for external references, the
  288. * ADC calibration register must be set explicitly.
  289. */
  290. ADC_Ref_TypeDef reference;
  291. /** Sample resolution. */
  292. ADC_Res_TypeDef resolution;
  293. /**
  294. * Sample input selection, use single ended or differential input according
  295. * to setting of @p diff.
  296. */
  297. ADC_SingleInput_TypeDef input;
  298. /** Select if single ended or differential input. */
  299. bool diff;
  300. /** Peripheral reflex system trigger enable. */
  301. bool prsEnable;
  302. /** Select if left adjustment should be done. */
  303. bool leftAdjust;
  304. /** Select if continuous conversion until explicit stop. */
  305. bool rep;
  306. } ADC_InitSingle_TypeDef;
  307. /** Default config for ADC single conversion init structure. */
  308. #define ADC_INITSINGLE_DEFAULT \
  309. { adcPRSSELCh0, /* PRS ch0 (if enabled). */ \
  310. adcAcqTime1, /* 1 ADC_CLK cycle acquisition time. */ \
  311. adcRef1V25, /* 1.25V internal reference. */ \
  312. adcRes12Bit, /* 12 bit resolution. */ \
  313. adcSingleInpCh0, /* CH0 input selected. */ \
  314. false, /* Single ended input. */ \
  315. false, /* PRS disabled. */ \
  316. false, /* Right adjust. */ \
  317. false /* Deactivate conversion after one scan sequence. */ \
  318. }
  319. /*******************************************************************************
  320. ***************************** PROTOTYPES **********************************
  321. ******************************************************************************/
  322. /***************************************************************************//**
  323. * @brief
  324. * Get single conversion result.
  325. *
  326. * @note
  327. * Do only use if single conversion data valid.
  328. *
  329. * @param[in] adc
  330. * Pointer to ADC peripheral register block.
  331. *
  332. * @return
  333. *
  334. ******************************************************************************/
  335. __STATIC_INLINE uint32_t ADC_DataSingleGet(ADC_TypeDef *adc)
  336. {
  337. return(adc->SINGLEDATA);
  338. }
  339. /***************************************************************************//**
  340. * @brief
  341. * Get scan result.
  342. *
  343. * @note
  344. * Do only use if scan data valid.
  345. *
  346. * @param[in] adc
  347. * Pointer to ADC peripheral register block.
  348. ******************************************************************************/
  349. __STATIC_INLINE uint32_t ADC_DataScanGet(ADC_TypeDef *adc)
  350. {
  351. return(adc->SCANDATA);
  352. }
  353. void ADC_Init(ADC_TypeDef *adc, const ADC_Init_TypeDef *init);
  354. void ADC_InitScan(ADC_TypeDef *adc, const ADC_InitScan_TypeDef *init);
  355. void ADC_InitSingle(ADC_TypeDef *adc, const ADC_InitSingle_TypeDef *init);
  356. /***************************************************************************//**
  357. * @brief
  358. * Clear one or more pending ADC interrupts.
  359. *
  360. * @param[in] adc
  361. * Pointer to ADC peripheral register block.
  362. *
  363. * @param[in] flags
  364. * Pending ADC interrupt source to clear. Use a bitwise logic OR combination
  365. * of valid interrupt flags for the ADC module (ADC_IF_nnn).
  366. ******************************************************************************/
  367. __STATIC_INLINE void ADC_IntClear(ADC_TypeDef *adc, uint32_t flags)
  368. {
  369. adc->IFC = flags;
  370. }
  371. /***************************************************************************//**
  372. * @brief
  373. * Disable one or more ADC interrupts.
  374. *
  375. * @param[in] adc
  376. * Pointer to ADC peripheral register block.
  377. *
  378. * @param[in] flags
  379. * ADC interrupt sources to disable. Use a bitwise logic OR combination of
  380. * valid interrupt flags for the ADC module (ADC_IF_nnn).
  381. ******************************************************************************/
  382. __STATIC_INLINE void ADC_IntDisable(ADC_TypeDef *adc, uint32_t flags)
  383. {
  384. adc->IEN &= ~(flags);
  385. }
  386. /***************************************************************************//**
  387. * @brief
  388. * Enable one or more ADC interrupts.
  389. *
  390. * @note
  391. * Depending on the use, a pending interrupt may already be set prior to
  392. * enabling the interrupt. Consider using ADC_IntClear() prior to enabling
  393. * if such a pending interrupt should be ignored.
  394. *
  395. * @param[in] adc
  396. * Pointer to ADC peripheral register block.
  397. *
  398. * @param[in] flags
  399. * ADC interrupt sources to enable. Use a bitwise logic OR combination of
  400. * valid interrupt flags for the ADC module (ADC_IF_nnn).
  401. ******************************************************************************/
  402. __STATIC_INLINE void ADC_IntEnable(ADC_TypeDef *adc, uint32_t flags)
  403. {
  404. adc->IEN |= flags;
  405. }
  406. /***************************************************************************//**
  407. * @brief
  408. * Get pending ADC interrupt flags.
  409. *
  410. * @note
  411. * The event bits are not cleared by the use of this function.
  412. *
  413. * @param[in] adc
  414. * Pointer to ADC peripheral register block.
  415. *
  416. * @return
  417. * ADC interrupt sources pending. A bitwise logic OR combination of valid
  418. * interrupt flags for the ADC module (ADC_IF_nnn).
  419. ******************************************************************************/
  420. __STATIC_INLINE uint32_t ADC_IntGet(ADC_TypeDef *adc)
  421. {
  422. return(adc->IF);
  423. }
  424. /***************************************************************************//**
  425. * @brief
  426. * Set one or more pending ADC interrupts from SW.
  427. *
  428. * @param[in] adc
  429. * Pointer to ADC peripheral register block.
  430. *
  431. * @param[in] flags
  432. * ADC interrupt sources to set to pending. Use a bitwise logic OR combination
  433. * of valid interrupt flags for the ADC module (ADC_IF_nnn).
  434. ******************************************************************************/
  435. __STATIC_INLINE void ADC_IntSet(ADC_TypeDef *adc, uint32_t flags)
  436. {
  437. adc->IFS = flags;
  438. }
  439. uint8_t ADC_PrescaleCalc(uint32_t adcFreq, uint32_t hfperFreq);
  440. /***************************************************************************//**
  441. * @brief
  442. * Start scan sequence and/or single conversion.
  443. *
  444. * @param[in] adc
  445. * Pointer to ADC peripheral register block.
  446. *
  447. * @param[in] cmd
  448. * Command indicating which type of sampling to start.
  449. ******************************************************************************/
  450. __STATIC_INLINE void ADC_Start(ADC_TypeDef *adc, ADC_Start_TypeDef cmd)
  451. {
  452. adc->CMD = (uint32_t)cmd;
  453. }
  454. void ADC_Reset(ADC_TypeDef *adc);
  455. uint8_t ADC_TimebaseCalc(uint32_t hfperFreq);
  456. /** @} (end addtogroup ADC) */
  457. /** @} (end addtogroup EM_Library) */
  458. #ifdef __cplusplus
  459. }
  460. #endif
  461. #endif /* __EM_ADC_H */