[STM32F4] Add ADC2 support to F4 family

Introducing ADC2 support for NUCLEO_F446ZE implies to have the support
in the core part for all F4 chipsets that possibly support it (even if
not supported on all boards).
pull/2000/head
Laurent MEUNIER 2016-06-06 10:37:54 +02:00 committed by Erwan GOURIOU
parent f864b8439f
commit 0f49396a0a
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) {