Skip to content

Commit 35b202f

Browse files
authored
Merge pull request #10381 from dhalbert/nrf-ble-deep-sleep-recovery
nordic: Fix BLE HID to work after deep sleep
2 parents 116b29b + fda497c commit 35b202f

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ static bool __attribute__((noinline)) run_code_py(safe_mode_t safe_mode, bool *s
582582
size_t total_time = blink_time + LED_SLEEP_TIME_MS;
583583
#endif
584584

585-
// This loop is waits after code completes. It waits for fake sleeps to
586-
// finish, user input or autoreloads.
585+
// This loop is run after code completes. It waits for fake sleeps to
586+
// finish, waits for user input, or waits for an autoreload.
587587
#if CIRCUITPY_ALARM
588588
bool fake_sleeping = false;
589589
#endif

ports/nordic/boards/circuitplayground_bluefruit/mpconfigboard.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@
5050
#define DEFAULT_UART_BUS_TX (&pin_P0_14)
5151

5252
#define SPEAKER_ENABLE_PIN (&pin_P1_04)
53+
54+
// Uncomment to allow debugging over console UART
55+
// #define CIRCUITPY_CONSOLE_UART_TX (&pin_P0_14)
56+
// #define CIRCUITPY_CONSOLE_UART_RX (&pin_P0_30)

ports/nordic/common-hal/alarm/__init__.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "common-hal/alarm/touch/TouchAlarm.h"
1414

1515
typedef enum {
16-
NRF_SLEEP_WAKEUP_UNDEFINED,
16+
NRF_SLEEP_WAKEUP_UNDEFINED = 0,
1717
NRF_SLEEP_WAKEUP_GPIO,
1818
NRF_SLEEP_WAKEUP_TIMER,
1919
NRF_SLEEP_WAKEUP_TOUCHPAD,
@@ -33,8 +33,9 @@ extern const alarm_sleep_memory_obj_t alarm_sleep_memory_obj;
3333

3434
enum {
3535
SLEEPMEM_WAKEUP_BY_NONE = 0,
36-
SLEEPMEM_WAKEUP_BY_PIN = 1,
37-
SLEEPMEM_WAKEUP_BY_TIMER = 2,
36+
SLEEPMEM_WAKEUP_BY_PIN,
37+
SLEEPMEM_WAKEUP_BY_TIMER,
38+
SLEEPMEM_WAKEUP_BY_TOUCH,
3839
};
3940
#define WAKEUP_PIN_UNDEF 0xFF
4041
extern uint8_t sleepmem_wakeup_event;

supervisor/shared/bluetooth/bluetooth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void supervisor_bluetooth_init(void) {
189189
boot_in_discovery_mode = false;
190190
if (reset_reason != RESET_REASON_POWER_ON &&
191191
reset_reason != RESET_REASON_RESET_PIN &&
192+
reset_reason != RESET_REASON_DEEP_SLEEP_ALARM &&
192193
reset_reason != RESET_REASON_UNKNOWN &&
193194
reset_reason != RESET_REASON_SOFTWARE) {
194195
return;

0 commit comments

Comments
 (0)