LowPower
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
low_power::ArduinoLowPowerRP2040 Class Reference

Low Power Management for RP2040: In lightSleep we just reduce the processor system clock and voltage. In deepSleep we actually set the processor as dormant, but we must choose between the wakeup by a pin or a timer based wakeup. Only one single wakeup gpio pin is supported! More...

#include <LowPowerRP2040.h>

Inheritance diagram for low_power::ArduinoLowPowerRP2040:
Inheritance graph
[legend]

Classes

struct  PinChangeDef
 

Public Member Functions

bool isProcessingOnSleep (sleep_mode_enum_t sleep_mode)
 Returns true if processing is possible in the current sleep mode.
 
bool sleep (void) override
 sets processor into sleep mode
 
bool setSleepTime (uint32_t time, time_unit_t time_unit_type) override
 Defines the sleep time.
 
bool addWakeupPin (int pin, pin_change_t change_type) override
 Defines the wakup pin.
 
void clear ()
 reset the processing
 
void setRestart (bool flag)
 We force a restart after we wake up from sleep.
 
virtual bool sleepFor (uint32_t time, time_unit_t time_unit_type)
 sets mc into sleep mode to sleep for indicated millis
 
virtual void setActive (bool flag)
 sets the flag to be active
 
virtual void setActiveTime (uint32_t time, time_unit_t time_unit_type)
 Defiles the active time.
 
virtual bool isActive ()
 Checks if we are active (not sleeping)
 
virtual operator bool ()
 same as isActive()
 
virtual bool setSleepMode (sleep_mode_enum_t mode)
 Defines the sleep mode.
 
virtual void process ()
 Triggers the processing to be active or sleeping based on the set definitions.
 
virtual bool isProcessingOnSleep ()
 Returns true if processing is possible in the current sleep mode.
 
virtual bool isModeSupported (sleep_mode_enum_t sleep_mode)
 Provides information if the indicated mode is supported.
 

Protected Member Functions

PinStatus toMode (pin_change_t ct)
 
void light_sleep ()
 
void light_sleep_begin ()
 
void light_sleep_end ()
 
void sleep_goto_dormant_until_edge_high (uint gpio_pin)
 
void sleep_goto_dormant_until_edge_low (uint gpio_pin)
 
uint64_t toUs (uint64_t time, time_unit_t time_unit)
 

Static Protected Member Functions

static void timer_cb (unsigned int)
 
static void interrupt_cb ()
 

Protected Attributes

std::vector< PinChangeDefwakeup_pins
 
uint64_t sleep_time_us = 0
 
bool is_wait_for_pin = false
 
bool is_restart = false
 
int timer_update_delay = 2
 
bool is_active = true
 
uint32_t timeout_end = 0
 
uint32_t timeout_us = 0
 
time_unit_t time_unit = time_unit_t::ms
 
sleep_mode_enum_t sleep_mode = sleep_mode_enum_t::deepSleep
 

Detailed Description

Low Power Management for RP2040: In lightSleep we just reduce the processor system clock and voltage. In deepSleep we actually set the processor as dormant, but we must choose between the wakeup by a pin or a timer based wakeup. Only one single wakeup gpio pin is supported!

Author
Phil Schatzmann for details see

The documentation for this class was generated from the following file: