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