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:
@@ -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