File tree 1 file changed +37
-0
lines changed
variants/NANO_RP2040_CONNECT
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include "pico.h"
2
+ #include "pico/time.h"
3
+ #include "pico/bootrom.h"
4
+
5
+ // Allow user override of the LED mask
6
+ #ifndef USB_BOOT_LED_ACTIVITY_MASK
7
+ #define USB_BOOT_LED_ACTIVITY_MASK 1
8
+ #endif
9
+
10
+ // Doesn't make any sense for a RAM only binary
11
+ #if !PICO_NO_FLASH
12
+
13
+ static const uint32_t magic_token [] = {
14
+ 0xf01681de , 0xbd729b29 , 0xd359be7a ,
15
+ };
16
+
17
+ static uint32_t __uninitialized_ram (magic_location )[count_of (magic_token )];
18
+
19
+ // run at initialization time
20
+ static void __attribute__((constructor )) boot_double_tap_check () {
21
+ for (uint i = 0 ; i < count_of (magic_token ); i ++ ) {
22
+ if (magic_location [i ] != magic_token [i ]) {
23
+ // Arm for 100 ms then disarm and continue booting
24
+ for (i = 0 ; i < count_of (magic_token ); i ++ ) {
25
+ magic_location [i ] = magic_token [i ];
26
+ }
27
+ busy_wait_us (100000 );
28
+ magic_location [0 ] = 0 ;
29
+ return ;
30
+ }
31
+ }
32
+
33
+ magic_location [0 ] = 0 ;
34
+ reset_usb_boot (USB_BOOT_LED_ACTIVITY_MASK , 0 );
35
+ }
36
+
37
+ #endif
You can’t perform that action at this time.
0 commit comments