We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c580260 + 164fee0 commit 90fd6cdCopy full SHA for 90fd6cd
targets/TARGET_STM/TARGET_STM32L4/analogin_device.c
@@ -193,6 +193,13 @@ uint16_t adc_read(analogin_t *obj)
193
194
// Wait end of conversion and get value
195
if (HAL_ADC_PollForConversion(&obj->handle, 10) == HAL_OK) {
196
+
197
+ /* Ref Manual: To prevent any unwanted consumption on the battery,
198
+ it is recommended to enable the bridge divider only when needed for ADC conversion */
199
+ if (sConfig.Channel == ADC_CHANNEL_VBAT) {
200
+ CLEAR_BIT(__LL_ADC_COMMON_INSTANCE(obj->handle.Instance)->CCR, LL_ADC_PATH_INTERNAL_VBAT);
201
+ }
202
203
return (uint16_t)HAL_ADC_GetValue(&obj->handle);
204
} else {
205
return 0;
0 commit comments