Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stm32/f4/adc.c')
-rw-r--r--lib/stm32/f4/adc.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/stm32/f4/adc.c b/lib/stm32/f4/adc.c
index aaa0a5c7..020db884 100644
--- a/lib/stm32/f4/adc.c
+++ b/lib/stm32/f4/adc.c
@@ -426,6 +426,23 @@ void adc_disable_temperature_sensor(void)
ADC_CCR &= ~ADC_CCR_TSVREFE;
}
-/*---------------------------------------------------------------------------*/
+/** Enable The VBat Sensor.
+ * This enables the battery voltage measurements on ADC1 channel 18. On
+ * STM32F42x and STM32F43x, this must be disabled when the temperature sensor
+ * is enabled. If both are enabled, only the VBat conversion is performed.
+ */
+void adc_enable_vbat_sensor(void)
+{
+ ADC_CCR |= ADC_CCR_VBATE;
+}
+
+/** Disable The VBat Sensor.
+ * Disabling this will reduce power consumption from the battery voltage
+ * measurement.
+ */
+void adc_disable_vbat_sensor(void)
+{
+ ADC_CCR &= ~ADC_CCR_VBATE;
+}
/**@}*/