本文整理汇总了C++中ADC_CommonInit函数的典型用法代码示例。如果您正苦于以下问题:C++ ADC_CommonInit函数的具体用法?C++ ADC_CommonInit怎么用?C++ ADC_CommonInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADC_CommonInit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: adcInit
void adcInit(void)
{
/*
* Note: This function initializes only ADC2, and only for single channel, single conversion mode. No DMA, no interrupts, no bells or whistles.
*/
/* Note that this de-initializes registers for all ADCs (ADCx) */
ADC_DeInit();
/* Define ADC init structures */
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitTypeDef ADC_CommonInitStructure;
/* Populates structures with reset values */
ADC_StructInit(&ADC_InitStructure);
ADC_CommonStructInit(&ADC_CommonInitStructure);
/* enable ADC clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC2, ENABLE);
/* init ADCs in independent mode, div clock by two */
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2; /* HCLK = 168MHz, PCLK2 = 84MHz, ADCCLK = 42MHz (when using ADC_Prescaler_Div2) */
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
/* Init ADC2: 12bit, single-conversion. For Arduino compatibility set 10bit */
analogReadResolution(12);
/* Enable ADC2 */
ADC_Cmd(ADC2, ENABLE);
}
开发者ID:CarlosRDomin,项目名称:crazyflie-firmware,代码行数:33,代码来源:deck_analog.c
示例2: adc_init
void adc_init(void) {
// Initialize ADC
ADC_CommonInitTypeDef ConfigCADC;
ADC_CommonStructInit(&ConfigCADC);
ADC_CommonInit(&ConfigCADC);
// Initialize ADC1 & ADC2
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE);
ADC_InitTypeDef ConfigADC;
ADC_StructInit(&ConfigADC);
ADC_Init(ADC1, &ConfigADC);
ADC_Init(ADC2, &ConfigADC);
/*#define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16)
#define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17)
#define ADC_Channel_Vbat ((uint8_t)ADC_Channel_18)
*/
// Configure channels
ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 1, ADC_SampleTime_15Cycles); // Battery voltage
ADC_RegularChannelConfig(ADC2, ADC_Channel_14, 1, ADC_SampleTime_15Cycles); // Light sensor
// Enable ADC1 & 2
ADC_Cmd(ADC1, ENABLE);
ADC_Cmd(ADC2, ENABLE);
}
开发者ID:stg,项目名称:SmartWatch_Toolchain,代码行数:26,代码来源:driver_adc.c
示例3: initSensors
void initSensors()
{
ADC_DeInit();
// Setup ADC_CommonInitType first
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div8;
ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStruct);
// Setup ADC_InitStruct
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_3Cycles);
ADC_Cmd(ADC1, ENABLE);
ADC_ResetCalibration(ADC1);
//Enable ADC1 reset calibration register
ADC_ResetCalibration(ADC1);
//Check the end of ADC1 reset calibration register
while(ADC_GetResetCalibrationStatus(ADC1));
//Start ADC1 calibration
ADC_StartCalibration(ADC1);
//Check the end of ADC1 calibration
while(ADC_GetCalibrationStatus(ADC1));
//Start ADC1 Software Conversion
ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
开发者ID:Apo11oH,项目名称:micromouse_2014,代码行数:34,代码来源:adc.c
示例4: adcSetup
void adcSetup(void){
ADC_DeInit();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div8;
ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStruct);
ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStruct.ADC_ScanConvMode = DISABLE;
ADC_InitStruct.ADC_ContinuousConvMode = ENABLE;
ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStruct.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStruct);
// ADC1 Configuration, ADC_Channel_TempSensor is actual channel 16
ADC_RegularChannelConfig(ADC1, ADC_Channel_TempSensor, 1, ADC_SampleTime_144Cycles);
// Enable internal temperature sensor
ADC_TempSensorVrefintCmd(ENABLE);
// Enable ADC conversion
ADC_Cmd(ADC1, ENABLE);
}
开发者ID:rmursh,项目名称:MicroP-ECSE426,代码行数:30,代码来源:TemperatureSensor.c
示例5: P_ADC2s_InitADC
//--------------------------------------------------------------
// interne Funktion
// Init von ADC Nr.2
//--------------------------------------------------------------
void P_ADC2s_InitADC(void)
{
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_InitTypeDef ADC_InitStructure;
// Clock Enable
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC2, ENABLE);
// ADC-Config
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC2s_VORTEILER;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC2, &ADC_InitStructure);
// ADC-Enable
ADC_Cmd(ADC2, ENABLE);
}
开发者ID:Jinzuu,项目名称:wc_ws,代码行数:30,代码来源:stm32_ub_adc2_single.c
示例6: RCC_AHB1PeriphClockCmd
void Battery::initialize(){
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitTypeDef ADC_CommonInitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC|RCC_APB2Periph_ADC1, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOCEN,ENABLE);
ADC_DeInit();
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div4;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_112Cycles);
ADC_Cmd(ADC1, ENABLE);
ADC_DMACmd(ADC1,DISABLE);
}
开发者ID:taniho0707,项目名称:nucleo_mouse,代码行数:35,代码来源:Battery.cpp
示例7: adcInit
void adcInit() {
GPIO_InitTypeDef GPIO_InitStruct;
ADC_CommonInitTypeDef ADC_CommonInitStruct;
ADC_InitTypeDef ciguMigu;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
GPIO_StructInit(&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStruct);
ADC_CommonStructInit(&ADC_CommonInitStruct);
ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div4;
ADC_CommonInit(&ADC_CommonInitStruct);
ADC_StructInit(&ciguMigu);
ciguMigu.ADC_Resolution = ADC_Resolution_10b;
ADC_Init(ADC1, &ciguMigu);
ADC_Cmd(ADC1, ENABLE);
ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_480Cycles);
}
开发者ID:rokrupnik,项目名称:vinokuh,代码行数:26,代码来源:adc_zdovc.c
示例8: config_driver_adc_1
static void config_driver_adc_1(void)
{
ADC_InitTypeDef ADC_InitStructure;
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStructure);
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div8;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_20Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_480Cycles);
ADC_DMARequestAfterLastTransferCmd(ADC1, ENABLE);
ADC_DMACmd(ADC1, ENABLE);
ADC_Cmd(ADC1, ENABLE);
ADC_SoftwareStartConv(ADC1);
}
开发者ID:glocklueng,项目名称:ESP8266-STM32F4Discovery,代码行数:28,代码来源:adc_1.c
示例9: adc_tempsen
extern void adc_tempsen(){
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); // adc1 kanalý clock aktif edildi
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_20Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_ExternalTrigConv =0;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1,ADC_Channel_TempSensor, 1, ADC_TwoSamplingDelay_5Cycles);
ADC_TempSensorVrefintCmd(ENABLE);
ADC_Cmd(ADC1, ENABLE);
}
开发者ID:bolatberk,项目名称:stm32f407vg,代码行数:34,代码来源:stm32_adc.c
示例10: Sensor_Configuration
void Sensor_Configuration(void) {
ADC_CommonInitTypeDef ADC_CommonInitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
SensorGPIO_Configuration();
DMA2_Configuration();
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 |
GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(GPIOA, &GPIO_InitStructure);
ADC_CommonInitStructure.ADC_Mode = ADC_DualMode_RegSimult;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_1;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_20Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC1_Config();
ADC2_Config();
ADC_MultiModeDMARequestAfterLastTransferCmd(ENABLE);
ADC_Cmd(ADC1, ENABLE);
ADC_Cmd(ADC2, ENABLE);
ADC_DMACmd(ADC1, ENABLE);
ADC_SoftwareStartConv(ADC1);
}
开发者ID:vpcola,项目名称:stm32f4,代码行数:32,代码来源:sensor.c
示例11: temperature_setup
int temperature_setup()
{
ADC_InitTypeDef adc_init_s; //Initializes definitions of SDC
ADC_CommonInitTypeDef adc_common_init_s; //Used to def common paramters for ADC peripheral
ADC_DeInit(); //reset ADC peripheral value to their defaults
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //Enable Power for APB2 bus connected to ADC1 (temp sensor)
adc_common_init_s.ADC_Mode = ADC_Mode_Independent; //Configures the ADC for indepedent mode
adc_common_init_s.ADC_Prescaler = ADC_Prescaler_Div2; //Sets Frequency of the clock to ADC. Count 0 and 1.
adc_common_init_s.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //turn off direct memory access mode
adc_common_init_s.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; //sets the delay between two sampling phases as 5
ADC_CommonInit(&adc_common_init_s); //initializes the struct for values set (above)
adc_init_s.ADC_Resolution = ADC_Resolution_12b; //Configures the ADC resolution 12 bits
adc_init_s.ADC_ScanConvMode = DISABLE; //sets conversion to Single channel mode
adc_init_s.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; //Set the external trigger edge to none
adc_init_s.ADC_DataAlign = ADC_DataAlign_Right; //MSB in register is 0, data saved starting from LSB
adc_init_s.ADC_NbrOfConversion = 1; //Specifies the number of ADC conversions that will be done
ADC_TempSensorVrefintCmd(ENABLE); //wake up desired sensor (temp)
ADC_Cmd(ADC1, ENABLE); //turn on the ADC1 peripheral
ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 1, ADC_SampleTime_480Cycles); //Configures ADC1_channel 16 which is the tempature sensor
ADC_Init(ADC1, &adc_init_s); //initialize ADC1
new_filter.avg = 0, new_filter.replace = 0, new_filter.sum = 0;
return 0;
}
开发者ID:kanetkarster,项目名称:MicroP-Lab2,代码行数:32,代码来源:temperature.c
示例12: ADCInit
void ADCInit()
{
ADC_InitTypeDef ADC_InitStructure;
ADC_StructInit(&ADC_InitStructure);
ADC_CommonInitTypeDef adc_init;
ADC_CommonStructInit(&adc_init);
/* разрешаем тактирование AЦП1 */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
/* сбрасываем настройки АЦП */
ADC_DeInit();
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
/* АЦП1 и АЦП2 работают независимо */
adc_init.ADC_Mode = ADC_Mode_Independent;
adc_init.ADC_Prescaler = ADC_Prescaler_Div2;
/* выключаем scan conversion */
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
/* Не делать длительные преобразования */
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
/* Начинать преобразование программно, а не по срабатыванию триггера */
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConvEdge_None;
/* 12 битное преобразование. результат в 12 младших разрядах результата */
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
/* инициализация */
ADC_CommonInit(&adc_init);
ADC_Init(ADC1, &ADC_InitStructure);
/* Включаем АЦП1 */
ADC_Cmd(ADC1, ENABLE);
// настройка канала
ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_15Cycles);
}
开发者ID:Olvar-ag,项目名称:RESET,代码行数:32,代码来源:main.c
示例13: ADC_DeInit
void InternalTempSensor::initTempSensor()
{
temp = 0;
calibration = 0;
ADC_DeInit();
ADC_InitTypeDef ADC_InitStruct;
ADC_CommonInitTypeDef ADC_CommonInitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div8;
ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStruct);
ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStruct.ADC_ScanConvMode = DISABLE;
ADC_InitStruct.ADC_ContinuousConvMode = ENABLE;
ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStruct.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStruct);
ADC_RegularChannelConfig(ADC1, ADC_Channel_TempSensor, 1, ADC_SampleTime_144Cycles);
ADC_TempSensorVrefintCmd(ENABLE);
ADC_Cmd(ADC1, ENABLE);
}
开发者ID:r00li,项目名称:RhomeV3,代码行数:31,代码来源:TempSensor.cpp
示例14: init_ADC3
void init_ADC3(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC3, ENABLE);
//ADC common init
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
//ADC3 init
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = ENABLE;
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = nconversions;
ADC_InitStructure.ADC_ExternalTrigConv=0x00;
ADC_Init(ADC3, &ADC_InitStructure);
// ADC3 regular configuration
ADC_RegularChannelConfig(ADC3, ADC_Channel_12, 1, ADC_SampleTime_3Cycles);
ADC_RegularChannelConfig(ADC3, ADC_Channel_11, 2, ADC_SampleTime_3Cycles);
ADC_RegularChannelConfig(ADC3, ADC_Channel_10, 3, ADC_SampleTime_3Cycles);
ADC_RegularChannelConfig(ADC3, ADC_Channel_9, 4, ADC_SampleTime_3Cycles);
// Enable DMA request after last transfer
ADC_DMARequestAfterLastTransferCmd(ADC3, ENABLE);
ADC_DMACmd(ADC3, ENABLE);
ADC_Cmd(ADC3, ENABLE);
}
开发者ID:3spds,项目名称:stm32f4,代码行数:28,代码来源:main_filt_a.c
示例15: Init_ADC3
//ADC3 initianilize
void Init_ADC3(void)
{
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitTypeDef ADC_CommonInitStructure;
/* Enable ADC1 clock ********************************************************/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC3, ENABLE);
/* ADC Common Init **********************************************************/
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
/* ADC1 Init ****************************************************************/
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC3, &ADC_InitStructure);
ADC_EOCOnEachRegularChannelCmd(ADC3, ENABLE);
ADC_Cmd(ADC3, ENABLE);
ADC_SoftwareStartConv(ADC3);
}
开发者ID:turboman1234,项目名称:TankController,代码行数:28,代码来源:adc.c
示例16: vhADC_initADC
/*-----------------------------------------------------------
* @brief Function Name : vhADC_initADC
* @brief Description : Initializes ADC
*/
void vhADC_initADC(void){
/* ADC Common initialization */
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div6; // 84MHz / prescaler(6) = 14MHz (max 30 OR 36... idk)
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC_InitTypeDef ADC_InitStructure;
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = ENABLE; // Enable, because we want to measure more than 1 channel
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_RisingFalling;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 2;
ADC_Init(ADC1, &ADC_InitStructure);
/* ADCx regular channel configuration */
ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_28Cycles);
ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 2, ADC_SampleTime_28Cycles);
/* Enable DMA request after last transfer (Single-ADC mode) */
ADC_DMARequestAfterLastTransferCmd(ADC1, ENABLE);
/* Enable ADCx DMA */
ADC_DMACmd(ADC1, ENABLE);
/* Enable ADCx */
ADC_Cmd(ADC1, ENABLE);
ADC_SoftwareStartConv(ADC1);
}
开发者ID:bharathvu,项目名称:AUTOPILOT-1,代码行数:39,代码来源:ADC.c
示例17: ADC_init
void ADC_init(void) {
/*Defining the ADC initial parameter setting structures*/
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitTypeDef adc_common_init_s;
/*Enabling clock on bus APB2 to peripheral ADC1*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
/*Setting the parameters for the ADC and initializing*/
adc_common_init_s.ADC_Mode = ADC_Mode_Independent;
adc_common_init_s.ADC_Prescaler = ADC_Prescaler_Div2; //Half the APB2 speed
adc_common_init_s.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //No DMA
adc_common_init_s.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; //Setting the sampling delay to
ADC_CommonInit(&adc_common_init_s); //Initialize with the above parameters
/*Setting further parameters for the ADC and initializing*/
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; //Returning a 12 bit (max) result
ADC_InitStructure.ADC_ScanConvMode = DISABLE; //A single channel is used
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; //Not in continuous mode
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //Alligned right
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC1,&ADC_InitStructure); //Initialize ADC1
ADC_TempSensorVrefintCmd(ENABLE);
/*Enabling the ADC*/
ADC_Cmd(ADC1, ENABLE);
ADC_RegularChannelConfig(ADC1, ADC_Channel_TempSensor, 1, ADC_SampleTime_480Cycles);
}
开发者ID:cmtm,项目名称:microP,代码行数:32,代码来源:ADC.c
示例18: ADC_CommonInit
//------------------------------------------------------------------------------
Adc::Error AdcStm32f4xx::driverConfigure(const Config& config)
{
// ADC common init
ADC_CommonInitTypeDef commonAdcInit;
commonAdcInit.ADC_Mode = ADC_Mode_Independent;
commonAdcInit.ADC_Prescaler = ADC_Prescaler_Div2;
commonAdcInit.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
commonAdcInit.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&commonAdcInit);
// ADC init
ADC_InitTypeDef adcInit;
adcInit.ADC_Resolution = ADC_Resolution_12b,
adcInit.ADC_ScanConvMode = DISABLE,
adcInit.ADC_ContinuousConvMode = (FunctionalState)
config.conversionMode;
adcInit.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
adcInit.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
adcInit.ADC_DataAlign = ADC_DataAlign_Right;
adcInit.ADC_NbrOfConversion = 1;
ADC_Init(myAdc, &adcInit);
ADC_RegularChannelConfig(myAdc,
idToChannelMap[myChannelId],
1,
ADC_SampleTime_3Cycles);
return ERROR_NONE;
}
开发者ID:bminerd,项目名称:Plat4m_Ui,代码行数:32,代码来源:AdcStm32f4xx.cpp
示例19: ADC1_Config
void ADC1_Config(void)
{
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
//This is irrelevant because we only are sampling one ADC pin (1 conversion only)
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_20Cycles;
ADC_CommonInit(&ADC_CommonInitStructure);
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_3Cycles);
ADC_EOCOnEachRegularChannelCmd(ADC1, ENABLE);
ADC_Cmd(ADC1, ENABLE); //The ADC is powered on by setting the ADON bit in the ADC_CR2 register.
//When the ADON bit is set for the first time, it wakes up the ADC from the Power-down mode.
}
开发者ID:kevinjyu,项目名称:eecs452,代码行数:30,代码来源:adc_setup.c
示例20: adcInitialize
void adcInitialize () {
ADC_InitTypeDef adc_init_s;
ADC_CommonInitTypeDef adc_common_init_s;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //Clock Gating. Enables the ADC interface clock
//Configure the ADC Prescaler, conversion resolution and data alignment using the ADC_Init() function.
adc_common_init_s.v = ADC_Mode_Independent;
adc_common_init_s.ADC_Prescaler = ADC_Prescaler_Div2;
adc_common_init_s.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
adc_common_init_s.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
ADC_CommonInit(&adc_common_init_s); //Initialization
adc_init_s.ADC_Resolution = ADC_Resolution_12b;
adc_init_s.ADC_ScanConvMode = DISABLE;
adc_init_s.ADC_ContinuousConvMode = DISABLE;
adc_init_s.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
adc_init_s.ADC_DataAlign = ADC_DataAlign_Right;
adc_init_s.ADC_NbrOfConversion = 1;
ADC_Init(ADC1, &adc_init_s); //Initialization
ADC_Cmd(ADC1, ENABLE); //Enable ADC
}
开发者ID:claus147,项目名称:MicroP17,代码行数:25,代码来源:temp_tool.c
注:本文中的ADC_CommonInit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论