d3b58f732f
* 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>
66 lines
1.2 KiB
C
66 lines
1.2 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <furi/pubsub.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();
|
|
|
|
/** 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
|
|
*/
|
|
PubSub* power_get_pubsub(Power* power);
|