diff options
| author | Dan Halbert <halbert@adafruit.com> | 2021-03-02 11:55:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-02 11:55:42 -0500 |
| commit | 9f6ebf3012bae83ec0a936361795d7fda4005fad (patch) | |
| tree | 580daefef467fd7ebf5a9b8c4e65a2cf9d2fb79b | |
| parent | 2651e15a524d9228e2332337b6fd6d99e869bace (diff) | |
| parent | 7c921b808b3cda1959875d269022d1c93bdbb5d9 (diff) | |
Merge pull request #4310 from kamtom480/spresense_analogin
spresense: return valid reference voltage
| -rw-r--r-- | ports/cxd56/common-hal/analogio/AnalogIn.c | 15 | ||||
| -rw-r--r-- | ports/cxd56/mpconfigport.mk | 6 |
2 files changed, 17 insertions, 4 deletions
diff --git a/ports/cxd56/common-hal/analogio/AnalogIn.c b/ports/cxd56/common-hal/analogio/AnalogIn.c index a26647ac6..5c47991eb 100644 --- a/ports/cxd56/common-hal/analogio/AnalogIn.c +++ b/ports/cxd56/common-hal/analogio/AnalogIn.c @@ -114,11 +114,18 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { // Reference voltage is a fixed value which is depending on the board. // e.g.) -// - Reference Voltage of A4 and A5 pins on Main Board is 0.7V. -// - Reference Voltage of A0 ~ A5 pins on External Interface board -// is selected 3.3V or 5.0V by a IO Volt jumper pin. +// - Reference Voltage of A2 and A3 pins on Main Board is 0.7V. +// - Reference Voltage of A0 ~ A5 pins on External Interface board is 5.0V float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { - return 0.0f; + float voltage; + + if (self->number == 2 || self->number == 3) { + voltage = 0.0f; + } else { + voltage = 5.0f; + } + + return voltage; } void analogin_reset(void) { diff --git a/ports/cxd56/mpconfigport.mk b/ports/cxd56/mpconfigport.mk index 33a993ad9..e767c6326 100644 --- a/ports/cxd56/mpconfigport.mk +++ b/ports/cxd56/mpconfigport.mk @@ -10,8 +10,14 @@ USB_MSC_EP_NUM_IN = 4 # Number of USB endpoint pairs. USB_NUM_EP = 6 +# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk +# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers. +# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h. MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz +# Longints can be implemented as mpz, as longlong, or not +LONGINT_IMPL = MPZ + CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CAMERA = 1 |
