diff options
Diffstat (limited to 'firmware/target/hosted/ypr0/powermgmt-ypr0.c')
-rw-r--r-- | firmware/target/hosted/ypr0/powermgmt-ypr0.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/firmware/target/hosted/ypr0/powermgmt-ypr0.c b/firmware/target/hosted/ypr0/powermgmt-ypr0.c index 45ff2ae737..347e5fa146 100644 --- a/firmware/target/hosted/ypr0/powermgmt-ypr0.c +++ b/firmware/target/hosted/ypr0/powermgmt-ypr0.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "file.h" | 24 | #include "file.h" |
25 | #include "adc.h" | 25 | #include "adc.h" |
26 | #include "sc900776.h" | 26 | #include "sc900776.h" |
27 | #include "radio-ypr0.h" | ||
27 | 28 | ||
28 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
29 | { | 30 | { |
@@ -37,7 +38,6 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | |||
37 | }; | 38 | }; |
38 | 39 | ||
39 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | 40 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ |
40 | /* FIXME: This is guessed. Make proper curve using battery_bench */ | ||
41 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | 41 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = |
42 | { | 42 | { |
43 | { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 } | 43 | { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 } |
@@ -45,7 +45,6 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | |||
45 | 45 | ||
46 | #if CONFIG_CHARGING | 46 | #if CONFIG_CHARGING |
47 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | 47 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ |
48 | /* FIXME: This is guessed. Make proper curve using battery_bench */ | ||
49 | const unsigned short const percent_to_volt_charge[11] = | 48 | const unsigned short const percent_to_volt_charge[11] = |
50 | { | 49 | { |
51 | 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 | 50 | 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 |
@@ -81,3 +80,29 @@ bool charging_state(void) | |||
81 | /* dont indicate for > ~95% */ | 80 | /* dont indicate for > ~95% */ |
82 | return ret && (_battery_voltage() <= charged_thres); | 81 | return ret && (_battery_voltage() <= charged_thres); |
83 | } | 82 | } |
83 | |||
84 | #if CONFIG_TUNER | ||
85 | static bool tuner_on = false; | ||
86 | |||
87 | bool tuner_power(bool status) | ||
88 | { | ||
89 | if (status != tuner_on) | ||
90 | { | ||
91 | tuner_on = status; | ||
92 | status = !status; | ||
93 | if (tuner_on) { | ||
94 | radiodev_open(); | ||
95 | } | ||
96 | else { | ||
97 | radiodev_close(); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | return status; | ||
102 | } | ||
103 | |||
104 | bool tuner_powered(void) | ||
105 | { | ||
106 | return tuner_on; | ||
107 | } | ||
108 | #endif /* #if CONFIG_TUNER */ \ No newline at end of file | ||