diff options
Diffstat (limited to 'firmware/export/power.h')
-rw-r--r-- | firmware/export/power.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/firmware/export/power.h b/firmware/export/power.h index f74e6fe0c2..747887921d 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h | |||
@@ -27,8 +27,57 @@ void charger_enable(bool on); | |||
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #if CONFIG_CHARGING | 29 | #if CONFIG_CHARGING |
30 | bool charger_inserted(void); | 30 | enum power_input_flags { |
31 | /* No external power source? Default. */ | ||
32 | POWER_INPUT_NONE = 0x00, | ||
33 | |||
34 | /* Main power source is available (AC?), the default other than | ||
35 | * battery if for instance USB and others cannot be distinguished or | ||
36 | * USB is the only possibility. */ | ||
37 | POWER_INPUT_MAIN = 0x01, | ||
38 | |||
39 | /* USB power source is available (and is discernable from MAIN). */ | ||
40 | POWER_INPUT_USB = 0x02, | ||
41 | |||
42 | /* Something is plugged. */ | ||
43 | POWER_INPUT = 0x0f, | ||
44 | |||
45 | /* POWER_INPUT_*_CHARGER of course implies presence of the respective | ||
46 | * power source. */ | ||
47 | |||
48 | /* Battery not included in CHARGER (it can't charge itself) */ | ||
49 | |||
50 | /* Charging is possible on main. */ | ||
51 | POWER_INPUT_MAIN_CHARGER = 0x10 | POWER_INPUT_MAIN, | ||
52 | |||
53 | /* Charging is possible on USB. */ | ||
54 | POWER_INPUT_USB_CHARGER = 0x20 | POWER_INPUT_USB, | ||
55 | |||
56 | /* Charging is possible from something. */ | ||
57 | POWER_INPUT_CHARGER = 0xf0, | ||
58 | |||
59 | #ifdef HAVE_BATTERY_SWITCH | ||
60 | /* Battery is powering device or is available to power device. It | ||
61 | * could also be used if the battery is hot-swappable to indicate if | ||
62 | * it is present ("switch" as verb vs. noun). */ | ||
63 | POWER_INPUT_BATTERY = 0x100, | ||
31 | #endif | 64 | #endif |
65 | }; | ||
66 | |||
67 | /* Returns detailed power input status information from device. */ | ||
68 | unsigned int power_input_status(void); | ||
69 | |||
70 | /* Shortcuts */ | ||
71 | /* Returns true if any power source that is connected is capable of | ||
72 | * charging the batteries. | ||
73 | * > (power_input_status() & POWER_INPUT_CHARGER) != 0 */ | ||
74 | bool charger_inserted(void); | ||
75 | |||
76 | /* Returns true if any power input is connected - charging-capable | ||
77 | * or not. | ||
78 | * > (power_input_status() & POWER_INPUT) != 0 */ | ||
79 | bool power_input_present(void); | ||
80 | #endif /* CONFIG_CHARGING */ | ||
32 | 81 | ||
33 | void power_off(void); | 82 | void power_off(void); |
34 | void ide_power_enable(bool on); | 83 | void ide_power_enable(bool on); |