nordic: Fix BLE HID to work after deep sleep

This commit is contained in:
Dan Halbert 2025-05-28 12:30:57 -04:00
parent af8de21a60
commit fda497cd12
4 changed files with 11 additions and 5 deletions

4
main.c
View file

@ -582,8 +582,8 @@ static bool __attribute__((noinline)) run_code_py(safe_mode_t safe_mode, bool *s
size_t total_time = blink_time + LED_SLEEP_TIME_MS;
#endif
// This loop is waits after code completes. It waits for fake sleeps to
// finish, user input or autoreloads.
// This loop is run after code completes. It waits for fake sleeps to
// finish, waits for user input, or waits for an autoreload.
#if CIRCUITPY_ALARM
bool fake_sleeping = false;
#endif

View file

@ -50,3 +50,7 @@
#define DEFAULT_UART_BUS_TX (&pin_P0_14)
#define SPEAKER_ENABLE_PIN (&pin_P1_04)
// Uncomment to allow debugging over console UART
// #define CIRCUITPY_CONSOLE_UART_TX (&pin_P0_14)
// #define CIRCUITPY_CONSOLE_UART_RX (&pin_P0_30)

View file

@ -13,7 +13,7 @@
#include "common-hal/alarm/touch/TouchAlarm.h"
typedef enum {
NRF_SLEEP_WAKEUP_UNDEFINED,
NRF_SLEEP_WAKEUP_UNDEFINED = 0,
NRF_SLEEP_WAKEUP_GPIO,
NRF_SLEEP_WAKEUP_TIMER,
NRF_SLEEP_WAKEUP_TOUCHPAD,
@ -33,8 +33,9 @@ extern const alarm_sleep_memory_obj_t alarm_sleep_memory_obj;
enum {
SLEEPMEM_WAKEUP_BY_NONE = 0,
SLEEPMEM_WAKEUP_BY_PIN = 1,
SLEEPMEM_WAKEUP_BY_TIMER = 2,
SLEEPMEM_WAKEUP_BY_PIN,
SLEEPMEM_WAKEUP_BY_TIMER,
SLEEPMEM_WAKEUP_BY_TOUCH,
};
#define WAKEUP_PIN_UNDEF 0xFF
extern uint8_t sleepmem_wakeup_event;

View file

@ -189,6 +189,7 @@ void supervisor_bluetooth_init(void) {
boot_in_discovery_mode = false;
if (reset_reason != RESET_REASON_POWER_ON &&
reset_reason != RESET_REASON_RESET_PIN &&
reset_reason != RESET_REASON_DEEP_SLEEP_ALARM &&
reset_reason != RESET_REASON_UNKNOWN &&
reset_reason != RESET_REASON_SOFTWARE) {
return;