Merge pull request #2000 from egostm/STM32F4xx_ADC2_support

[STM32F4] Add ADC2 support to F4 family
pull/2009/head
Sam Grove 2016-06-24 16:15:30 -05:00 committed by GitHub
commit e508525bd4
6 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,7 @@ extern "C" {
typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int)ADC2_BASE,
ADC_3 = (int)ADC3_BASE
} ADCName;

View File

@ -38,6 +38,7 @@ extern "C" {
typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int)ADC2_BASE,
ADC_3 = (int)ADC3_BASE
} ADCName;

View File

@ -38,6 +38,7 @@ extern "C" {
typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int)ADC2_BASE,
ADC_3 = (int)ADC3_BASE
} ADCName;

View File

@ -38,6 +38,7 @@ extern "C" {
typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int)ADC2_BASE,
ADC_3 = (int)ADC3_BASE
} ADCName;

View File

@ -38,6 +38,7 @@ extern "C" {
typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int)ADC2_BASE,
ADC_3 = (int)ADC3_BASE
} ADCName;

View File

@ -43,6 +43,9 @@ void analogin_init(analogin_t *obj, PinName pin)
#if defined(ADC1)
static int adc1_inited = 0;
#endif
#if defined(ADC2)
static int adc2_inited = 0;
#endif
#if defined(ADC3)
static int adc3_inited = 0;
#endif
@ -70,6 +73,13 @@ void analogin_init(analogin_t *obj, PinName pin)
adc1_inited = 1;
}
#endif
#if defined(ADC2)
if ((obj->adc == ADC_2) && adc2_inited) return;
if (obj->adc == ADC_2) {
__ADC2_CLK_ENABLE();
adc2_inited = 1;
}
#endif
#if defined(ADC3)
if ((obj->adc == ADC_3) && adc3_inited) return;
if (obj->adc == ADC_3) {