Skip to content

Commit f9d2163

Browse files
committed
spresense: return valid reference voltage
1 parent 64192b0 commit f9d2163

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,18 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
114114

115115
// Reference voltage is a fixed value which is depending on the board.
116116
// e.g.)
117-
// - Reference Voltage of A4 and A5 pins on Main Board is 0.7V.
118-
// - Reference Voltage of A0 ~ A5 pins on External Interface board
119-
// is selected 3.3V or 5.0V by a IO Volt jumper pin.
117+
// - Reference Voltage of A2 and A3 pins on Main Board is 0.7V.
118+
// - Reference Voltage of A0 ~ A5 pins on External Interface board is 5.0V
120119
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
121-
return 0.0f;
120+
float voltage;
121+
122+
if (self->number == 2 || self->number == 3) {
123+
voltage = 0.0f;
124+
} else {
125+
voltage = 5.0f;
126+
}
127+
128+
return voltage;
122129
}
123130

124131
void analogin_reset(void) {

0 commit comments

Comments
 (0)