spresense: return the correct value for Analog In
This commit is contained in:
parent
538cd7eada
commit
d68fdf3a3d
1 changed files with 2 additions and 2 deletions
|
|
@ -105,11 +105,11 @@ bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
||||||
uint16_t value = 0;
|
int16_t value = 0;
|
||||||
|
|
||||||
read(analogin_dev[self->number].fd, &value, sizeof(value));
|
read(analogin_dev[self->number].fd, &value, sizeof(value));
|
||||||
|
|
||||||
return value;
|
return (uint16_t) 32768 + (uint16_t) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference voltage is a fixed value which is depending on the board.
|
// Reference voltage is a fixed value which is depending on the board.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue