flipperzero-firmware/applications/power/power_service/power.h
Albert Kharisov 9b8a139e2b
[FL-1995] New dolphin animations (part 1) (#835)
* Desktop Animation (part 1): Ugly naked ohmygod architecture
* fix butthurt, fix locked scene
* Change SD icons, fixes
* Fix level update animation
* Fixes, correct butthurt
* Clean up code
* furi_assert(0) -> furi_crash("msg")
* Gui: rename none layer to desktop, update docs.

Co-authored-by: あく <alleteam@gmail.com>
2021-11-24 19:21:12 +03:00

69 lines
1.3 KiB
C

#pragma once
#include <stdint.h>
#include <furi/pubsub.h>
#include <stdbool.h>
typedef struct Power Power;
typedef enum {
PowerBootModeNormal,
PowerBootModeDfu,
} PowerBootMode;
typedef enum {
PowerEventTypeStopCharging,
PowerEventTypeStartCharging,
PowerEventTypeFullyCharged,
PowerEventTypeBatteryLevelChanged,
} PowerEventType;
typedef union {
uint8_t battery_level;
} PowerEventData;
typedef struct {
PowerEventType type;
PowerEventData data;
} PowerEvent;
typedef struct {
float current_charger;
float current_gauge;
float voltage_charger;
float voltage_gauge;
float voltage_vbus;
uint32_t capacity_remaining;
uint32_t capacity_full;
float temperature_charger;
float temperature_gauge;
uint8_t charge;
uint8_t health;
} PowerInfo;
/** Power off device
*/
void power_off(Power* power);
/** Reboot device
* @param mode - PowerBootMode
*/
void power_reboot(PowerBootMode mode);
/** Get power info
* @param power - Power instance
* @param info - PowerInfo instance
*/
void power_get_info(Power* power, PowerInfo* info);
/** Get power event pubsub handler
* @param power - Power instance
*/
FuriPubSub* power_get_pubsub(Power* power);
bool power_is_battery_well(PowerInfo* info);