e2c9d8f1e4
The Waveshare board exposes PIN_PWR (GPIO 1) specifically so battery
designs can gate the panel rail between refreshes. Before this commit
PIN_PWR was driven HIGH at boot and never released, so the panel's
boost converter kept its quiescent draw (50–500 µA) through every
deep sleep. The e-ink particles are bistable so the displayed image
persists without VDD; dropping the rail is a free win.
Three pieces:
• epd_sleep() drives PIN_PWR LOW after issuing the panel-internal
DEEP_SLEEP command, then gpio_hold_en() latches the level so it
survives the chip's RTC transition.
• normal_operation_impl() calls gpio_deep_sleep_hold_en() just
before esp_deep_sleep_start() so the per-pin hold extends through
the deep sleep period itself (without this the holds release on
the transition and the rail comes back up).
• epd_setup_pins() calls gpio_hold_dis() at the very top to free
PIN_PWR on wake before re-driving it HIGH; no-op on cold boot.
Tests: 47/47 pass. Added test/mocks/driver/gpio.h with no-op stubs so
the native test build links cleanly.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
12 lines
483 B
C
12 lines
483 B
C
#pragma once
|
|
// Native-test stubs for gpio_hold_* — operation.h calls
|
|
// gpio_deep_sleep_hold_en() before esp_deep_sleep_start() to latch
|
|
// PIN_PWR LOW through deep sleep. epd_driver.cpp (not built natively)
|
|
// also uses gpio_hold_en / gpio_hold_dis. Stubs let tests link.
|
|
#include "esp_sleep.h" // for gpio_num_t
|
|
|
|
inline void gpio_hold_en(gpio_num_t) {}
|
|
inline void gpio_hold_dis(gpio_num_t) {}
|
|
inline void gpio_deep_sleep_hold_en() {}
|
|
inline void gpio_deep_sleep_hold_dis() {}
|