Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement alarm-module for RP2350 #9965

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ports/raspberrypi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ SRC_C += \
bindings/rp2pio/__init__.c \
common-hal/rp2pio/StateMachine.c \
common-hal/rp2pio/__init__.c \
common-hal/alarm/rosc.c \
audio_dma.c \
background.c \
peripherals/pins.c \
Expand Down
19 changes: 15 additions & 4 deletions ports/raspberrypi/bindings/cyw43/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"

#include "lib/cyw43-driver/src/cyw43.h"
#include "pico/cyw43_arch.h"

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);
// called from common-hal/alarm/__init__.c
void bindings_cyw43_power_down(void) {
cyw43_arch_deinit();
gpio_set_dir(CYW43_DEFAULT_PIN_WL_REG_ON, GPIO_OUT);
gpio_put(CYW43_DEFAULT_PIN_WL_REG_ON, false);
}

// called from supervisor/port.c and common-hal/alarm/__init__.c
bool bindings_cyw43_power_up(void) {
gpio_set_dir(CYW43_DEFAULT_PIN_WL_REG_ON, GPIO_OUT);
gpio_put(CYW43_DEFAULT_PIN_WL_REG_ON, true);
// Change this as a placeholder as to how to init with country code.
// Default country code is CYW43_COUNTRY_WORLDWIDE)
return cyw43_arch_init_with_country(PICO_CYW43_ARCH_DEFAULT_COUNTRY_CODE);
}

void bindings_cyw43_wifi_enforce_pm(void) {
Expand Down
3 changes: 2 additions & 1 deletion ports/raspberrypi/bindings/cyw43/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj, qstr arg_
#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);
extern void bindings_cyw43_power_down(void);
extern bool bindings_cyw43_power_up(void);
Loading