summaryrefslogtreecommitdiff
path: root/firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c')
-rw-r--r--firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c b/firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c
index 6ab761672a..e26321f975 100644
--- a/firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c
+++ b/firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c
@@ -24,37 +24,36 @@
24#include "adc-target.h" 24#include "adc-target.h"
25#include "powermgmt.h" 25#include "powermgmt.h"
26 26
27/* Battery voltage calculation and discharge/charge curves for the Meizu M3. 27/* Battery voltage calculation and discharge/charge curves for the HiFiMAN HM-60x.
28 28
29 Battery voltage is calculated under the assumption that the adc full-scale 29 Battery voltage is calculated under the assumption that the adc full-scale
30 readout represents 3.00V and that the battery ADC channel is fed with 30 readout represents 3.00V and that the battery ADC channel is fed with
31 exactly half of the battery voltage (through a resistive divider). 31 exactly half of the battery voltage (through a resistive divider).
32 Discharge and charge curves have not been calibrated yet. 32 Charge curve have not been calibrated yet.
33*/ 33*/
34 34
35const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 35const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
36{ 36{
37 /* TODO: this is just an initial guess */ 37 /* TODO: this is just an initial guess */
38 3400 38 3350
39}; 39};
40 40
41const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 41const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
42{ 42{
43 /* TODO: this is just an initial guess */
44 3300 43 3300
45}; 44};
46 45
47/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 46/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
48const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 47const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
49{ 48{
50 /* TODO: simple uncalibrated curve, linear except for first 10% */ 49 /* Calibrated curve */
51 { 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 } 50 { 3300, 3468, 3521, 3562, 3609, 3644, 3691, 3767, 3837, 3919, 4100 }
52}; 51};
53 52
54/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 53/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
55const unsigned short percent_to_volt_charge[11] = 54const unsigned short percent_to_volt_charge[11] =
56 /* TODO: simple uncalibrated curve, linear except for first 10% */ 55 /* TODO: simple copy of discharge curve */
57 { 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 }; 56 { 3300, 3468, 3521, 3562, 3609, 3644, 3691, 3767, 3837, 3919, 4100 }
58 57
59/* full-scale ADC readout (2^10) in millivolt */ 58/* full-scale ADC readout (2^10) in millivolt */
60#define BATTERY_SCALE_FACTOR 6000 59#define BATTERY_SCALE_FACTOR 6000