feat(drivers): 添加IP5306 PMIC驱动支持
- 添加IP5306 PMIC驱动实现,包括I2C通信和GPIO唤醒功能 - 实现电源管理芯片的状态读取接口(充电状态、满电状态) - 集成Wakeup保持脉冲功能,支持可配置的脉冲宽度和间隔时间 - 添加设备树绑定文件和Kconfig配置选项 refactor(blinky): 集成IP5306电源管理芯片到电池模块 - 在电池模块中集成IP5306 PMIC状态监控功能 - 修改日志输出格式,显示电池电压及充电/满电状态 - 增加设备初始化检查和错误处理机制 - 配置电源管理限制级别为暂停模式 build: 配置CMakeLists.txt以包含驱动子目录 - 更新主CMakeLists.txt文件添加drivers子目录 - 配置驱动程序的构建层次结构(pmic -> ip5306) - 设置条件编译目标源文件 docs: 添加设备树和板级配置支持 - 添加mini_keyboard板的I2C引脚控制配置 - 配置IP5306设备节点和相关GPIO引脚定义 - 启用I2C配置选项以支持PMIC通信
This commit is contained in:
44
inc/drivers/pmic/ip5306.h
Normal file
44
inc/drivers/pmic/ip5306.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef BLINKY_DRIVERS_PMIC_IP5306_H_
|
||||
#define BLINKY_DRIVERS_PMIC_IP5306_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <zephyr/device.h>
|
||||
|
||||
struct ip5306_status {
|
||||
bool charging;
|
||||
bool full;
|
||||
};
|
||||
|
||||
struct ip5306_driver_api {
|
||||
int (*init)(const struct device *dev);
|
||||
int (*get_status)(const struct device *dev, struct ip5306_status *status);
|
||||
};
|
||||
|
||||
static inline int ip5306_init(const struct device *dev)
|
||||
{
|
||||
const struct ip5306_driver_api *api =
|
||||
(const struct ip5306_driver_api *)dev->api;
|
||||
|
||||
if ((api == NULL) || (api->init == NULL)) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return api->init(dev);
|
||||
}
|
||||
|
||||
static inline int ip5306_get_status(const struct device *dev,
|
||||
struct ip5306_status *status)
|
||||
{
|
||||
const struct ip5306_driver_api *api =
|
||||
(const struct ip5306_driver_api *)dev->api;
|
||||
|
||||
if ((api == NULL) || (api->get_status == NULL)) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return api->get_status(dev, status);
|
||||
}
|
||||
|
||||
#endif /* BLINKY_DRIVERS_PMIC_IP5306_H_ */
|
||||
Reference in New Issue
Block a user