Add more comment on the modified line

pull/3302/head
bcostm 2016-11-22 11:03:44 +01:00
parent 2ae748910b
commit a3baf2d7bf
1 changed files with 6 additions and 1 deletions

View File

@ -183,7 +183,12 @@ static inline uint16_t adc_read(analogin_t *obj)
return 0;
}
ADC->CCR &= ~(ADC_CCR_VBATE | ADC_CCR_TSVREFE); // Workaround
// Measuring VBAT sets the ADC_CCR_VBATE bit in ADC->CCR, and there is not
// possibility with the ST HAL driver to clear it. If it isn't cleared,
// VBAT remains connected to the ADC channel in preference to temperature,
// so VBAT readings are returned in place of temperature.
ADC->CCR &= ~(ADC_CCR_VBATE | ADC_CCR_TSVREFE);
HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
HAL_ADC_Start(&AdcHandle); // Start conversion