Skip to content

Commit d2d6094

Browse files
committed
call reset_all_pins() in main() after port_init()
Before adafruit#10699, `reset_all_pins()` was called in `reset_port()`. That changed to reset all pins in main after the finalizers ran. However, this mean that pins were not all reset on power-up or hard reset. This caused adafruit#1841, because the power control pin for Feather S3 TFT was not powering the display as required before the display was reset. Add a call to `reset_all_pins()` early in `main()` to serve the same purpose.
1 parent a750c5f commit d2d6094

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,12 @@ int __attribute__((used)) main(void) {
10201020
// initialise the cpu and peripherals
10211021
set_safe_mode(port_init());
10221022

1023+
// All ports need pins reset, after never-reset pins are marked in port_init();
1024+
reset_all_pins();
1025+
10231026
port_heap_init();
10241027

1028+
10251029
// Turn on RX and TX LEDs if we have them.
10261030
init_rxtx_leds();
10271031

ports/atmel-samd/supervisor/port.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,9 @@ safe_mode_t port_init(void) {
339339
init_shared_dma();
340340

341341
// Reset everything into a known state before board_init.
342+
// Pins are reset in main() after this routine returns.
342343
reset_port();
343344

344-
// Reset the pins too.
345-
reset_all_pins();
346-
347345
#ifdef SAMD21
348346
if (PM->RCAUSE.bit.BOD33 == 1 || PM->RCAUSE.bit.BOD12 == 1) {
349347
return SAFE_MODE_BROWNOUT;

0 commit comments

Comments
 (0)