File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 4242MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN (mod_network_country_obj );
4343#endif
4444
45+ #define CS_PIN_INDEX 1
46+
47+ #if PICO_RP2040
48+ #define CS_BIT (1u << CS_PIN_INDEX)
49+ #else
50+ #define CS_BIT SIO_GPIO_HI_IN_QSPI_CSN_BITS
51+ #endif
52+
4553// Improved version of
4654// https://github.com/raspberrypi/pico-examples/blob/master/picoboard/button/button.c
4755static bool __no_inline_not_in_flash_func (bootsel_button )(void ) {
48- const uint CS_PIN_INDEX = 1 ;
49-
5056 // Disable interrupts and the other core since they might be
5157 // executing code from flash and we are about to temporarily
5258 // disable flash access.
@@ -65,7 +71,7 @@ static bool __no_inline_not_in_flash_func(bootsel_button)(void) {
6571
6672 // The HI GPIO registers in SIO can observe and control the 6 QSPI pins.
6773 // The button pulls the QSPI_SS pin *low* when pressed.
68- bool button_state = !(sio_hw -> gpio_hi_in & ( 1 << CS_PIN_INDEX ) );
74+ bool button_state = !(sio_hw -> gpio_hi_in & CS_BIT );
6975
7076 // Restore the QSPI_SS pin so we can use flash again.
7177 hw_write_masked (& ioqspi_hw -> io [CS_PIN_INDEX ].ctrl ,
You can’t perform that action at this time.
0 commit comments