Skip to content

Commit bff54e6

Browse files
committed
Addresse @bapclenet comments on gpio init
1 parent 43ce827 commit bff54e6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cpu/samd21/periph/gpio.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,7 @@ int gpio_init_int(gpio_t dev, gpio_pp_t pullup, gpio_flank_t flank, gpio_cb_t cb
425425
return -1;
426426
}
427427

428-
/* configure pin as input */
429-
res = gpio_init_in(dev, pullup);
430-
if (res < 0) {
431-
return res;
432-
}
428+
433429

434430
if (pin < 16) {
435431
port->WRCONFIG.reg = PORT_WRCONFIG_WRPINCFG \
@@ -446,6 +442,13 @@ int gpio_init_int(gpio_t dev, gpio_pp_t pullup, gpio_flank_t flank, gpio_cb_t cb
446442
| PORT_WRCONFIG_PMUXEN \
447443
| ((1 << pin) >> 16);
448444
}
445+
446+
/* configure pin as input */
447+
res = gpio_init_in(dev, pullup);
448+
if (res < 0) {
449+
return res;
450+
}
451+
449452
/* Turn on APB clock */
450453
PM->APBAMASK.reg |= PM_APBAMASK_EIC;
451454

0 commit comments

Comments
 (0)