Skip to content

Don't reset GPIO4 on the MagTag (used for voltage monitoring) #6246

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
Apr 6, 2022
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
4 changes: 4 additions & 0 deletions ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
gpio_config(&cfg);
return true;
}
// Pin 4 is used for voltage monitoring, so don't reset
if (pin_number == 4) {
return true;
}
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions ports/espressif/common-hal/analogio/AnalogIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self,
}
common_hal_mcu_pin_claim(pin);
self->pin = pin;
// Pull-ups are enabled by default for power-saving reasons on quiescent pins.
// Turn off the pull-up as soon as we know the pin will be used for analog reads,
// since it may take a while for the voltage to stabilize if the input is high-impedance.
gpio_pullup_dis(pin->number);
}

bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
Expand Down