blob: 388466d6babd12b72caa63586cbf6713f1c47079 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#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;
}
|