powman
Module: powman
Source: modules/powman.py
Depends on: machine.mem32, machine.idle
Functions
Section titled “Functions”powmanInit(absTimeMs: int) -> None
Section titled “powmanInit(absTimeMs: int) -> None”Initialise the POWMAN 64-bit timer with an absolute time value.
Must be called once before powmanOffForMs() to seed the internal clock.
| Parameter | Type | Description |
|---|---|---|
absTimeMs | int | Absolute time in milliseconds. Must be ≥ 1. |
Raises Exception if absTimeMs < 1.
import powman, time
powman.powmanInit(time.ticks_ms())powmanOffForMs(sleepingMs: int) -> None
Section titled “powmanOffForMs(sleepingMs: int) -> None”Enter dormant mode for the specified duration, then reboot.
The alarm is set relative to the current POWMAN timer value. The device reboots when the alarm fires.
| Parameter | Type | Description |
|---|---|---|
sleepingMs | int | Sleep duration in milliseconds. Must be ≥ 1. |
Raises Exception if sleepingMs < 1.
import powman, time
powman.powmanInit(time.ticks_ms())powman.powmanOffForMs(30_000) # deep-sleep for 30 seconds, then rebootpowmanOffUntilGPIO(gpio: int) -> None
Section titled “powmanOffUntilGPIO(gpio: int) -> None”Enter dormant mode and wake when a GPIO pin goes HIGH.
The pad pull-down is disabled and the pin is configured as a wake-up source before entering the low-power state. The device reboots on wake.
| Parameter | Type | Description |
|---|---|---|
gpio | int | GPIO number (0–49). |
Raises Exception if gpio is outside 0–49.
import powman
powman.powmanOffUntilGPIO(10) # sleep until GPIO10 goes HIGHInternal helpers
Section titled “Internal helpers”These functions are used internally and are not intended to be called directly.
| Function | Description |
|---|---|
_getCurrentTime() | Reads the current 64-bit POWMAN timer value with a consistency check on the upper 32 bits. |
_forceReboot() | Clears BOOT0–BOOT3 registers to set up a clean reboot target. |
_powmanPowerOff() | Configures VREG for low-power entry and transitions the state machine to dormant mode. |