summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubsonicpulse <[email protected]>2024-11-07 12:16:42 +0100
committerGitHub <[email protected]>2024-11-07 12:16:42 +0100
commit8174ab064002edadaaffa50607e7bcbb6802cf82 (patch)
tree77bf38e5caaab88da6cdf057e49e1393df4f7828
parent038be21e4d94c958043eb54d179948cd9e52fe18 (diff)
Fix Usage of Bootsel Button for Pico 2
see code from https://github.com/raspberrypi/pico-examples/blob/master/picoboard/button/button.c
-rw-r--r--hw/bsp/rp2040/family.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c
index ccc1e1f70..47d729ea3 100644
--- a/hw/bsp/rp2040/family.c
+++ b/hw/bsp/rp2040/family.c
@@ -79,7 +79,13 @@ bool __no_inline_not_in_flash_func(get_bootsel_button)(void) {
// The HI GPIO registers in SIO can observe and control the 6 QSPI pins.
// Note the button pulls the pin *low* when pressed.
- bool button_state = (sio_hw->gpio_hi_in & (1u << CS_PIN_INDEX));
+
+ #if PICO_RP2040
+ #define CS_BIT (1u << 1)
+ #else
+ #define CS_BIT SIO_GPIO_HI_IN_QSPI_CSN_BITS
+ #endif
+ bool button_state = (sio_hw->gpio_hi_in & CS_BIT);
// Need to restore the state of chip select, else we are going to have a
// bad time when we return to code in flash!