diff --git a/application.c b/application.c index f062e93..47a4398 100644 --- a/application.c +++ b/application.c @@ -119,8 +119,9 @@ static float* measure_voltages(void) adc_start_conversion_regular(ADC1); // start conversion (using trigger) while (!adc_eoc(ADC1)); // wait until conversion finished adc_values[i] = adc_read_regular(ADC1); // read voltage value (clears flag) - voltages[i] = adc_values[i] * 1.21 / adc_values[0] * 2; // use 1.21 V internal voltage reference to get ADC voltage (there is a /2 voltage divider) + voltages[i] = adc_values[i] * 1.21 / adc_values[0]; // use 1.21 V internal voltage reference to get ADC voltage } + voltages[1] *= 2.0; // the is a /2 voltage divider for target voltage return voltages; }