feat(power): 更新电源管理模块从IP5305到IP5306
- 在CMakeLists.txt中更新ZEPHYR_EXTRA_MODULES路径从ip5305到ip5306 - 在文档中更新未纳入索引的项目项,将IP5305相关引用替换为IP5306 - 在prj.conf中将CONFIG_IP5305配置更改为CONFIG_IP5306 - 在battery_module.c中更新头文件包含、设备获取和函数调用从ip5305到ip5306 - 更新日志输出中的设备名称以匹配新的IP5306芯片
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
if(EXISTS "E:/extra/modules/ip5305")
|
||||
list(APPEND ZEPHYR_EXTRA_MODULES "E:/extra/modules/ip5305")
|
||||
if(EXISTS "E:/extra/modules/ip5306")
|
||||
list(APPEND ZEPHYR_EXTRA_MODULES "E:/extra/modules/ip5306")
|
||||
endif()
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
## 未纳入本索引的项目项
|
||||
|
||||
- `zephyr/drivers/power/ip5305.h`、`CONFIG_IP5305`:当前项目使用的是自定义驱动/自定义绑定,Zephyr 官方 latest 站点未核到对应官方页面,因此未纳入
|
||||
- `zephyr/drivers/power/ip5306.h`、`CONFIG_IP5306`:当前项目使用的是自定义驱动/自定义绑定,Zephyr 官方 latest 站点未核到对应官方页面,因此未纳入
|
||||
- `pm_static.yml` 对应的 Partition Manager 规划:属于 Nordic NCS 范畴,不属于 Zephyr 官方 docs 站点范围;Nordic 官方索引见 [nordic_ncs_官方知识索引.md](./nordic_ncs_官方知识索引.md)
|
||||
- `CAF`、`App Event Manager`、`settings_loader`、`ble_state`、`ble_common_event`、`power_manager`、`buttons_def.h` 等:属于 Nordic NCS/CAF 文档范围,不属于本 Zephyr 官方索引;Nordic 官方索引见 [nordic_ncs_官方知识索引.md](./nordic_ncs_官方知识索引.md)
|
||||
- 项目私有协议与实现,如时间同步私有 GATT 服务、主机 HID 命令协议、显示主题持久化逻辑等:只索引其依赖的 Zephyr 通用能力,不索引项目私有设计本身
|
||||
|
||||
2
prj.conf
2
prj.conf
@@ -92,7 +92,7 @@ CONFIG_CAF_BUTTONS_DEBOUNCE_INTERVAL=10
|
||||
|
||||
CONFIG_ADC=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_IP5305=y
|
||||
CONFIG_IP5306=y
|
||||
CONFIG_SENSOR=y
|
||||
CONFIG_DISPLAY=y
|
||||
CONFIG_MIPI_DBI=y
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/power/ip5305.h>
|
||||
#include <zephyr/drivers/power/ip5306.h>
|
||||
#include <zephyr/drivers/sensor.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
@@ -32,7 +32,7 @@ LOG_MODULE_REGISTER(MODULE);
|
||||
#define BATTERY_EMPTY_MV 3300
|
||||
#define BATTERY_FULL_MV 4100
|
||||
|
||||
static const struct device *const ip5305_dev = DEVICE_DT_GET(DT_NODELABEL(ip5305));
|
||||
static const struct device *const ip5306_dev = DEVICE_DT_GET(DT_NODELABEL(ip5306));
|
||||
static const struct device *const battery_sensor_dev = DEVICE_DT_GET(BATTERY_SENSE_NODE);
|
||||
|
||||
/*
|
||||
@@ -164,19 +164,19 @@ static int board_power_monitor_read_voltage_mv(int32_t *voltage_mv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 从 IP5305 读取一次充电态与满电态。 */
|
||||
/* 从 IP5306 读取一次充电态与满电态。 */
|
||||
static int board_power_monitor_read_charge_state(bool *charging, bool *full)
|
||||
{
|
||||
int err = ip5305_is_charging(ip5305_dev, charging);
|
||||
int err = ip5306_is_charging(ip5306_dev, charging);
|
||||
|
||||
if (err) {
|
||||
LOG_WRN("ip5305_is_charging failed (err=%d)", err);
|
||||
LOG_WRN("ip5306_is_charging failed (err=%d)", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = ip5305_is_charge_full(ip5305_dev, full);
|
||||
err = ip5306_is_charge_full(ip5306_dev, full);
|
||||
if (err) {
|
||||
LOG_WRN("ip5305_is_charge_full failed (err=%d)", err);
|
||||
LOG_WRN("ip5306_is_charge_full failed (err=%d)", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -305,8 +305,8 @@ out_reschedule:
|
||||
/* 初始化 board power monitor consumer,并拉起首轮采样。 */
|
||||
static int battery_module_init(void)
|
||||
{
|
||||
if (!device_is_ready(ip5305_dev)) {
|
||||
LOG_ERR("IP5305 device not ready");
|
||||
if (!device_is_ready(ip5306_dev)) {
|
||||
LOG_ERR("IP5306 device not ready");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user