File tree 1 file changed +9
-3
lines changed 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 42
42
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN (mod_network_country_obj );
43
43
#endif
44
44
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
+
45
53
// Improved version of
46
54
// https://github.com/raspberrypi/pico-examples/blob/master/picoboard/button/button.c
47
55
static bool __no_inline_not_in_flash_func (bootsel_button )(void ) {
48
- const uint CS_PIN_INDEX = 1 ;
49
-
50
56
// Disable interrupts and the other core since they might be
51
57
// executing code from flash and we are about to temporarily
52
58
// disable flash access.
@@ -65,7 +71,7 @@ static bool __no_inline_not_in_flash_func(bootsel_button)(void) {
65
71
66
72
// The HI GPIO registers in SIO can observe and control the 6 QSPI pins.
67
73
// 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 );
69
75
70
76
// Restore the QSPI_SS pin so we can use flash again.
71
77
hw_write_masked (& ioqspi_hw -> io [CS_PIN_INDEX ].ctrl ,
You can’t perform that action at this time.
0 commit comments