feat(battery): 添加电池管理模块和IP5305 PMIC支持

- 添加电池状态监测模块,包括ADC采样和SOC估算功能
- 集成IP5305电源管理芯片支持,配置I2C通信和保活机制
- 实现电池状态事件系统,包含充电状态、满电状态和电量百分比
- 添加电池使能GPIO控制和采样工作队列
- 配置设备树支持电池检测和PMIC控制
- 添加外部模块路径到CMakeLists.txt并更新.gitignore
This commit is contained in:
2026-03-11 18:30:24 +08:00
parent 86af0d2373
commit b3516b988a
7 changed files with 423 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
#include <zephyr/dt-bindings/gpio/gpio.h>
/ {
zephyr,user {
vbat-en-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
io-channels = <&adc 5>, <&adc 7>;
};
};
@@ -24,3 +27,13 @@
&adc {
status = "okay";
};
&i2c1 {
status = "okay";
ip5305: pmic@75 {
status = "okay";
/* 试验项:调整 IP5305 KEY 保活周期,观察 I2C 失败窗口是否随周期移动。 */
keepalive-interval-ms = <10000>;
};
};