Skip to content

Commit 72c5458

Browse files
committed
Fix powman_timer_use_gpio
Fixes #2471
1 parent 1ae2f0e commit 72c5458

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/rp2_common/hardware_powman/powman.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,15 @@ static void powman_timer_use_gpio(uint32_t gpio, uint32_t use, uint32_t using) {
102102
if (was_running) powman_timer_stop();
103103
invalid_params_if(HARDWARE_POWMAN, !((gpio == 12) || (gpio == 14) || (gpio == 20) || (gpio == 22)));
104104
gpio_set_input_enabled(gpio, true);
105-
powman_write(&powman_hw->ext_time_ref, gpio);
105+
uint32_t source = 0; // 12
106+
if (gpio == 20) {
107+
source = 1;
108+
} else if (gpio == 14) {
109+
source = 2;
110+
} else if (gpio == 22) {
111+
source = 3;
112+
}
113+
powman_write(&powman_hw->ext_time_ref, source);
106114
powman_set_bits(&powman_hw->timer, use);
107115
if (was_running) {
108116
powman_timer_start();

0 commit comments

Comments
 (0)