Make bufadvance rely on bufseek instead of duplicating code
[Rockbox.git] / firmware / backlight.c
blob357b446a23c0b00c56a01e921e28c03eb4a364d2
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "config.h"
20 #include <stdlib.h>
21 #include "cpu.h"
22 #include "kernel.h"
23 #include "thread.h"
24 #include "i2c.h"
25 #include "debug.h"
26 #include "rtc.h"
27 #include "usb.h"
28 #include "power.h"
29 #include "system.h"
30 #include "button.h"
31 #include "timer.h"
32 #include "backlight.h"
34 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
35 #include "lcd.h" /* for lcd_enable() and lcd_sleep() */
36 #endif
37 #ifdef HAVE_REMOTE_LCD
38 #include "lcd-remote.h"
39 #endif
40 #ifndef SIMULATOR
41 #include "backlight-target.h"
42 #endif
44 #ifdef SIMULATOR
45 /* TODO: find a better way to do it but we need a kernel thread somewhere to
46 handle this */
47 extern void screen_dump(void);
49 static inline void __backlight_on(void)
51 sim_backlight(100);
54 static inline void __backlight_off(void)
56 sim_backlight(0);
59 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
60 static inline void __backlight_set_brightness(int val)
62 (void)val;
64 #endif
66 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
67 static inline void __buttonlight_set_brightness(int val)
69 (void)val;
71 #endif
73 #endif /* SIMULATOR */
75 #if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
77 const signed char backlight_timeout_value[19] =
79 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
82 #define BACKLIGHT_ON 1
83 #define BACKLIGHT_OFF 2
84 #define REMOTE_BACKLIGHT_ON 3
85 #define REMOTE_BACKLIGHT_OFF 4
86 #define BACKLIGHT_UNBOOST_CPU 5
87 #ifdef HAVE_LCD_SLEEP
88 #define LCD_SLEEP 6
89 #endif
90 #ifdef HAVE_BUTTON_LIGHT
91 #define BUTTON_LIGHT_ON 7
92 #define BUTTON_LIGHT_OFF 8
93 #endif
95 static void backlight_thread(void);
96 static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
97 static const char backlight_thread_name[] = "backlight";
98 static struct event_queue backlight_queue;
100 static int backlight_timer;
101 static int backlight_timeout;
102 static int backlight_timeout_normal = 5*HZ;
103 #if CONFIG_CHARGING
104 static int backlight_timeout_plugged = 5*HZ;
105 #endif
106 #ifdef HAS_BUTTON_HOLD
107 static int backlight_on_button_hold = 0;
108 #endif
110 #ifdef HAVE_BUTTON_LIGHT
111 static int buttonlight_timer;
112 static int buttonlight_timeout = 5*HZ;
114 /* internal interface */
115 static void _buttonlight_on(void)
117 #ifndef SIMULATOR
118 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
119 __buttonlight_dim(false);
120 #else
121 __buttonlight_on();
122 #endif
123 #endif
126 void _buttonlight_off(void)
128 #ifndef SIMULATOR
129 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
130 if(buttonlight_timeout>0)
131 __buttonlight_dim(true);
132 else
133 #endif
134 __buttonlight_off();
135 #endif
138 /* Update state of buttonlight according to timeout setting */
139 static void buttonlight_update_state(void)
141 buttonlight_timer = buttonlight_timeout;
143 /* Buttonlight == OFF in the setting? */
144 if (buttonlight_timer < 0)
146 buttonlight_timer = 0; /* Disable the timeout */
147 _buttonlight_off();
149 else
150 _buttonlight_on();
153 /* external interface */
154 void buttonlight_on(void)
156 queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON);
157 queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0);
160 void buttonlight_off(void)
162 queue_post(&backlight_queue, BUTTON_LIGHT_OFF, 0);
165 void buttonlight_set_timeout(int index)
167 if((unsigned)index >= sizeof(backlight_timeout_value))
168 /* if given a weird value, use default */
169 index = 6;
170 buttonlight_timeout = HZ * backlight_timeout_value[index];
171 buttonlight_update_state();
174 #endif
176 #ifdef HAVE_REMOTE_LCD
177 static int remote_backlight_timer;
178 static int remote_backlight_timeout;
179 static int remote_backlight_timeout_normal = 5*HZ;
180 #if CONFIG_CHARGING
181 static int remote_backlight_timeout_plugged = 5*HZ;
182 #endif
183 #ifdef HAS_REMOTE_BUTTON_HOLD
184 static int remote_backlight_on_button_hold = 0;
185 #endif
186 #endif
188 #ifdef HAVE_LCD_SLEEP
189 const signed char lcd_sleep_timeout_value[10] =
191 -1, 0, 5, 10, 15, 20, 30, 45, 60, 90
193 static int lcd_sleep_timer;
194 static int lcd_sleep_timeout = 10*HZ;
195 #endif
197 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
198 /* backlight fading */
199 #define BL_PWM_INTERVAL 5000 /* Cycle interval in s */
200 #define BL_PWM_COUNT 100
201 static const char backlight_fade_value[8] = { 0, 1, 2, 4, 6, 8, 10, 20 };
202 static int fade_in_count = 1;
203 static int fade_out_count = 4;
205 static bool bl_timer_active = false;
206 static int bl_dim_current = 0;
207 static int bl_dim_target = 0;
208 static int bl_pwm_counter = 0;
209 static volatile int bl_cycle_counter = 0;
210 static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
212 static void backlight_isr(void)
214 int timer_period;
215 bool idle = false;
217 timer_period = TIMER_FREQ / 1000 * BL_PWM_INTERVAL / 1000;
218 switch (bl_dim_state)
220 /* New cycle */
221 case DIM_STATE_START:
222 bl_pwm_counter = 0;
223 bl_cycle_counter++;
225 if (bl_dim_current > 0 && bl_dim_current < BL_PWM_COUNT)
227 __backlight_on();
228 bl_pwm_counter = bl_dim_current;
229 timer_period = timer_period * bl_pwm_counter / BL_PWM_COUNT;
230 bl_dim_state = DIM_STATE_MAIN;
232 else
234 if (bl_dim_current)
235 __backlight_on();
236 else
237 __backlight_off();
238 if (bl_dim_current == bl_dim_target)
239 idle = true;
242 break ;
244 /* Dim main screen */
245 case DIM_STATE_MAIN:
246 __backlight_off();
247 bl_dim_state = DIM_STATE_START;
248 timer_period = timer_period * (BL_PWM_COUNT - bl_pwm_counter) / BL_PWM_COUNT;
249 break ;
252 if ((bl_dim_target > bl_dim_current) && (bl_cycle_counter >= fade_in_count))
254 bl_dim_current++;
255 bl_cycle_counter = 0;
258 if ((bl_dim_target < bl_dim_current) && (bl_cycle_counter >= fade_out_count))
260 bl_dim_current--;
261 bl_cycle_counter = 0;
264 if (idle)
266 #ifdef CPU_COLDFIRE
267 queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, 0);
268 #endif
269 timer_unregister();
270 bl_timer_active = false;
272 else
273 timer_set_period(timer_period);
276 static void backlight_switch(void)
278 if (bl_dim_target > (BL_PWM_COUNT/2))
280 __backlight_on();
281 bl_dim_current = BL_PWM_COUNT;
283 else
285 __backlight_off();
286 bl_dim_current = 0;
290 static void backlight_release_timer(void)
292 #ifdef CPU_COLDFIRE
293 cpu_boost(false);
294 #endif
295 timer_unregister();
296 bl_timer_active = false;
297 backlight_switch();
300 static void backlight_dim(int value)
302 /* protect from extraneous calls with the same target value */
303 if (value == bl_dim_target)
304 return;
306 bl_dim_target = value;
308 if (bl_timer_active)
309 return ;
311 if (timer_register(0, backlight_release_timer, 2, 0, backlight_isr))
313 #ifdef CPU_COLDFIRE
314 /* Prevent cpu frequency changes while dimming. */
315 cpu_boost(true);
316 #endif
317 bl_timer_active = true;
319 else
320 backlight_switch();
323 void backlight_set_fade_in(int index)
325 fade_in_count = backlight_fade_value[index];
328 void backlight_set_fade_out(int index)
330 fade_out_count = backlight_fade_value[index];
332 #endif /* defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) */
334 static void _backlight_on(void)
336 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
337 if (fade_in_count > 0)
338 backlight_dim(BL_PWM_COUNT);
339 else
341 bl_dim_target = bl_dim_current = BL_PWM_COUNT;
342 __backlight_on();
344 #elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
345 /* call the enable from here - it takes longer than the disable */
346 lcd_enable(true);
347 __backlight_dim(false);
348 #else
349 __backlight_on();
350 #endif
351 #ifdef HAVE_LCD_SLEEP
352 lcd_sleep_timer = 0; /* LCD should be awake already */
353 #endif
356 static void _backlight_off(void)
358 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
359 if (fade_out_count > 0)
360 backlight_dim(0);
361 else
363 bl_dim_target = bl_dim_current = 0;
364 __backlight_off();
366 #elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
367 __backlight_dim(true);
368 #else
369 __backlight_off();
370 #endif
372 #ifdef HAVE_LCD_SLEEP
373 /* Start LCD sleep countdown */
374 if (lcd_sleep_timeout < 0)
376 lcd_sleep_timer = 0; /* Setting == Always */
377 lcd_sleep();
379 else
380 lcd_sleep_timer = lcd_sleep_timeout;
381 #endif
384 #ifdef HAVE_REMOTE_LCD
385 #ifdef SIMULATOR
386 static void __remote_backlight_on(void)
388 sim_remote_backlight(100);
391 static void __remote_backlight_off(void)
393 sim_remote_backlight(0);
395 #endif /* SIMULATOR */
396 #endif /* HAVE_REMOTE_LCD */
398 /* Update state of backlight according to timeout setting */
399 static void backlight_update_state(void)
401 #ifdef HAS_BUTTON_HOLD
402 if (button_hold() && (backlight_on_button_hold != 0))
403 backlight_timeout = (backlight_on_button_hold == 2) ? 0 : -1;
404 /* always on or always off */
405 else
406 #endif
407 #if CONFIG_CHARGING
408 if (charger_inserted()
409 #ifdef HAVE_USB_POWER
410 || usb_powered()
411 #endif
413 backlight_timeout = backlight_timeout_plugged;
414 else
415 #endif
416 backlight_timeout = backlight_timeout_normal;
418 /* Backlight == OFF in the setting? */
419 if (backlight_timeout < 0)
421 backlight_timer = 0; /* Disable the timeout */
422 _backlight_off();
424 else
426 backlight_timer = backlight_timeout;
427 _backlight_on();
431 #ifdef HAVE_REMOTE_LCD
432 /* Update state of remote backlight according to timeout setting */
433 static void remote_backlight_update_state(void)
435 #ifdef HAS_REMOTE_BUTTON_HOLD
436 if (remote_button_hold() && (remote_backlight_on_button_hold != 0))
437 remote_backlight_timeout = (remote_backlight_on_button_hold == 2)
438 ? 0 : -1; /* always on or always off */
439 else
440 #endif
441 #if CONFIG_CHARGING
442 if (charger_inserted()
443 #ifdef HAVE_USB_POWER
444 || usb_powered()
445 #endif
447 remote_backlight_timeout = remote_backlight_timeout_plugged;
448 else
449 #endif
450 remote_backlight_timeout = remote_backlight_timeout_normal;
452 /* Backlight == OFF in the setting? */
453 if (remote_backlight_timeout < 0)
455 remote_backlight_timer = 0; /* Disable the timeout */
456 __remote_backlight_off();
458 else
460 remote_backlight_timer = remote_backlight_timeout;
461 __remote_backlight_on();
464 #endif /* HAVE_REMOTE_LCD */
466 void backlight_thread(void)
468 struct queue_event ev;
469 bool locked = false;
471 while(1)
473 queue_wait(&backlight_queue, &ev);
474 switch(ev.id)
475 { /* These events must always be processed */
476 #if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \
477 && !defined(SIMULATOR)
478 case BACKLIGHT_UNBOOST_CPU:
479 cpu_boost(false);
480 break;
481 #endif
483 #if defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR)
484 /* Here for now or else the aggressive init messes up scrolling */
485 case SYS_REMOTE_PLUGGED:
486 lcd_remote_on();
487 lcd_remote_update();
488 break;
490 case SYS_REMOTE_UNPLUGGED:
491 lcd_remote_off();
492 break;
493 #endif /* defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) */
494 #ifdef SIMULATOR
495 /* This one here too for lack of a better place */
496 case SYS_SCREENDUMP:
497 screen_dump();
498 break;
499 #endif
500 case SYS_USB_CONNECTED:
501 /* Tell the USB thread that we are safe */
502 DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
503 usb_acknowledge(SYS_USB_CONNECTED_ACK);
504 break;
506 case SYS_USB_DISCONNECTED:
507 usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
508 break;
510 if (locked)
511 continue;
513 switch(ev.id)
514 { /* These events are only processed if backlight isn't locked */
515 #ifdef HAVE_REMOTE_LCD
516 case REMOTE_BACKLIGHT_ON:
517 remote_backlight_update_state();
518 break;
520 case REMOTE_BACKLIGHT_OFF:
521 remote_backlight_timer = 0; /* Disable the timeout */
522 __remote_backlight_off();
523 break;
524 #endif /* HAVE_REMOTE_LCD */
526 case BACKLIGHT_ON:
527 backlight_update_state();
528 break;
530 case BACKLIGHT_OFF:
531 backlight_timer = 0; /* Disable the timeout */
532 _backlight_off();
533 break;
535 #ifdef HAVE_LCD_SLEEP
536 case LCD_SLEEP:
537 lcd_sleep();
538 break;
539 #endif
540 #ifdef HAVE_BUTTON_LIGHT
541 case BUTTON_LIGHT_ON:
542 buttonlight_update_state();
543 break;
545 case BUTTON_LIGHT_OFF:
546 buttonlight_timer = 0;
547 _buttonlight_off();
548 break;
549 #endif
551 case SYS_POWEROFF: /* Lock backlight on poweroff so it doesn't */
552 locked = true; /* go off before power is actually cut. */
553 /* fall through */
554 #if CONFIG_CHARGING
555 case SYS_CHARGER_CONNECTED:
556 case SYS_CHARGER_DISCONNECTED:
557 #endif
558 backlight_update_state();
559 #ifdef HAVE_REMOTE_LCD
560 remote_backlight_update_state();
561 #endif
562 break;
564 } /* end while */
567 static void backlight_tick(void)
569 if(backlight_timer)
571 backlight_timer--;
572 if(backlight_timer == 0)
574 backlight_off();
577 #ifdef HAVE_LCD_SLEEP
578 else if(lcd_sleep_timer)
580 lcd_sleep_timer--;
581 if(lcd_sleep_timer == 0)
583 /* Queue on bl thread or freeze! */
584 queue_post(&backlight_queue, LCD_SLEEP, 0);
587 #endif /* HAVE_LCD_SLEEP */
589 #ifdef HAVE_REMOTE_LCD
590 if(remote_backlight_timer)
592 remote_backlight_timer--;
593 if(remote_backlight_timer == 0)
595 remote_backlight_off();
598 #endif /* HAVE_REMOVE_LCD */
599 #ifdef HAVE_BUTTON_LIGHT
600 if (buttonlight_timer)
602 buttonlight_timer--;
603 if (buttonlight_timer == 0)
605 buttonlight_off();
608 #endif /* HAVE_BUTTON_LIGHT */
611 void backlight_init(void)
613 queue_init(&backlight_queue, true);
615 #ifndef SIMULATOR
616 if (__backlight_init())
618 # ifdef HAVE_BACKLIGHT_PWM_FADING
619 /* If backlight is already on, don't fade in. */
620 bl_dim_current = BL_PWM_COUNT;
621 bl_dim_target = BL_PWM_COUNT;
622 # endif
624 #endif
625 /* Leave all lights as set by the bootloader here. The settings load will
626 * call the appropriate backlight_set_*() functions, only changing light
627 * status if necessary. */
629 create_thread(backlight_thread, backlight_stack,
630 sizeof(backlight_stack), 0, backlight_thread_name
631 IF_PRIO(, PRIORITY_SYSTEM)
632 IF_COP(, CPU));
633 tick_add_task(backlight_tick);
636 void backlight_on(void)
638 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
639 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
642 void backlight_off(void)
644 queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
647 /* returns true when the backlight is on OR when it's set to always off */
648 bool is_backlight_on(void)
650 if (backlight_timer || backlight_timeout <= 0)
651 return true;
652 else
653 return false;
656 /* return value in ticks; 0 means always on, <0 means always off */
657 int backlight_get_current_timeout(void)
659 return backlight_timeout;
662 void backlight_set_timeout(int index)
664 if((unsigned)index >= sizeof(backlight_timeout_value))
665 /* if given a weird value, use default */
666 index = 6;
667 backlight_timeout_normal = HZ * backlight_timeout_value[index];
668 backlight_update_state();
671 #if CONFIG_CHARGING
672 void backlight_set_timeout_plugged(int index)
674 if((unsigned)index >= sizeof(backlight_timeout_value))
675 /* if given a weird value, use default */
676 index = 6;
677 backlight_timeout_plugged = HZ * backlight_timeout_value[index];
678 backlight_update_state();
680 #endif /* CONFIG_CHARGING */
682 #ifdef HAS_BUTTON_HOLD
683 /* Hold button change event handler. */
684 void backlight_hold_changed(bool hold_button)
686 if (!hold_button || (backlight_on_button_hold > 0))
687 /* if unlocked or override in effect */
688 backlight_on();
691 void backlight_set_on_button_hold(int index)
693 if ((unsigned)index >= 3)
694 /* if given a weird value, use default */
695 index = 0;
697 backlight_on_button_hold = index;
698 backlight_update_state();
700 #endif /* HAS_BUTTON_HOLD */
702 #ifdef HAVE_LCD_SLEEP
703 void lcd_set_sleep_after_backlight_off(int index)
705 if ((unsigned)index >= sizeof(lcd_sleep_timeout_value))
706 /* if given a weird value, use default */
707 index = 3;
709 lcd_sleep_timeout = HZ * lcd_sleep_timeout_value[index];
711 if (backlight_timer > 0 || backlight_get_current_timeout() == 0)
712 /* Timer will be set when bl turns off or bl set to on. */
713 return;
715 /* Backlight is Off */
716 if (lcd_sleep_timeout < 0)
717 lcd_sleep_timer = 1; /* Always - sleep next tick */
718 else
719 lcd_sleep_timer = lcd_sleep_timeout; /* Never, other */
721 #endif /* HAVE_LCD_SLEEP */
723 #ifdef HAVE_REMOTE_LCD
724 void remote_backlight_on(void)
726 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0);
729 void remote_backlight_off(void)
731 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0);
734 void remote_backlight_set_timeout(int index)
736 if((unsigned)index >= sizeof(backlight_timeout_value))
737 /* if given a weird value, use default */
738 index=6;
739 remote_backlight_timeout_normal = HZ * backlight_timeout_value[index];
740 remote_backlight_update_state();
743 #if CONFIG_CHARGING
744 void remote_backlight_set_timeout_plugged(int index)
746 if((unsigned)index >= sizeof(backlight_timeout_value))
747 /* if given a weird value, use default */
748 index=6;
749 remote_backlight_timeout_plugged = HZ * backlight_timeout_value[index];
750 remote_backlight_update_state();
752 #endif /* CONFIG_CHARGING */
754 #ifdef HAS_REMOTE_BUTTON_HOLD
755 /* Remote hold button change event handler. */
756 void remote_backlight_hold_changed(bool rc_hold_button)
758 if (!rc_hold_button || (remote_backlight_on_button_hold > 0))
759 /* if unlocked or override */
760 remote_backlight_on();
763 void remote_backlight_set_on_button_hold(int index)
765 if ((unsigned)index >= 3)
766 /* if given a weird value, use default */
767 index = 0;
769 remote_backlight_on_button_hold = index;
770 remote_backlight_update_state();
772 #endif /* HAS_REMOTE_BUTTON_HOLD */
774 /* return value in ticks; 0 means always on, <0 means always off */
775 int remote_backlight_get_current_timeout(void)
777 return remote_backlight_timeout;
780 /* returns true when the backlight is on OR when it's set to always off */
781 bool is_remote_backlight_on(void)
783 if (remote_backlight_timer != 0 || remote_backlight_timeout <= 0)
784 return true;
785 else
786 return false;
789 #endif /* HAVE_REMOTE_LCD */
791 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
792 void backlight_set_brightness(int val)
794 if (val < MIN_BRIGHTNESS_SETTING)
795 val = MIN_BRIGHTNESS_SETTING;
796 else if (val > MAX_BRIGHTNESS_SETTING)
797 val = MAX_BRIGHTNESS_SETTING;
799 __backlight_set_brightness(val);
801 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */
803 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
804 void buttonlight_set_brightness(int val)
806 if (val < MIN_BRIGHTNESS_SETTING)
807 val = MIN_BRIGHTNESS_SETTING;
808 else if (val > MAX_BRIGHTNESS_SETTING)
809 val = MAX_BRIGHTNESS_SETTING;
811 __buttonlight_set_brightness(val);
813 #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
815 #else /* !defined(HAVE_BACKLIGHT) || defined(BOOTLOADER)
816 -- no backlight, empty dummy functions */
818 #if defined(BOOTLOADER) && defined(HAVE_BACKLIGHT)
819 void backlight_init(void)
821 (void)__backlight_init();
822 __backlight_on();
824 #endif
826 void backlight_on(void) {}
827 void backlight_off(void) {}
828 void buttonlight_on(void) {}
829 void backlight_set_timeout(int index) {(void)index;}
830 bool is_backlight_on(void) {return true;}
831 #ifdef HAVE_REMOTE_LCD
832 void remote_backlight_on(void) {}
833 void remote_backlight_off(void) {}
834 void remote_backlight_set_timeout(int index) {(void)index;}
835 bool is_remote_backlight_on(void) {return true;}
836 #endif /* HAVE_REMOTE_LCD */
837 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
838 void backlight_set_brightness(int val) { (void)val; }
839 #endif
840 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
841 void buttonlight_set_brightness(int val) { (void)val; }
842 #endif
843 #endif /* defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) */