diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/config-gigabeat-s.h | 5 | ||||
-rw-r--r-- | firmware/export/config-gigabeat.h | 4 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 4 | ||||
-rw-r--r-- | firmware/export/power.h | 51 |
4 files changed, 63 insertions, 1 deletions
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h index 8ddca5ca6d..f0e9e92a04 100644 --- a/firmware/export/config-gigabeat-s.h +++ b/firmware/export/config-gigabeat-s.h | |||
@@ -134,6 +134,11 @@ | |||
134 | 134 | ||
135 | /* define this if the unit can be powered or charged via USB */ | 135 | /* define this if the unit can be powered or charged via USB */ |
136 | //#define HAVE_USB_POWER /* Disable for now */ | 136 | //#define HAVE_USB_POWER /* Disable for now */ |
137 | //#define HAVE_USB_CHARGING_ENABLE | ||
138 | |||
139 | /* define this if the unit has a battery switch or battery can be removed | ||
140 | * when running */ | ||
141 | #define HAVE_BATTERY_SWITCH | ||
137 | 142 | ||
138 | /* USB On-the-go */ | 143 | /* USB On-the-go */ |
139 | #define CONFIG_USBOTG USBOTG_ARC | 144 | #define CONFIG_USBOTG USBOTG_ARC |
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 0c5462400b..313bdadcdd 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h | |||
@@ -114,6 +114,10 @@ | |||
114 | /* define this if the unit can be powered or charged via USB */ | 114 | /* define this if the unit can be powered or charged via USB */ |
115 | #define HAVE_USB_POWER | 115 | #define HAVE_USB_POWER |
116 | 116 | ||
117 | /* define this if the unit has a battery switch or battery can be removed | ||
118 | * when running */ | ||
119 | #define HAVE_BATTERY_SWITCH | ||
120 | |||
117 | #ifndef SIMULATOR | 121 | #ifndef SIMULATOR |
118 | 122 | ||
119 | /* The LCD on a Gigabeat is 240x320 - it is portrait */ | 123 | /* The LCD on a Gigabeat is 240x320 - it is portrait */ |
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 680ca91245..fa0046ac03 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -112,6 +112,10 @@ | |||
112 | /* define this if the unit can be powered or charged via USB */ | 112 | /* define this if the unit can be powered or charged via USB */ |
113 | #define HAVE_USB_POWER | 113 | #define HAVE_USB_POWER |
114 | 114 | ||
115 | /* define this if the unit can have USB charging disabled by user - | ||
116 | * if USB/MAIN power is discernable and hardware doesn't compel charging */ | ||
117 | #define HAVE_USB_CHARGING_ENABLE | ||
118 | |||
115 | #ifndef SIMULATOR | 119 | #ifndef SIMULATOR |
116 | 120 | ||
117 | /* define this if the backlight thread is used for fade, not for sim, needs | 121 | /* define this if the backlight thread is used for fade, not for sim, needs |
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); |