这篇教程C++ ADC_CommonInit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADC_CommonInit函数的典型用法代码示例。如果您正苦于以下问题:C++ ADC_CommonInit函数的具体用法?C++ ADC_CommonInit怎么用?C++ ADC_CommonInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADC_CommonInit函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: adcInitvoid 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,
示例2: adc_initvoid 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,
示例3: initSensorsvoid 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,
示例4: adcSetupvoid 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,
示例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,
示例6: RCC_AHB1PeriphClockCmdvoid 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,
示例7: adcInitvoid 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,
示例8: config_driver_adc_1static 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,
|