Implemented power management (#67)
- Implemented HAL for for power management - Implemented the Power app (accessible via Settings app) - Implemented status bar icon for battery status
This commit is contained in:
committed by
GitHub
parent
6520655795
commit
632d7ccccf
@@ -7,6 +7,7 @@
|
||||
#define TT_ASSETS_APP_ICON_FALLBACK TT_ASSET("app_icon_fallback.png")
|
||||
#define TT_ASSETS_APP_ICON_FILES TT_ASSET("app_icon_files.png")
|
||||
#define TT_ASSETS_APP_ICON_DISPLAY_SETTINGS TT_ASSET("app_icon_display_settings.png")
|
||||
#define TT_ASSETS_APP_ICON_POWER_SETTINGS TT_ASSET("app_icon_power_settings.png")
|
||||
#define TT_ASSETS_APP_ICON_SETTINGS TT_ASSET("app_icon_settings.png")
|
||||
#define TT_ASSETS_APP_ICON_SYSTEM_INFO TT_ASSET("app_icon_system_info.png")
|
||||
|
||||
@@ -29,3 +30,10 @@
|
||||
#define TT_ASSETS_ICON_WIFI_SIGNAL_3_LOCKED TT_ASSET("wifi_signal_3_locked.png")
|
||||
#define TT_ASSETS_ICON_WIFI_SIGNAL_4 TT_ASSET("wifi_signal_4.png")
|
||||
#define TT_ASSETS_ICON_WIFI_SIGNAL_4_LOCKED TT_ASSET("wifi_signal_4_locked.png")
|
||||
|
||||
// Power status
|
||||
#define TT_ASSETS_ICON_POWER_020 TT_ASSET("power_020.png")
|
||||
#define TT_ASSETS_ICON_POWER_040 TT_ASSET("power_040.png")
|
||||
#define TT_ASSETS_ICON_POWER_060 TT_ASSET("power_060.png")
|
||||
#define TT_ASSETS_ICON_POWER_080 TT_ASSET("power_080.png")
|
||||
#define TT_ASSETS_ICON_POWER_100 TT_ASSET("power_100.png")
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "tactility_core.h"
|
||||
#include "sdcard.h"
|
||||
#include "power.h"
|
||||
|
||||
typedef bool (*Bootstrap)();
|
||||
typedef bool (*InitGraphics)();
|
||||
@@ -35,4 +36,9 @@ typedef struct {
|
||||
* An optional SD card interface.
|
||||
*/
|
||||
const SdCard* _Nullable sdcard;
|
||||
|
||||
/**
|
||||
* An optional power interface for battery or other power delivery.
|
||||
*/
|
||||
const Power* _Nullable power;
|
||||
} HardwareConfig;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include "power.h"
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef bool (*PowerIsCharging)();
|
||||
typedef void (*PowerSetChargingEnabled)(bool enabled);
|
||||
typedef uint8_t (*PowerGetBatteryCharge)(); // Power value [0, 255] which maps to 0-100% charge
|
||||
typedef int32_t (*PowerGetCurrent)(); // Consumption or charge current in mAh
|
||||
|
||||
typedef struct {
|
||||
PowerIsCharging is_charging;
|
||||
PowerSetChargingEnabled set_charging_enabled;
|
||||
PowerGetBatteryCharge get_charge_level;
|
||||
PowerGetCurrent get_current;
|
||||
} Power;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user