summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2021-03-01 13:21:15 -0800
committerGitHub <noreply@github.com>2021-03-01 13:21:15 -0800
commit1b3bca14cbb283173c2b6a6fc7dcac32ef084c7c (patch)
treecb07d3cd9737a11d5c49e8c0a8d7d5a607d61ca0
parentc33d86f78f80cf8b28791541f8f13861f2a74b8c (diff)
parentd68fdf3a3d852894e225fc41cb0563b26eded415 (diff)
Merge pull request #4294 from kamtom480/spresense_analogin
spresense: return the correct value for Analog In
-rw-r--r--ports/cxd56/common-hal/analogio/AnalogIn.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/cxd56/common-hal/analogio/AnalogIn.c b/ports/cxd56/common-hal/analogio/AnalogIn.c
index cdf37c06a..a26647ac6 100644
--- a/ports/cxd56/common-hal/analogio/AnalogIn.c
+++ b/ports/cxd56/common-hal/analogio/AnalogIn.c
@@ -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.