Feat/power component - #657
Merged
Merged
Conversation
Add a two-layer `power` component (tdl_power + tdd_power) modeled on the
button/led drivers, giving battery boards a real abstraction for three
capabilities: power-domain switching, battery gauge, and charger status.
The driver provides mechanism only; the app owns policy.
- tdl_power: app API (find, domain_set/get by semantic role, battery
voltage/percent, charger state + events). Multi-contributor device so one
"power" device can span an AXP PMIC plus SoC GPIO/ADC backends.
- tdd_power_soc: SoC backend - GPIO load-switch domains, ADC divider battery
(peak sampling + EMA smoothing), GPIO charge detect. Charger IRQ uses
single-edge re-arming because T5 has no double-edge GPIO interrupt.
- tdd_power_axp2101: config-driven AXP2101 bring-up, dissolving the old
per-board board_axp2101_api.
- Migrate POCKET / EINK_NFC / ZECTRIX_NOTE_4 / WAVESHARE to the component and
delete the per-board board_power_domain_api / board_charge_detect_api /
board_axp2101_api files.
- Decouple apps (your_chat_bot battery, pocket main_screen) from direct chip
calls.
- WAVESHARE: init the shared I2C0 bus before the (optional) QMI8658 IMU, and
two-point ADC calibration (cal_low/cal_span) verified against a meter.
- examples/peripherals/power/{basic,selftest}: usage demo + on-target self
test with on-screen results; host unit tests under src/peripherals/power/test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Dissolve src/peripherals/pmic into the power component: the axp2101 and m5pm1 chip drivers move under power/tdd_power/src/<chip>/ (no standalone pmic component). Build them with ENABLE_POWER; drop ENABLE_PMIC*. - Add the tdd_power_m5pm1 backend (battery from the M5PM1 ADC, charge state from the power source, plug/unplug IRQ on GPIO13) and register the power device on M5STACK_STICKS3. Slim the M5Stack board file (internal static bring-up, drop the unused public power API and the display test helper) and fix its display select (ENABLE_ESP_DISPLAY -> ENABLE_DISPLAY). - Migrate POCKET / WAVESHARE_ESP32S3 board Kconfig ENABLE_PMIC* -> ENABLE_POWER. - power selftest: portable format specifiers (cast u32/u8 to unsigned) + add M5STACK configs. - Adopt the platform flash-size derivation: bump the ESP32 platform pin and drop the now-redundant PLATFORM_FLASHSIZE selects on ESP32-C6 / ESP32-P4-C6. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shiliu-yang
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 描述/PR description
[在此详细描述 PR 的内容]/[Describe the PR content in detail here]
代码质量/Code Quality:
在本次拉取请求中,我已考虑以下事项 As part of this pull request, I've considered the following: