Flipper Zero Firmware
Loading...
Searching...
No Matches
power.h
1#pragma once
2
3#include <stdint.h>
4#include <core/pubsub.h>
5#include <stdbool.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define RECORD_POWER "power"
12
13typedef struct Power Power;
14
15typedef enum {
16 PowerBootModeNormal,
17 PowerBootModeDfu,
18 PowerBootModeUpdateStart,
19} PowerBootMode;
20
21typedef enum {
22 PowerEventTypeStopCharging,
23 PowerEventTypeStartCharging,
24 PowerEventTypeFullyCharged,
25 PowerEventTypeBatteryLevelChanged,
26} PowerEventType;
27
28typedef union {
29 uint8_t battery_level;
31
32typedef struct {
33 PowerEventType type;
34 PowerEventData data;
36
37typedef struct {
38 bool gauge_is_ok;
39 bool is_charging;
40 bool is_shutdown_requested;
41
42 float current_charger;
43 float current_gauge;
44
45 float voltage_battery_charge_limit;
46 float voltage_charger;
47 float voltage_gauge;
48 float voltage_vbus;
49
50 uint32_t capacity_remaining;
51 uint32_t capacity_full;
52
53 float temperature_charger;
54 float temperature_gauge;
55
56 uint8_t charge;
57 uint8_t health;
58} PowerInfo;
59
62void power_off(Power* power);
63
68void power_reboot(PowerBootMode mode);
69
75void power_get_info(Power* power, PowerInfo* info);
76
83FuriPubSub* power_get_pubsub(Power* power);
84
89bool power_is_battery_healthy(Power* power);
90
96void power_enable_low_battery_level_notification(Power* power, bool enable);
97
98#ifdef __cplusplus
99}
100#endif
FuriPubSub.
Definition pubsub.c:14
Definition power.h:32
Definition power_i.h:24
Definition power.h:37
Definition power.h:28