diff options
Diffstat (limited to 'applications/power/power_service/power.h')
-rw-r--r-- | applications/power/power_service/power.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/applications/power/power_service/power.h b/applications/power/power_service/power.h new file mode 100644 index 00000000..d3dec410 --- /dev/null +++ b/applications/power/power_service/power.h @@ -0,0 +1,65 @@ +#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); |