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.
1 parent eefba16 commit e9b9f0bCopy full SHA for e9b9f0b
ports/stm/common-hal/analogio/AnalogIn.c
@@ -204,8 +204,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
204
uint16_t value = (uint16_t)HAL_ADC_GetValue(&AdcHandle);
205
HAL_ADC_Stop(&AdcHandle);
206
207
- // // Shift the value to be 16 bit.
208
- return value << 4;
+ // Stretch 12-bit ADC reading to 16-bit range
+ return (value << 4) | (value >> 8);
209
}
210
211
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
0 commit comments