Skip to content

Commit

Permalink
Merge pull request #6246 from DavePutz/issue_6148
Browse files Browse the repository at this point in the history
Don't reset GPIO4 on the MagTag (used for voltage monitoring)
  • Loading branch information
dhalbert authored Apr 6, 2022
2 parents 742c05d + 99dc402 commit dbb6f5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit dbb6f5f

Please sign in to comment.