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 5ef1f2d commit c3f5819Copy full SHA for c3f5819
ports/raspberrypi/common-hal/analogio/AnalogIn.c
@@ -65,8 +65,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
65
adc_select_input(self->pin->number - ADC_FIRST_PIN_NUMBER);
66
uint16_t value = adc_read();
67
68
- // Map value to from 12 to 16 bits
69
- return value << 4;
+ // Stretch 12-bit ADC reading to 16-bit range
+ return (value << 4) | (value >> 8);
70
}
71
72
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
0 commit comments