19 RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1,ENABLE);
20 RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOAEN,ENABLE);
22 GPIO_initStructre.
GPIO_Pin = GPIO_Pin_0;
24 GPIO_initStructre.
GPIO_PuPd = GPIO_PuPd_NOPULL;
25 GPIO_Init(GPIOA,&GPIO_initStructre);
35 ADC_Init(ADC1,&ADC_init_structure);
39 ADC_RegularChannelConfig(ADC1,ADC_Channel_0,1,ADC_SampleTime_144Cycles);
52 for(i=0;i<NB_SAMPLE;i++)
54 ADC_SoftwareStartConv(ADC1);
55 while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC));
56 result += ADC_GetConversionValue(ADC1);
58 return result / NB_SAMPLE;
This file contains all the functions prototypes for the RCC firmware library.
uint32_t ADC_ExternalTrigConv
ARMEBS4 potentiometer access functions.
ADC Init structure definition.
FunctionalState ADC_ContinuousConvMode
void pot_init(void)
Initialise ADC to measure potentiometer.
This file contains all the functions prototypes for the ADC firmware library.
GPIO Init structure definition.
uint32_t pot_value(void)
Measure the potentiometer value.
uint8_t ADC_NbrOfConversion
GPIOMode_TypeDef GPIO_Mode
FunctionalState ADC_ScanConvMode
GPIOPuPd_TypeDef GPIO_PuPd
uint32_t ADC_ExternalTrigConvEdge