Loading...
Searching...
No Matches
low_power.h File Reference
#include "pico.h"
#include "hardware/timer.h"
#include "pico/time.h"
#include "pico/aon_timer.h"
#include "hardware/clocks.h"
#include "hardware/powman.h"

Go to the source code of this file.

Macros

#define PARAM_ASSERTIONS_ENABLED_PICO_LOW_POWER   0
#define PICO_LOW_POWER_MIN_AON_SLEEP_TIME_MS   10
#define PICO_LOW_POWER_MIN_DORMANT_TIME_MS   10
#define PICO_LOW_POWER_MIN_PSTATE_TIME_MS   10
#define DORMANT_CLOCK_SOURCE_DEFAULT   DORMANT_CLOCK_SOURCE_LPOSC
#define DORMANT_CLOCK_HZ_DEFAULT   0

Typedefs

typedef void(* low_power_pstate_resume_func) (pstate_bitset_t *pstate)

Enumerations

enum  dormant_clock_source_t { DORMANT_CLOCK_SOURCE_XOSC , DORMANT_CLOCK_SOURCE_ROSC , DORMANT_CLOCK_SOURCE_LPOSC , NUM_DORMANT_CLOCK_SOURCES }

Functions

void low_power_set_pins_low_leakage_exclude_mask (uint32_t exclude_mask)
 Set all pins to a low leakage state.
static void low_power_set_pins_low_leakage_exclude_mask64 (uint64_t exclude_mask)
 Set all pins to a low leakage state (64-bit mask version).
int low_power_sleep_until_irq (const clock_dest_bitset_t *keep_enabled)
 Sleep until an interrupt occurs.
int low_power_sleep_until_timer (timer_hw_t *timer, absolute_time_t until, const clock_dest_bitset_t *keep_enabled, bool exclusive)
 Sleep until time using timer.
static int low_power_sleep_until_default_timer (absolute_time_t until, const clock_dest_bitset_t *keep_enabled, bool exclusive)
 Sleep until time using default timer.
int low_power_sleep_until_aon_timer (absolute_time_t until, const clock_dest_bitset_t *keep_enabled, bool exclusive)
 Sleep until time using AON timer.
int low_power_sleep_until_gpio_pin_state (uint gpio_pin, bool edge, bool high, const clock_dest_bitset_t *keep_enabled, bool exclusive)
 Sleep until GPIO pin state changes.
static int low_power_set_external_clock_source (__unused uint src_hz, __unused uint gpio_pin)
 Set the external clock source for the AON timer.
int low_power_dormant_until_aon_timer (absolute_time_t until, dormant_clock_source_t dormant_clock_source, const clock_dest_bitset_t *keep_enabled)
 Go dormant until time using AON timer.
int low_power_dormant_until_gpio_pin_state (uint gpio_pin, bool edge, bool high, dormant_clock_source_t dormant_clock_source, const clock_dest_bitset_t *keep_enabled)
 Go dormant until GPIO pin state changes.
int low_power_pstate_until_aon_timer (absolute_time_t until, pstate_bitset_t *pstate, low_power_pstate_resume_func resume_func)
 Go to Pstate until time using AON timer.
int low_power_pstate_until_gpio_pin_state (uint gpio_pin, bool edge, bool high, pstate_bitset_t *pstate, low_power_pstate_resume_func resume_func)
 Go to Pstate until GPIO pin state changes.
pstate_bitset_t * low_power_persistent_pstate_get (pstate_bitset_t *pstate)
 Get Pstate which keeps persistent data powered on.
static bool low_power_start_aon_timer_at_time_ms (uint64_t ms)
 Start the AON timer at a specific time in milliseconds.
static bool low_power_start_aon_timer (void)
 Start the AON timer at the current system time.
static int low_power_sleep_for_us (timer_hw_t *timer, uint64_t us, const clock_dest_bitset_t *keep_enabled, bool exclusive)
 Sleep for a number of microseconds.
static int low_power_sleep_for_ms (uint32_t ms, const clock_dest_bitset_t *keep_enabled, bool exclusive)
 Sleep for a number of milliseconds.
static int low_power_dormant_for_ms (uint32_t ms, dormant_clock_source_t dormant_clock_source, const clock_dest_bitset_t *keep_enabled)
 Go dormant for a number of milliseconds.
static int low_power_pstate_for_ms (uint32_t ms, pstate_bitset_t *pstate, low_power_pstate_resume_func resume_func)
 Go to Pstate for a number of milliseconds.