Merge pull request #7050 from jepler/picow-wirelsess-off-in-deep-sleep
picow: Turn off wifi co-processor regulator when entering deep sleep
This commit is contained in:
commit
062d63ee3a
|
@ -35,6 +35,12 @@
|
|||
|
||||
static int power_management_value = PM_DISABLED;
|
||||
|
||||
void cyw43_enter_deep_sleep(void) {
|
||||
#define WL_REG_ON 23
|
||||
gpio_set_dir(WL_REG_ON, GPIO_OUT);
|
||||
gpio_put(WL_REG_ON, false);
|
||||
}
|
||||
|
||||
void bindings_cyw43_wifi_enforce_pm() {
|
||||
cyw43_wifi_pm(&cyw43_state, power_management_value);
|
||||
}
|
||||
|
|
|
@ -51,3 +51,4 @@ const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj);
|
|||
#define PM_DISABLED CONSTANT_CYW43_PM_VALUE(CYW43_NO_POWERSAVE_MODE, 200, 1, 1, 10)
|
||||
|
||||
extern void bindings_cyw43_wifi_enforce_pm(void);
|
||||
void cyw43_enter_deep_sleep(void);
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
#if CIRCUITPY_CYW43
|
||||
#include "bindings/cyw43/__init__.h"
|
||||
#endif
|
||||
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/shared/workflow.h"
|
||||
|
||||
|
@ -204,6 +208,10 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala
|
|||
void NORETURN common_hal_alarm_enter_deep_sleep(void) {
|
||||
bool timealarm_set = alarm_time_timealarm_is_set();
|
||||
|
||||
#if CIRCUITPY_CYW43
|
||||
cyw43_enter_deep_sleep();
|
||||
#endif
|
||||
|
||||
// If there's a timealarm, just enter a very deep light sleep
|
||||
if (timealarm_set) {
|
||||
// Prune the clock for sleep
|
||||
|
|
Loading…
Reference in New Issue