Skip to content

spresense: return the correct value for Analog In #4294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ports/cxd56/common-hal/analogio/AnalogIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 value = 0;
int16_t value = 0;

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.
Expand Down