[FL-1151] Power: Low Battery power off routine (#418)

This commit is contained in:
あく
2021-04-19 19:26:25 +03:00
committed by GitHub
parent 8ada9b817b
commit 202673aed1
5 changed files with 109 additions and 36 deletions

View File

@@ -0,0 +1,36 @@
#include "power_cli.h"
#include <api-hal.h>
void power_cli_poweroff(string_t args, void* context) {
api_hal_power_off();
}
void power_cli_reset(string_t args, void* context) {
NVIC_SystemReset();
}
void power_cli_dfu(string_t args, void* context) {
api_hal_boot_set_mode(ApiHalBootModeDFU);
NVIC_SystemReset();
}
void power_cli_test(string_t args, void* context) {
api_hal_power_dump_state();
}
void power_cli_otg_on(string_t args, void* context) {
api_hal_power_enable_otg();
}
void power_cli_otg_off(string_t args, void* context) {
api_hal_power_disable_otg();
}
void power_cli_init(Cli* cli) {
cli_add_command(cli, "poweroff", power_cli_poweroff, NULL);
cli_add_command(cli, "reset", power_cli_reset, NULL);
cli_add_command(cli, "dfu", power_cli_dfu, NULL);
cli_add_command(cli, "power_test", power_cli_test, NULL);
cli_add_command(cli, "power_otg_on", power_cli_otg_on, NULL);
cli_add_command(cli, "power_otg_off", power_cli_otg_off, NULL);
}