File tree 2 files changed +31
-9
lines changed
2 files changed +31
-9
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"
1
+ extern " C" {
2
+ #include " pico.h"
3
+ #include " pico/time.h"
4
+ #include " pico/bootrom.h"
5
+ }
4
6
5
7
// Allow user override of the LED mask
6
8
#ifndef USB_BOOT_LED_ACTIVITY_MASK
@@ -17,14 +19,14 @@ static const uint32_t magic_token[] = {
17
19
static uint32_t __uninitialized_ram (magic_location)[count_of(magic_token)];
18
20
19
21
// run at initialization time
20
- static void __attribute__(( constructor )) boot_double_tap_check () {
22
+ static void boot_double_tap_check () {
21
23
for (uint i = 0 ; i < count_of (magic_token); i++) {
22
24
if (magic_location[i] != magic_token[i]) {
23
25
// Arm for 100 ms then disarm and continue booting
24
26
for (i = 0 ; i < count_of (magic_token); i++) {
25
27
magic_location[i] = magic_token[i];
26
28
}
27
- busy_wait_us (100000 );
29
+ busy_wait_us (500000 );
28
30
magic_location[0 ] = 0 ;
29
31
return ;
30
32
}
@@ -34,4 +36,13 @@ static void __attribute__((constructor)) boot_double_tap_check() {
34
36
reset_usb_boot (USB_BOOT_LED_ACTIVITY_MASK, 0 );
35
37
}
36
38
39
+ class DoubleTap {
40
+ public:
41
+ DoubleTap () {
42
+ boot_double_tap_check ();
43
+ }
44
+ };
45
+
46
+ DoubleTap dt __attribute__ ((init_priority (101 )));
47
+
37
48
#endif
Original file line number Diff line number Diff line change 1
- #include "pico.h"
2
- #include "pico/time.h"
3
- #include "pico/bootrom.h"
1
+ extern " C" {
2
+ #include " pico.h"
3
+ #include " pico/time.h"
4
+ #include " pico/bootrom.h"
5
+ }
4
6
5
7
// Allow user override of the LED mask
6
8
#ifndef USB_BOOT_LED_ACTIVITY_MASK
@@ -17,7 +19,7 @@ static const uint32_t magic_token[] = {
17
19
static uint32_t __uninitialized_ram (magic_location)[count_of(magic_token)];
18
20
19
21
// run at initialization time
20
- static void __attribute__(( constructor )) boot_double_tap_check () {
22
+ static void boot_double_tap_check () {
21
23
for (uint i = 0 ; i < count_of (magic_token); i++) {
22
24
if (magic_location[i] != magic_token[i]) {
23
25
// Arm for 100 ms then disarm and continue booting
@@ -34,4 +36,13 @@ static void __attribute__((constructor)) boot_double_tap_check() {
34
36
reset_usb_boot (USB_BOOT_LED_ACTIVITY_MASK, 0 );
35
37
}
36
38
39
+ class DoubleTap {
40
+ public:
41
+ DoubleTap () {
42
+ boot_double_tap_check ();
43
+ }
44
+ };
45
+
46
+ DoubleTap dt __attribute__ ((init_priority (101 )));
47
+
37
48
#endif
You can’t perform that action at this time.
0 commit comments