35 CMU_ClockEnable(cmuClock_ADC0,
true);
38 ADC_Init_TypeDef init = ADC_INIT_DEFAULT;
39 ADC_InitSingle_TypeDef initSingle = ADC_INITSINGLE_DEFAULT;
42 init.prescale = ADC_PrescaleCalc(
ADC_FREQ, 0);
43 init.timebase = ADC_TimebaseCalc(0);
45 initSingle.diff =
false;
47 initSingle.reference = adcRefVDD;
48 initSingle.resolution = adcRes12Bit;
51 initSingle.input = adcSingleInputCh4;
53 ADC_Init(ADC0, &init);
54 ADC_InitSingle(ADC0, &initSingle);
57 ADC_IntEnable(ADC0, ADC_IEN_SINGLE);
60 NVIC_ClearPendingIRQ(ADC0_IRQn);
61 NVIC_EnableIRQ(ADC0_IRQn);
76 ADC_IntClear(ADC0, ADC_IFC_SINGLE);
79 sample = ADC_DataSingleGet(ADC0);
103 ADC_Start(ADC0, adcStartSingle);
115 #if DEBUG_DBPRINT == 1
140 else percent[0] = 100;