summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/powermgmt-sim.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/uisimulator/common/powermgmt-sim.c b/uisimulator/common/powermgmt-sim.c
index 5d669bcae2..1535971e29 100644
--- a/uisimulator/common/powermgmt-sim.c
+++ b/uisimulator/common/powermgmt-sim.c
@@ -43,6 +43,7 @@ static bool charging = false;
43static unsigned int batt_millivolts = BATT_MAXMVOLT; 43static unsigned int batt_millivolts = BATT_MAXMVOLT;
44static unsigned int batt_percent = 100; 44static unsigned int batt_percent = 100;
45static unsigned int batt_runtime = BATT_MAXRUNTIME; 45static unsigned int batt_runtime = BATT_MAXRUNTIME;
46static unsigned int batt_current = 0;
46 47
47void powermgmt_init_target(void) {} 48void powermgmt_init_target(void) {}
48 49
@@ -97,6 +98,8 @@ static void battery_status_update(void)
97 98
98 batt_percent = (batt_millivolts - BATT_MINMVOLT) / (BATT_MAXMVOLT - BATT_MINMVOLT); 99 batt_percent = (batt_millivolts - BATT_MINMVOLT) / (BATT_MAXMVOLT - BATT_MINMVOLT);
99 batt_runtime = batt_percent * BATT_MAXRUNTIME; 100 batt_runtime = batt_percent * BATT_MAXRUNTIME;
101 /* current is completely bogus... */
102 batt_current = charging ? BATT_CHARGE_STEP : BATT_DISCHARGE_STEP;
100} 103}
101 104
102const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { 3200 }; 105const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { 3200 };
@@ -132,6 +135,14 @@ int _battery_time(void)
132} 135}
133#endif 136#endif
134 137
138#if (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE)
139int _battery_current(void)
140{
141 battery_status_update();
142 return batt_current;
143}
144#endif
145
135#if CONFIG_CHARGING 146#if CONFIG_CHARGING
136unsigned int power_input_status(void) 147unsigned int power_input_status(void)
137{ 148{