Change 12- to 16-bit scaling to match other ports
Result is identical, implementation just resembles other ports instead of being all 1337 about it.
This commit is contained in:
parent
c3f58193ca
commit
92fa02effa
@ -81,8 +81,10 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
||||
|
||||
}
|
||||
|
||||
// Stretch 12-bit ADC reading to 16 bits via 24-bit interim result
|
||||
return (ADC_GetChannelConversionValue(self->pin->adc, ADC_CHANNEL_GROUP) * 0x1001) >> 8;
|
||||
uint16_t value = ADC_GetChannelConversionValue(self->pin->adc, ADC_CHANNEL_GROUP);
|
||||
|
||||
// Stretch 12-bit ADC reading to 16-bit range
|
||||
return (value << 4) | (value >> 8);
|
||||
}
|
||||
|
||||
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
|
||||
|
Loading…
Reference in New Issue
Block a user