Skip to content

Commit 1b3bca1

Browse files
authored
Merge pull request #4294 from kamtom480/spresense_analogin
spresense: return the correct value for Analog In
2 parents c33d86f + d68fdf3 commit 1b3bca1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ports/cxd56/common-hal/analogio/AnalogIn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
105105
}
106106

107107
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
108-
uint16_t value = 0;
108+
int16_t value = 0;
109109

110110
read(analogin_dev[self->number].fd, &value, sizeof(value));
111111

112-
return value;
112+
return (uint16_t) 32768 + (uint16_t) value;
113113
}
114114

115115
// Reference voltage is a fixed value which is depending on the board.

0 commit comments

Comments
 (0)