Skip to content

Commit 062d63e

Browse files
authored
Merge pull request #7050 from jepler/picow-wirelsess-off-in-deep-sleep
picow: Turn off wifi co-processor regulator when entering deep sleep
2 parents 8caafd9 + 0c5fd55 commit 062d63e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

ports/raspberrypi/bindings/cyw43/__init__.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535

3636
static int power_management_value = PM_DISABLED;
3737

38+
void cyw43_enter_deep_sleep(void) {
39+
#define WL_REG_ON 23
40+
gpio_set_dir(WL_REG_ON, GPIO_OUT);
41+
gpio_put(WL_REG_ON, false);
42+
}
43+
3844
void bindings_cyw43_wifi_enforce_pm() {
3945
cyw43_wifi_pm(&cyw43_state, power_management_value);
4046
}

ports/raspberrypi/bindings/cyw43/__init__.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj);
5151
#define PM_DISABLED CONSTANT_CYW43_PM_VALUE(CYW43_NO_POWERSAVE_MODE, 200, 1, 1, 10)
5252

5353
extern void bindings_cyw43_wifi_enforce_pm(void);
54+
void cyw43_enter_deep_sleep(void);

ports/raspberrypi/common-hal/alarm/__init__.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838

3939
#include "shared-bindings/microcontroller/__init__.h"
4040

41+
#if CIRCUITPY_CYW43
42+
#include "bindings/cyw43/__init__.h"
43+
#endif
44+
4145
#include "supervisor/port.h"
4246
#include "supervisor/shared/workflow.h"
4347

@@ -204,6 +208,10 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala
204208
void NORETURN common_hal_alarm_enter_deep_sleep(void) {
205209
bool timealarm_set = alarm_time_timealarm_is_set();
206210

211+
#if CIRCUITPY_CYW43
212+
cyw43_enter_deep_sleep();
213+
#endif
214+
207215
// If there's a timealarm, just enter a very deep light sleep
208216
if (timealarm_set) {
209217
// Prune the clock for sleep

0 commit comments

Comments
 (0)