Skip to content

Commit a2efcd2

Browse files
committed
[NUCLEO_L152RE] analog_in improvement
1 parent e5b6417 commit a2efcd2

File tree

1 file changed

+7
-1
lines changed
  • libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE

1 file changed

+7
-1
lines changed

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogin_api.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ void analogin_init(analogin_t *obj, PinName pin) {
7575
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
7676

7777
// Configure ADC
78-
ADC_StructInit(&ADC_InitStructure);
78+
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
79+
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
80+
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
81+
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
82+
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_CC2;
83+
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
84+
ADC_InitStructure.ADC_NbrOfConversion = 1;
7985
ADC_Init(adc, &ADC_InitStructure);
8086

8187
// Enable ADC

0 commit comments

Comments
 (0)