Factor out duplicate code.
This commit is contained in:
parent
fd9af9145a
commit
821b984b5a
1 changed files with 3 additions and 14 deletions
|
|
@ -10,16 +10,13 @@
|
|||
|
||||
#include "shared-bindings/_bleio/__init__.h"
|
||||
#include "shared-bindings/_bleio/Adapter.h"
|
||||
#if defined(CIRCUITPY_BOOT_BUTTON)
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
#endif
|
||||
#include "shared-bindings/microcontroller/Processor.h"
|
||||
#include "shared-bindings/microcontroller/ResetReason.h"
|
||||
#include "shared-module/storage/__init__.h"
|
||||
|
||||
#include "common-hal/_bleio/__init__.h"
|
||||
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/shared/serial.h"
|
||||
#include "supervisor/shared/status_leds.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
|
@ -238,18 +235,10 @@ void supervisor_bluetooth_init(void) {
|
|||
new_status_color(BLACK);
|
||||
}
|
||||
#endif
|
||||
// Init the boot button every time in case it is used for LEDs.
|
||||
#ifdef CIRCUITPY_BOOT_BUTTON
|
||||
digitalio_digitalinout_obj_t boot_button;
|
||||
common_hal_digitalio_digitalinout_construct(&boot_button, CIRCUITPY_BOOT_BUTTON);
|
||||
common_hal_digitalio_digitalinout_switch_to_input(&boot_button, PULL_UP);
|
||||
common_hal_time_delay_ms(1);
|
||||
bool button_pressed = !common_hal_digitalio_digitalinout_get_value(&boot_button);
|
||||
common_hal_digitalio_digitalinout_deinit(&boot_button);
|
||||
if (button_pressed) {
|
||||
if (port_boot_button_pressed()) {
|
||||
boot_in_discovery_mode = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
diff = supervisor_ticks_ms64() - start_ticks;
|
||||
}
|
||||
if (boot_in_discovery_mode) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue