BATTERY_COMM

本文说明该功能的接入方式、关键源码和应用参考。

参考代码

文件

作用

solution\framework\service\battery\battery_comm.c

封装电池电量、电压和充电状态查询接口

API 说明

Defines

BAT_NO_THRESHOLD

No threshold, no charger case

BAT_FULL_THRESHOLD

Battery full charged

BAT_NORMAL_THRESHOLD

Battery voltage normal power

BAT_LOW_POWER_THRESHOLD

Battery voltage low power

BAT_SHUTDOWN_THRESHOLD

Battery shutdown threshold

BAT_EXCEPTION_THRESHOLD

Battery exception threshold

BAT_HYSTERESIS

For charging, using hysteresis to prevent pingpang handvoer.

BAT_HYSTERESIS_POWER_ON

When device power on, the capacitor discharge may cause the measured voltage to be higher.

BAT_DISCHARGE_FILTER

Battery dischargeiler filter

BAT_CHARGE_FILTER

Battery chargeiler filter

BAT_FILTER_COUNT

Number of filtered samples

Enums

enum charger_status_t

Values:

enumerator BATTERY_NORMAL_STATUS

normal

enumerator BATTERY_CHARGING_STATUS

charging

struct battery_curve_t

Public Members

uint16_t remain_percent

percentage of remaining power

uint16_t voltage

voltage value unit:mv