diff --git a/.gitmodules b/.gitmodules index 75bffdadddeb8..95675132938ef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -59,3 +59,6 @@ [submodule "lib/protobuf-c"] path = lib/protobuf-c url = https://github.com/protobuf-c/protobuf-c.git +[submodule "lib/pico-extras"] + path = lib/pico-extras + url = https://github.com/raspberrypi/pico-extras.git diff --git a/README.md b/README.md index f5bc6d78f0a40..ca2450ea292b6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,38 @@ [](https://github.com/micropython/micropython/actions?query=branch%3Amaster+event%3Apush) [](https://github.com/micropython/micropython/actions?query=branch%3Amaster+event%3Apush) [](https://docs.micropython.org/) [](https://codecov.io/gh/micropython/micropython) +This is a fork of the MicroPython project to allow deep sleeping and waking +from the internal real time clock of the Raspberry Pico. + +This can be built with the following commands: + +```bash +git clone https://github.com/ghubcoder/micropython-pico-deepsleep.git +cd micropython-pico-deepsleep/ +make -C mpy-cross/ +git submodule update --init -- lib/pico-sdk +git submodule update --init -- lib/pico-extras +git submodule update --init -- lib/tinyusb +cd ports/rp2sleep +make -j4 +``` + +This will create a `firmware.uf2` file which can then be loaded onto your +Pico in the usual way using the BOOTSEL button. + +A precompiled binary can be found [here](https://github.com/ghubcoder/micropython-pico-deepsleep/releases/tag/v1.1-pico-deepsleep). + +Example usage: + +```python +import picosleep +picosleep.seconds(60) +``` + +Please see [this](https://ghubcoder.github.io/posts/deep-sleeping-the-pico-micropython/) +post for more information. + +Original readme follows: + The MicroPython project =======================
diff --git a/lib/fsp b/lib/fsp
index e78939d32d1cc..55bffd3a71cbe 160000
--- a/lib/fsp
+++ b/lib/fsp
@@ -1 +1 @@
-Subproject commit e78939d32d1ccea9f0ba8bb42c51aceffd386b9b
+Subproject commit 55bffd3a71cbeed2104cf30e7a39b641d8c1ff48
diff --git a/lib/pico-extras b/lib/pico-extras
new file mode 160000
index 0000000000000..2309d56a3af1d
--- /dev/null
+++ b/lib/pico-extras
@@ -0,0 +1 @@
+Subproject commit 2309d56a3af1df697b33275073c98e92ac93b196
diff --git a/lib/stm32lib b/lib/stm32lib
index 928df866e4d28..eb80f0126e506 160000
--- a/lib/stm32lib
+++ b/lib/stm32lib
@@ -1 +1 @@
-Subproject commit 928df866e4d287ebc3c60726151513ebee609128
+Subproject commit eb80f0126e50687aac966f4c39a2b5a5deffbe78
diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt
index 3a46fdaa7f47b..c9fa6746d4916 100644
--- a/ports/rp2/CMakeLists.txt
+++ b/ports/rp2/CMakeLists.txt
@@ -14,6 +14,12 @@ else()
set(PICO_SDK_PATH ../../lib/pico-sdk)
endif()
+if (PICO_EXTRAS_PATH_OVERRIDE)
+ set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH_OVERRIDE})
+else()
+ set(PICO_EXTRAS_PATH ../../lib/pico-extras)
+endif()
+
# Use the local tinyusb instead of the one in pico-sdk
set(PICO_TINYUSB_PATH ${MICROPY_DIR}/lib/tinyusb)
# Use the local lwip instead of the one in pico-sdk
@@ -71,6 +77,7 @@ string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/tinyusb)
include(${MICROPY_DIR}/py/py.cmake)
include(${MICROPY_DIR}/extmod/extmod.cmake)
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+include(pico_extras_import.cmake)
# Define the top-level project
project(${MICROPY_TARGET})
@@ -125,6 +132,7 @@ set(MICROPY_SOURCE_PORT
machine_spi.c
machine_timer.c
main.c
+ modpicosleep.c
modrp2.c
mphalport.c
mpnetworkport.c
@@ -154,6 +162,7 @@ set(MICROPY_SOURCE_QSTR
${MICROPY_PORT_DIR}/machine_timer.c
${MICROPY_PORT_DIR}/machine_uart.c
${MICROPY_PORT_DIR}/machine_wdt.c
+ ${MICROPY_PORT_DIR}/modpicosleep.c
${MICROPY_PORT_DIR}/modrp2.c
${MICROPY_PORT_DIR}/modos.c
${MICROPY_PORT_DIR}/rp2_flash.c
@@ -177,6 +186,8 @@ set(PICO_SDK_COMPONENTS
hardware_pwm
hardware_regs
hardware_rtc
+ hardware_rosc
+ hardware_sleep
hardware_spi
hardware_structs
hardware_sync
@@ -189,6 +200,7 @@ set(PICO_SDK_COMPONENTS
pico_bootrom
pico_multicore
pico_platform
+ pico_runtime
pico_stdio
pico_stdlib
pico_sync
diff --git a/ports/rp2/boards/RPI_PICO/mpconfigboard.h b/ports/rp2/boards/RPI_PICO/mpconfigboard.h
index c39bc4d489bb6..aee239621ea8c 100644
--- a/ports/rp2/boards/RPI_PICO/mpconfigboard.h
+++ b/ports/rp2/boards/RPI_PICO/mpconfigboard.h
@@ -1,3 +1,3 @@
// Board and hardware specific configuration
-#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
+#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico (sleep)"
#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)
diff --git a/ports/rp2/boards/RPI_PICO_W/mpconfigboard.h b/ports/rp2/boards/RPI_PICO_W/mpconfigboard.h
index ef812b6301356..dfbe0906d3916 100644
--- a/ports/rp2/boards/RPI_PICO_W/mpconfigboard.h
+++ b/ports/rp2/boards/RPI_PICO_W/mpconfigboard.h
@@ -1,5 +1,5 @@
// Board and hardware specific configuration
-#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico W"
+#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico W (sleep)"
// todo: We need something to check our binary size
#define MICROPY_HW_FLASH_STORAGE_BYTES (848 * 1024)
diff --git a/ports/rp2/modpicosleep.c b/ports/rp2/modpicosleep.c
new file mode 100644
index 0000000000000..2b4be7e8a33a9
--- /dev/null
+++ b/ports/rp2/modpicosleep.c
@@ -0,0 +1,113 @@
+
+#include "py/runtime.h"
+#include "pico/sleep.h"
+#include "pico/stdlib.h"
+#include Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages. Alternative Proxies:Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.