1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 04:41:26 +04:00
Files
flipperzero-firmware/applications/services/power/power_service/power_i.h
Astra 2817666eb9 [FL-3774] Fix 5V on GPIO (#4103)
* Move OTG controls to the power service
* Accessor: add missing power service import
* Power: add is_otg_enabled to info and properly handle OTG enable with VBUS voltage present
* Power: method naming
* Power: add backward compatibility with old-style use of furi_hal_power
* Scripts: lower MIN_GAP_PAGES to 1
* SubGhz: fix incorrect logging tag
* SubGhz: delegate OTG management to power service
* Power: fix condition race, various improvements

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2025-02-20 12:37:52 +09:00

64 lines
1.2 KiB
C

#pragma once
#include "power.h"
#include <gui/gui.h>
#include <gui/view_holder.h>
#include <toolbox/api_lock.h>
#include <assets_icons.h>
#include "views/power_off.h"
#include "views/power_unplug_usb.h"
typedef enum {
PowerStateNotCharging,
PowerStateCharging,
PowerStateCharged,
} PowerState;
struct Power {
ViewHolder* view_holder;
FuriPubSub* event_pubsub;
FuriEventLoop* event_loop;
FuriMessageQueue* message_queue;
ViewPort* battery_view_port;
PowerOff* view_power_off;
PowerUnplugUsb* view_power_unplug_usb;
PowerEvent event;
PowerState state;
PowerInfo info;
bool battery_low;
bool show_battery_low_warning;
bool is_otg_requested;
uint8_t battery_level;
uint8_t power_off_timeout;
};
typedef enum {
PowerViewOff,
PowerViewUnplugUsb,
} PowerView;
typedef enum {
PowerMessageTypeShutdown,
PowerMessageTypeReboot,
PowerMessageTypeGetInfo,
PowerMessageTypeIsBatteryHealthy,
PowerMessageTypeShowBatteryLowWarning,
PowerMessageTypeSwitchOTG,
} PowerMessageType;
typedef struct {
PowerMessageType type;
union {
PowerBootMode boot_mode;
PowerInfo* power_info;
bool* bool_param;
};
FuriApiLock lock;
} PowerMessage;