Skip to content

Commit 0569188

Browse files
authored
Merge pull request #2869 from subsonicpulse/master
Fix Usage of Bootsel Button for Pico 2
2 parents 7e1c91f + 394045f commit 0569188

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hw/bsp/rp2040/family.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ bool __no_inline_not_in_flash_func(get_bootsel_button)(void) {
7979

8080
// The HI GPIO registers in SIO can observe and control the 6 QSPI pins.
8181
// Note the button pulls the pin *low* when pressed.
82-
bool button_state = (sio_hw->gpio_hi_in & (1u << CS_PIN_INDEX));
82+
83+
#ifdef __ARM_ARCH_6M__ // CM0 for rp2040
84+
#define CS_BIT (1u << 1)
85+
#else // rp2350 (cm33/risv)
86+
#define CS_BIT SIO_GPIO_HI_IN_QSPI_CSN_BITS
87+
#endif
88+
bool button_state = (sio_hw->gpio_hi_in & CS_BIT);
8389

8490
// Need to restore the state of chip select, else we are going to have a
8591
// bad time when we return to code in flash!

0 commit comments

Comments
 (0)