Skip to content

Feat/power component - #657

Merged
yingtao450 merged 2 commits into
tuya:masterfrom
yingtao450:feat/power-component
Jul 30, 2026
Merged

Feat/power component#657
yingtao450 merged 2 commits into
tuya:masterfrom
yingtao450:feat/power-component

Conversation

@yingtao450

Copy link
Copy Markdown
Contributor

PR 描述/PR description

[在此详细描述 PR 的内容]/[Describe the PR content in detail here]

代码质量/Code Quality:

在本次拉取请求中,我已考虑以下事项 As part of this pull request, I've considered the following:

  • 确保代码注释和文档清晰,并使用英文注释以保证代码可读性。Ensure that the code comments and documentation are clear, and use English for comments to ensure code readability.
  • 确保文件头遵循文件头格式。Ensure that the file header follows the File Header Format.
  • 确保函数头遵循 Doxygen 格式。Ensure that function headers follow the Doxygen format as specified in Comments.
  • 已查阅 编码风格指南,并核查代码风格合规性,包括缩进、空格、命名规范及其他风格要求。 Reviewed the Coding Style Guide and verified code style compliance, including indentation, spacing, naming conventions, and other style guidelines.
  • 已使用代码格式化工具确保符合 TuyaOpen 编码规范。Have used the code-formatting source code formatting tool to ensure compliance with TuyaOpen coding standards.

yingtao450 and others added 2 commits July 29, 2026 14:23
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>
@yingtao450
yingtao450 merged commit 4e745a4 into tuya:master Jul 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants