Skip to content

spresense: return valid reference voltage #4310

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 2 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions ports/cxd56/common-hal/analogio/AnalogIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions ports/cxd56/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down