|
10 | 10 |
|
11 | 11 | #include "shared-bindings/_bleio/__init__.h" |
12 | 12 | #include "shared-bindings/_bleio/Adapter.h" |
13 | | -#if defined(CIRCUITPY_BOOT_BUTTON) |
14 | | -#include "shared-bindings/digitalio/DigitalInOut.h" |
15 | | -#include "shared-bindings/time/__init__.h" |
16 | | -#endif |
17 | 13 | #include "shared-bindings/microcontroller/Processor.h" |
18 | 14 | #include "shared-bindings/microcontroller/ResetReason.h" |
19 | 15 | #include "shared-module/storage/__init__.h" |
20 | 16 |
|
21 | 17 | #include "common-hal/_bleio/__init__.h" |
22 | 18 |
|
| 19 | +#include "supervisor/port.h" |
23 | 20 | #include "supervisor/shared/serial.h" |
24 | 21 | #include "supervisor/shared/status_leds.h" |
25 | 22 | #include "supervisor/shared/tick.h" |
@@ -238,18 +235,10 @@ void supervisor_bluetooth_init(void) { |
238 | 235 | new_status_color(BLACK); |
239 | 236 | } |
240 | 237 | #endif |
241 | | - // Init the boot button every time in case it is used for LEDs. |
242 | | - #ifdef CIRCUITPY_BOOT_BUTTON |
243 | | - digitalio_digitalinout_obj_t boot_button; |
244 | | - common_hal_digitalio_digitalinout_construct(&boot_button, CIRCUITPY_BOOT_BUTTON); |
245 | | - common_hal_digitalio_digitalinout_switch_to_input(&boot_button, PULL_UP); |
246 | | - common_hal_time_delay_ms(1); |
247 | | - bool button_pressed = !common_hal_digitalio_digitalinout_get_value(&boot_button); |
248 | | - common_hal_digitalio_digitalinout_deinit(&boot_button); |
249 | | - if (button_pressed) { |
| 238 | + if (port_boot_button_pressed()) { |
250 | 239 | boot_in_discovery_mode = true; |
| 240 | + break; |
251 | 241 | } |
252 | | - #endif |
253 | 242 | diff = supervisor_ticks_ms64() - start_ticks; |
254 | 243 | } |
255 | 244 | if (boot_in_discovery_mode) { |
|
0 commit comments