Skip to content

powman

Module: powman
Source: modules/powman.py
Depends on: machine.mem32, machine.idle

Initialise the POWMAN 64-bit timer with an absolute time value.

Must be called once before powmanOffForMs() to seed the internal clock.

ParameterTypeDescription
absTimeMsintAbsolute time in milliseconds. Must be ≥ 1.

Raises Exception if absTimeMs < 1.

import powman, time
powman.powmanInit(time.ticks_ms())

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.

ParameterTypeDescription
sleepingMsintSleep 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 reboot

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.

ParameterTypeDescription
gpiointGPIO number (0–49).

Raises Exception if gpio is outside 0–49.

import powman
powman.powmanOffUntilGPIO(10) # sleep until GPIO10 goes HIGH

These functions are used internally and are not intended to be called directly.

FunctionDescription
_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.