Charger
概述
WQ7036 支持用于锂电池的集成充电器。支持的充电电流可编程为 0 mA 至 360 mA。
内置电池电流监控器和比较器。目标低电压、目标满电压、充电器电流在不同模式下可编程。
用户可以灵活使用各种锂电池和充电策略。如果在规定的时间段内电池行为异常,充电过程将停止以保护电池。
功能特性
Charger 典型的充电模式有四种:涓流充电模式、恒流模式、恒压模式和重新充电模式。
资源依赖
CHARGER
ADC
用法流程
设置充电电压
wq_charger_set_voltage()设置充电电流
wq_charger_set_current()启动监视充电
wq_charger_mon_enable()
参考示例
/examples/charger_demo/
API 介绍
This section introduces the CHARGER module's enum, structure, functions and how to use this driver.
Typedefs
-
typedef void (*wq_charger_int_callback)(uint8_t flag)
charger int callback.
- Param flag:
pmm charger_on_flag_in
Enums
-
enum WQ_CHARGER_INT_TYPE
charger interrupt type.
Values:
-
enumerator WQ_CHG_INT_DISABLE
Disable the interrupt. Interrupt triggered when switchs from LOW to HIGH.
-
enumerator WQ_CHG_INT_EDGE_RAISING
Interrupt triggered when switchs from HIGH to LOW.
-
enumerator WQ_CHG_INT_EDGE_FALLING
Interrupt triggered when switchs to HIGH or LOW .
-
enumerator WQ_CHG_INT_EDGE_BOTH
Interrupt triggered when stays in LOW.
-
enumerator WQ_CHG_INT_LEVEL_LOW
Interrupt triggered when stays in HIGH.
-
enumerator WQ_CHG_INT_LEVEL_HIGH
Interrupt triggered when is opposite to now.
-
enumerator WQ_CHG_INT_LEVEL_REVERSE
Invalid value
-
enumerator WQ_CHG_INT_MODE_MAX
-
enumerator WQ_CHG_INT_DISABLE
Functions
-
void wq_charger_init(void)
This function is to init PMM Charger.
-
void wq_charger_set_gpio_mode(WQ_CHARGER_GPIO_MODE mode)
This function is to set Charger gpio mode.
- 参数:
mode -- 3.3v gpio or 1.8v gpio
-
bool wq_charger_flag_get(void)
This function is to get flag whether the charging state.
- 返回:
bool bit values of charger_flag_cfg register
-
void wq_charger_register_int_cb(WQ_CHARGER_INT_TYPE int_type, wq_charger_int_callback cb)
This function is to register charger's callback.
- 参数:
int_type -- is charger interrupt tpye
cb -- is charger's callback
-
void wq_charger_gpio_enable(bool enable)
This function is to enable charger's gpio.
- 参数:
enable -- is enable charger's gpio
-
void wq_charger_set_current(uint16_t cur_ma)
set charger max current
- 参数:
cur_ma -- mA
-
void wq_charger_set_current_dp(uint16_t cur_0_1ma)
set charger max current in deep sleep mode
- 参数:
cur_0_1ma -- mA*10
-
void wq_charger_set_voltage(uint32_t vol)
This function is to set charger's voltage.
- 参数:
vol -- is charger's voltage
-
void wq_charger_int_enable(void)
This function is to enable charger interrupt.
-
void wq_charger_flag_int_clear(void)
This function is to clear charger int.
-
void wq_charger_int_disable(void)
This function is to disable charger interrupt.
-
WQ_CHARGER_INT_TYPE wq_charger_get_int_type(void)
This function is to get charger's interrupt type: charger on or off state.
- 返回:
WQ_CHARGER_INT_TYPE charger's interrupt type.
-
uint16_t wq_charger_get_vbat_mv(void)
This function is to get vbat voltage.
- 返回:
vbat voltage mv
-
uint16_t wq_charger_get_vbus_mv(void)
This function is to get vbus voltage.
- 返回:
uint16_t vbus voltage mv
-
void wq_charger_mon_enable(void)
This function is to enable charger current monitor.
-
bool wq_charger_get_mon_flag(void)
This function is to get charger monitor flag.
- 返回:
true or false
-
void wq_charger_clear_charger_mon_flag(void)
This function is clear charger mon flag.
-
uint8_t wq_charger_get_charger_state(void)
This function is to get hw charger cv mode flag.
- 返回:
true or false