unleashed-firmware/applications/power/power_service/power_api.c
gornekich d3b58f732f
[FL-1783] Power service refactoring ()
* settings power: introduce power settings app
* power: move power API to separate file
* settings power: implement reboot scene
* settings power: add power off scene
* assets: add crying dolphin, fix Subghz assets names
* settings power: fix power off scene GUI
* settings power: add battery info scene
* power: add cli to application on start hook
* power: remove power from main menu
* power: move to power service folder
* power service: rework power off logic
* power: add pubsub events
* bt: subscribe to battery level change, update characteristic
* application: change order of Settings applications
* gui: add bubble element
* power: gui improvements
* application: rename Notification -> LCD and notifications
* Applications: menu order according to documentation and add missing power cli init
* settings power: add disconnect USB scene
* power cli: notify user to disconnect USB after poweroff
* Power: update poweroff message in cli

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-09-24 19:28:02 +03:00

31 lines
753 B
C

#include "power_i.h"
#include <furi.h>
#include "furi-hal-power.h"
#include "furi-hal-boot.h"
void power_off() {
furi_hal_power_off();
}
void power_reboot(PowerBootMode mode) {
if(mode == PowerBootModeNormal) {
furi_hal_boot_set_mode(FuriHalBootModeNormal);
} else if(mode == PowerBootModeDfu) {
furi_hal_boot_set_mode(FuriHalBootModeDFU);
}
furi_hal_power_reset();
}
void power_get_info(Power* power, PowerInfo* info) {
furi_assert(power);
furi_assert(info);
osMutexAcquire(power->info_mtx, osWaitForever);
memcpy(info, &power->info, sizeof(power->info));
osMutexRelease(power->info_mtx);
}
PubSub* power_get_pubsub(Power* power) {
furi_assert(power);
return &power->event_pubsub;
}