mt2523电源管理
时间:10-02
整理:3721RD
点击:
如何实现长按开机,充电不开机且能实现灯效。
static void check_Battery_voltage(void)//充电函数接口
{
/* Check power on battery voltage and pre-charging battery sample code */
hal_charger_init();
while (1) {
int32_t battery_voltage = 0;
bool charger_status;
hal_charger_meter_get_battery_voltage_sense(&battery_voltage);
LOG_I(common, "Check battery_voltage = %d mV", battery_voltage);
/* Check battery voltage > SHUTDOWN_SYSTEM_VOLTAGE (3400mV) + 100mV */
if (battery_voltage >= SHUTDOWN_SYSTEM_VOLTAGE + 100) {
break;
} else {
hal_charger_get_charger_detect_status(&charger_status);
if (charger_status == true) {
LOG_I(common, "SW charging battery_voltage = %d mV", battery_voltage);
hal_charger_init();
/* Setup pre-charging current. It depends on the battery specifications */
hal_charger_set_charging_current(HAL_CHARGE_CURRENT_70_MA);
hal_charger_enable(true);
/* Reset watchdog timer */
hal_charger_reset_watchdog_timer();
hal_GPT_delay_ms(1 * 1000);
} else {
LOG_I(common, "Low battery power off ! battery_voltage = %d mV", battery_voltage);
hal_sleep_manager_enter_power_off_mode();
}
}
}
}
static void check_Battery_voltage(void)//充电函数接口
{
/* Check power on battery voltage and pre-charging battery sample code */
hal_charger_init();
while (1) {
int32_t battery_voltage = 0;
bool charger_status;
hal_charger_meter_get_battery_voltage_sense(&battery_voltage);
LOG_I(common, "Check battery_voltage = %d mV", battery_voltage);
/* Check battery voltage > SHUTDOWN_SYSTEM_VOLTAGE (3400mV) + 100mV */
if (battery_voltage >= SHUTDOWN_SYSTEM_VOLTAGE + 100) {
break;
} else {
hal_charger_get_charger_detect_status(&charger_status);
if (charger_status == true) {
LOG_I(common, "SW charging battery_voltage = %d mV", battery_voltage);
hal_charger_init();
/* Setup pre-charging current. It depends on the battery specifications */
hal_charger_set_charging_current(HAL_CHARGE_CURRENT_70_MA);
hal_charger_enable(true);
/* Reset watchdog timer */
hal_charger_reset_watchdog_timer();
hal_GPT_delay_ms(1 * 1000);
} else {
LOG_I(common, "Low battery power off ! battery_voltage = %d mV", battery_voltage);
hal_sleep_manager_enter_power_off_mode();
}
}
}
}
学习一下,mark
?
了解一下
路过看看
路过帮顶
路过看看!
路过
支持!
进来看看,我也曾看过2523的电源管理