diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-23 23:00:29 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-11-23 23:00:29 -0500 |
commit | 97a82ee3eca1be69bd2d08e8fd9db09c0807ae5d (patch) | |
tree | b032a1397fd33240d8fdc7d6e17059723d0ffe55 /apps/plugins/lib | |
parent | 3745c813f924b12232c4f37610aecd23fe5654b8 (diff) | |
download | rockbox-97a82ee3eca1be69bd2d08e8fd9db09c0807ae5d.tar.gz rockbox-97a82ee3eca1be69bd2d08e8fd9db09c0807ae5d.zip |
plugins HAVE_BACKLIGHT helper remove ifdefs in favor of dummy functions
lessen the ifdef hell
Change-Id: I52f830284e4599f3fc3a75c27dda27058b8de1a3
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/helper.c | 48 | ||||
-rw-r--r-- | apps/plugins/lib/helper.h | 10 |
2 files changed, 42 insertions, 16 deletions
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c index 018c1616c8..92d9ec905e 100644 --- a/apps/plugins/lib/helper.c +++ b/apps/plugins/lib/helper.c | |||
@@ -58,7 +58,12 @@ void backlight_use_settings(void) | |||
58 | backlight_timeout_plugged); | 58 | backlight_timeout_plugged); |
59 | #endif /* CONFIG_CHARGING */ | 59 | #endif /* CONFIG_CHARGING */ |
60 | } | 60 | } |
61 | #endif /* HAVE_BACKLIGHT */ | 61 | #else /* HAVE_BACKLIGHT */ |
62 | /* DUMMY FUNCTIONS */ | ||
63 | void backlight_force_on(void){} | ||
64 | void backlight_ignore_timeout(void){} | ||
65 | void backlight_use_settings(void){} | ||
66 | #endif /* !HAVE_BACKLIGHT */ | ||
62 | 67 | ||
63 | #ifdef HAVE_SW_POWEROFF | 68 | #ifdef HAVE_SW_POWEROFF |
64 | static bool original_sw_poweroff_state = true; | 69 | static bool original_sw_poweroff_state = true; |
@@ -73,7 +78,11 @@ void sw_poweroff_restore(void) | |||
73 | { | 78 | { |
74 | rb->button_set_sw_poweroff_state(original_sw_poweroff_state); | 79 | rb->button_set_sw_poweroff_state(original_sw_poweroff_state); |
75 | } | 80 | } |
76 | #endif | 81 | #else /* HAVE_SW_POWEROFF */ |
82 | /* DUMMY FUNCTIONS */ | ||
83 | void sw_poweroff_disable(void){} | ||
84 | void sw_poweroff_restore(void){} | ||
85 | #endif /* !HAVE_SW_POWEROFF */ | ||
77 | 86 | ||
78 | #ifdef HAVE_REMOTE_LCD | 87 | #ifdef HAVE_REMOTE_LCD |
79 | /* Force the backlight on */ | 88 | /* Force the backlight on */ |
@@ -106,7 +115,12 @@ void remote_backlight_use_settings(void) | |||
106 | remote_backlight_timeout_plugged); | 115 | remote_backlight_timeout_plugged); |
107 | #endif /* CONFIG_CHARGING */ | 116 | #endif /* CONFIG_CHARGING */ |
108 | } | 117 | } |
109 | #endif /* HAVE_REMOTE_LCD */ | 118 | #else /* HAVE_REMOTE_LCD */ |
119 | /* DUMMY FUNCTIONS */ | ||
120 | void remote_backlight_force_on(void){} | ||
121 | void remote_backlight_ignore_timeout(void){} | ||
122 | void remote_backlight_use_settings(void){} | ||
123 | #endif /* !HAVE_REMOTE_LCD */ | ||
110 | 124 | ||
111 | #ifdef HAVE_BUTTON_LIGHT | 125 | #ifdef HAVE_BUTTON_LIGHT |
112 | /* Force the buttonlight on */ | 126 | /* Force the buttonlight on */ |
@@ -133,7 +147,13 @@ void buttonlight_use_settings(void) | |||
133 | { | 147 | { |
134 | rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout); | 148 | rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout); |
135 | } | 149 | } |
136 | #endif /* HAVE_BUTTON_LIGHT */ | 150 | #else /* HAVE_BUTTON_LIGHT */ |
151 | /* DUMMY FUNCTIONS */ | ||
152 | void buttonlight_force_on(void){} | ||
153 | void buttonlight_force_off(void){} | ||
154 | void buttonlight_ignore_timeout(void){} | ||
155 | void buttonlight_use_settings(void){} | ||
156 | #endif /* !HAVE_BUTTON_LIGHT */ | ||
137 | 157 | ||
138 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 158 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
139 | void backlight_brightness_set(int brightness) | 159 | void backlight_brightness_set(int brightness) |
@@ -145,7 +165,15 @@ void backlight_brightness_use_setting(void) | |||
145 | { | 165 | { |
146 | rb->backlight_set_brightness(rb->global_settings->brightness); | 166 | rb->backlight_set_brightness(rb->global_settings->brightness); |
147 | } | 167 | } |
148 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | 168 | #else /* HAVE_BACKLIGHT_BRIGHTNESS */ |
169 | /* DUMMY FUNCTIONS */ | ||
170 | void backlight_brightness_set(int brightness) | ||
171 | { | ||
172 | (void)brightness; | ||
173 | } | ||
174 | void backlight_brightness_use_setting(void){} | ||
175 | |||
176 | #endif /* !HAVE_BACKLIGHT_BRIGHTNESS */ | ||
149 | 177 | ||
150 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | 178 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
151 | void buttonlight_brightness_set(int brightness) | 179 | void buttonlight_brightness_set(int brightness) |
@@ -157,4 +185,12 @@ void buttonlight_brightness_use_setting(void) | |||
157 | { | 185 | { |
158 | rb->buttonlight_set_brightness(rb->global_settings->buttonlight_brightness); | 186 | rb->buttonlight_set_brightness(rb->global_settings->buttonlight_brightness); |
159 | } | 187 | } |
160 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ | 188 | #else /* HAVE_BUTTONLIGHT_BRIGHTNESS */ |
189 | /* DUMMY FUNCTIONS */ | ||
190 | void buttonlight_brightness_set(int brightness) | ||
191 | { | ||
192 | (void)brightness; | ||
193 | } | ||
194 | |||
195 | void buttonlight_brightness_use_setting(void){} | ||
196 | #endif /* !HAVE_BUTTONLIGHT_BRIGHTNESS */ | ||
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h index 00ad8ac087..e59325d5d9 100644 --- a/apps/plugins/lib/helper.h +++ b/apps/plugins/lib/helper.h | |||
@@ -32,39 +32,29 @@ void backlight_force_on(void); | |||
32 | void backlight_ignore_timeout(void); | 32 | void backlight_ignore_timeout(void); |
33 | void backlight_use_settings(void); | 33 | void backlight_use_settings(void); |
34 | 34 | ||
35 | #ifdef HAVE_SW_POWEROFF | ||
36 | /** | 35 | /** |
37 | * Disable and restore software poweroff (i.e. holding PLAY on iPods). | 36 | * Disable and restore software poweroff (i.e. holding PLAY on iPods). |
38 | * Only call _restore() if _disable() was called earlier! | 37 | * Only call _restore() if _disable() was called earlier! |
39 | */ | 38 | */ |
40 | void sw_poweroff_disable(void); | 39 | void sw_poweroff_disable(void); |
41 | void sw_poweroff_restore(void); | 40 | void sw_poweroff_restore(void); |
42 | #endif | ||
43 | 41 | ||
44 | #ifdef HAVE_REMOTE_LCD | ||
45 | void remote_backlight_force_on(void); | 42 | void remote_backlight_force_on(void); |
46 | void remote_backlight_ignore_timeout(void); | 43 | void remote_backlight_ignore_timeout(void); |
47 | void remote_backlight_use_settings(void); | 44 | void remote_backlight_use_settings(void); |
48 | #endif | ||
49 | 45 | ||
50 | #ifdef HAVE_BUTTON_LIGHT | ||
51 | void buttonlight_force_on(void); | 46 | void buttonlight_force_on(void); |
52 | void buttonlight_force_off(void); | 47 | void buttonlight_force_off(void); |
53 | void buttonlight_ignore_timeout(void); | 48 | void buttonlight_ignore_timeout(void); |
54 | void buttonlight_use_settings(void); | 49 | void buttonlight_use_settings(void); |
55 | #endif | ||
56 | 50 | ||
57 | /** | 51 | /** |
58 | * Backlight brightness adjustment settings | 52 | * Backlight brightness adjustment settings |
59 | */ | 53 | */ |
60 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
61 | void backlight_brightness_set(int brightness); | 54 | void backlight_brightness_set(int brightness); |
62 | void backlight_brightness_use_setting(void); | 55 | void backlight_brightness_use_setting(void); |
63 | #endif | ||
64 | 56 | ||
65 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | ||
66 | void buttonlight_brightness_set(int brightness); | 57 | void buttonlight_brightness_set(int brightness); |
67 | void buttonlight_brightness_use_setting(void); | 58 | void buttonlight_brightness_use_setting(void); |
68 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ | ||
69 | 59 | ||
70 | #endif /* _LIB_HELPER_H_ */ | 60 | #endif /* _LIB_HELPER_H_ */ |