summaryrefslogtreecommitdiff
path: root/firmware/export/powermgmt.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-11-30 14:16:13 +0000
committerAidan MacDonald <amachronic@protonmail.com>2021-12-23 11:39:58 +0000
commitad05c872fe1a0d925f478106bfb56e731f3ce53c (patch)
tree156bae0098029e193a9914b6c7049f31efa3805f /firmware/export/powermgmt.h
parent923f92cb12ee39364ddec340de140d126ced1347 (diff)
downloadrockbox-ad05c872fe1a0d925f478106bfb56e731f3ce53c.tar.gz
rockbox-ad05c872fe1a0d925f478106bfb56e731f3ce53c.zip
powermgmt: Add battery current measurement
This allows targets to report the actual discharging or charging current if they are able to. Change-Id: I0b538e6ac94346f1434e45f83c8da8c1260a53a3
Diffstat (limited to 'firmware/export/powermgmt.h')
-rw-r--r--firmware/export/powermgmt.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index c6fc3d5bdf..9d4d4e06aa 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -94,6 +94,11 @@ void powermgmt_init(void) INIT_ATTR;
94#define BATT_AVE_SAMPLES 128 94#define BATT_AVE_SAMPLES 128
95#endif 95#endif
96 96
97#ifndef BATT_CURRENT_AVE_SAMPLES
98/* TODO may need tweaking */
99#define BATT_CURRENT_AVE_SAMPLES 16
100#endif
101
97#ifndef POWER_THREAD_STEP_TICKS 102#ifndef POWER_THREAD_STEP_TICKS
98/* 2HZ sample rate unless otherwise specified */ 103/* 2HZ sample rate unless otherwise specified */
99#define POWER_THREAD_STEP_TICKS (HZ/2) 104#define POWER_THREAD_STEP_TICKS (HZ/2)
@@ -118,6 +123,8 @@ int battery_current(void); /* battery current in milliamps
118int _battery_level(void); /* percent */ 123int _battery_level(void); /* percent */
119int _battery_time(void); /* minutes */ 124int _battery_time(void); /* minutes */
120int _battery_voltage(void); /* voltage in millivolts */ 125int _battery_voltage(void); /* voltage in millivolts */
126int _battery_current(void); /* (dis)charge current in milliamps */
127
121#if CONFIG_CHARGING >= CHARGING_TARGET 128#if CONFIG_CHARGING >= CHARGING_TARGET
122void powermgmt_init_target(void); 129void powermgmt_init_target(void);
123void charging_algorithm_close(void); 130void charging_algorithm_close(void);