Refer to "disk" instead of "hard disk" for the dap as flash based daps don't have...
[Rockbox.git] / firmware / backlight.c
blob1e8dd46b2db3ddda21c0ff35d02514831a5fa424
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 #if defined(TARGET_TREE) && !defined(SIMULATOR)
41 #include "backlight-target.h"
42 #endif
44 #ifdef SIMULATOR
45 static inline void __backlight_on(void)
47 sim_backlight(100);
50 static inline void __backlight_off(void)
52 sim_backlight(0);
55 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
56 static inline void __backlight_set_brightness(int val)
58 (void)val;
60 #endif
62 #else
63 /* Basic low-level code that simply switches backlight on or off. Probably
64 * a nice candidate for inclusion in the target/ dir. */
65 #ifndef TARGET_TREE
66 static inline void __backlight_on(void)
68 #if CONFIG_BACKLIGHT == BL_RTC
69 /* Enable square wave */
70 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
71 #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
72 and_b(~0x40, &PADRH); /* drive and set low */
73 or_b(0x40, &PAIORH);
74 #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
75 or_b(0x40, &PADRH); /* drive it high */
76 #endif
79 static inline void __backlight_off(void)
81 #if CONFIG_BACKLIGHT == BL_RTC
82 /* Disable square wave */
83 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
84 #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
85 and_b(~0x40, &PAIORH); /* let it float (up) */
86 #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
87 and_b(~0x40, &PADRH); /* drive it low */
88 #endif
90 #endif
91 #endif /* SIMULATOR */
93 #if CONFIG_BACKLIGHT && !defined(BOOTLOADER)
95 const signed char backlight_timeout_value[19] =
97 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
100 #define BACKLIGHT_ON 1
101 #define BACKLIGHT_OFF 2
102 #define REMOTE_BACKLIGHT_ON 3
103 #define REMOTE_BACKLIGHT_OFF 4
104 #define BACKLIGHT_UNBOOST_CPU 5
105 #ifdef HAVE_LCD_SLEEP
106 #define LCD_SLEEP 6
107 #endif
109 static void backlight_thread(void);
110 static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
111 #ifdef X5_BACKLIGHT_SHUTDOWN
112 #define BACKLIGHT_QUIT 256
113 #endif
114 static const char backlight_thread_name[] = "backlight";
115 static struct event_queue backlight_queue;
117 static int backlight_timer;
118 static int backlight_timeout = 5*HZ;
119 #if CONFIG_CHARGING
120 static int backlight_timeout_plugged = 5*HZ;
121 #endif
122 #ifdef HAS_BUTTON_HOLD
123 static int backlight_on_button_hold = 0;
124 #endif
126 #ifdef HAVE_REMOTE_LCD
127 static int remote_backlight_timer;
128 static int remote_backlight_timeout = 5*HZ;
129 #if CONFIG_CHARGING
130 static int remote_backlight_timeout_plugged = 5*HZ;
131 #endif
132 #ifdef HAS_REMOTE_BUTTON_HOLD
133 static int remote_backlight_on_button_hold = 0;
134 #endif
135 #endif
137 #ifdef HAVE_LCD_SLEEP
138 const signed char lcd_sleep_timeout_value[10] =
140 -1, 0, 5, 10, 15, 20, 30, 45, 60, 90
142 static int lcd_sleep_timer;
143 static int lcd_sleep_timeout = 10*HZ;
144 #endif
146 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
147 /* backlight fading */
148 #define BL_PWM_INTERVAL 5000 /* Cycle interval in s */
149 #define BL_PWM_COUNT 100
150 static const char backlight_fade_value[8] = { 0, 1, 2, 4, 6, 8, 10, 20 };
151 static int fade_in_count = 1;
152 static int fade_out_count = 4;
154 static bool bl_timer_active = false;
155 static int bl_dim_current = 0;
156 static int bl_dim_target = 0;
157 static int bl_pwm_counter = 0;
158 static volatile int bl_cycle_counter = 0;
159 static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
161 static void backlight_isr(void)
163 int timer_period;
164 bool idle = false;
166 timer_period = TIMER_FREQ / 1000 * BL_PWM_INTERVAL / 1000;
167 switch (bl_dim_state)
169 /* New cycle */
170 case DIM_STATE_START:
171 bl_pwm_counter = 0;
172 bl_cycle_counter++;
174 if (bl_dim_current > 0 && bl_dim_current < BL_PWM_COUNT)
176 __backlight_on();
177 bl_pwm_counter = bl_dim_current;
178 timer_period = timer_period * bl_pwm_counter / BL_PWM_COUNT;
179 bl_dim_state = DIM_STATE_MAIN;
181 else
183 if (bl_dim_current)
184 __backlight_on();
185 else
186 __backlight_off();
187 if (bl_dim_current == bl_dim_target)
188 idle = true;
191 break ;
193 /* Dim main screen */
194 case DIM_STATE_MAIN:
195 __backlight_off();
196 bl_dim_state = DIM_STATE_START;
197 timer_period = timer_period * (BL_PWM_COUNT - bl_pwm_counter) / BL_PWM_COUNT;
198 break ;
201 if ((bl_dim_target > bl_dim_current) && (bl_cycle_counter >= fade_in_count))
203 bl_dim_current++;
204 bl_cycle_counter = 0;
207 if ((bl_dim_target < bl_dim_current) && (bl_cycle_counter >= fade_out_count))
209 bl_dim_current--;
210 bl_cycle_counter = 0;
213 if (idle)
215 #ifdef CPU_COLDFIRE
216 queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, 0);
217 #endif
218 timer_unregister();
219 bl_timer_active = false;
221 else
222 timer_set_period(timer_period);
225 static void backlight_switch(void)
227 if (bl_dim_target > (BL_PWM_COUNT/2))
229 __backlight_on();
230 bl_dim_current = BL_PWM_COUNT;
232 else
234 __backlight_off();
235 bl_dim_current = 0;
239 static void backlight_release_timer(void)
241 #ifdef CPU_COLDFIRE
242 cpu_boost(false);
243 #endif
244 timer_unregister();
245 bl_timer_active = false;
246 backlight_switch();
249 static void backlight_dim(int value)
251 /* protect from extraneous calls with the same target value */
252 if (value == bl_dim_target)
253 return;
255 bl_dim_target = value;
257 if (bl_timer_active)
258 return ;
260 if (timer_register(0, backlight_release_timer, 2, 0, backlight_isr))
262 #ifdef CPU_COLDFIRE
263 /* Prevent cpu frequency changes while dimming. */
264 cpu_boost(true);
265 #endif
266 bl_timer_active = true;
268 else
269 backlight_switch();
272 void backlight_set_fade_in(int index)
274 fade_in_count = backlight_fade_value[index];
277 void backlight_set_fade_out(int index)
279 fade_out_count = backlight_fade_value[index];
281 #endif /* defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) */
283 static void _backlight_on(void)
285 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
286 if (fade_in_count > 0)
287 backlight_dim(BL_PWM_COUNT);
288 else
290 bl_dim_target = bl_dim_current = BL_PWM_COUNT;
291 __backlight_on();
293 #elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
294 /* call the enable from here - it takes longer than the disable */
295 lcd_enable(true);
296 __backlight_dim(false);
297 #else
298 __backlight_on();
299 #endif
300 #ifdef HAVE_LCD_SLEEP
301 lcd_sleep_timer = 0; /* LCD should be awake already */
302 #endif
305 static void _backlight_off(void)
307 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
308 if (fade_out_count > 0)
309 backlight_dim(0);
310 else
312 bl_dim_target = bl_dim_current = 0;
313 __backlight_off();
315 #elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
316 __backlight_dim(true);
317 #else
318 __backlight_off();
319 #endif
321 #ifdef HAVE_LCD_SLEEP
322 /* Start LCD sleep countdown */
323 if (lcd_sleep_timeout < 0)
325 lcd_sleep_timer = 0; /* Setting == Always */
326 lcd_sleep();
328 else
329 lcd_sleep_timer = lcd_sleep_timeout;
330 #endif
333 #ifdef HAVE_REMOTE_LCD
334 #ifdef SIMULATOR
335 static void __remote_backlight_on(void)
337 sim_remote_backlight(100);
340 static void __remote_backlight_off(void)
342 sim_remote_backlight(0);
344 #endif /* SIMULATOR */
345 #endif /* HAVE_REMOTE_LCD */
347 /* Update state of backlight according to timeout setting */
348 static void backlight_update_state(void)
350 #if CONFIG_CHARGING
351 if (charger_inserted()
352 #ifdef HAVE_USB_POWER
353 || usb_powered()
354 #endif
356 backlight_timer = backlight_timeout_plugged;
357 else
358 #endif
359 backlight_timer = backlight_timeout;
361 /* Backlight == OFF in the setting? */
362 if (backlight_timer < 0)
364 backlight_timer = 0; /* Disable the timeout */
365 #ifdef HAS_BUTTON_HOLD
366 if (backlight_on_button_hold == 2 && button_hold())
367 return; /* Keep on if "On" */
368 #endif
369 _backlight_off();
371 else
373 #ifdef HAS_BUTTON_HOLD
374 if (backlight_on_button_hold == 1 && button_hold())
376 /* Keep off if "Off". */
377 backlight_timer = 0; /* Disable the timeout */
378 return;
380 #endif
381 _backlight_on();
385 #ifdef HAVE_REMOTE_LCD
386 /* Update state of remote backlight according to timeout setting */
387 static void remote_backlight_update_state(void)
389 #if CONFIG_CHARGING
390 if (charger_inserted()
391 #ifdef HAVE_USB_POWER
392 || usb_powered()
393 #endif
395 remote_backlight_timer = remote_backlight_timeout_plugged;
396 else
397 #endif
398 remote_backlight_timer = remote_backlight_timeout;
400 /* Backlight == OFF in the setting? */
401 if (remote_backlight_timer < 0)
403 remote_backlight_timer = 0; /* Disable the timeout */
404 #ifdef HAS_REMOTE_BUTTON_HOLD
405 if (remote_backlight_on_button_hold == 2 && remote_button_hold())
406 return; /* Keep on if "On" */
407 #endif
408 __remote_backlight_off();
410 else
412 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
413 if (remote_type() == REMOTETYPE_H300_NONLCD)
415 backlight_update_state();
417 else
418 #endif
420 #ifdef HAS_REMOTE_BUTTON_HOLD
421 if (remote_backlight_on_button_hold == 1 && remote_button_hold())
423 /* Keep off if "Off". */
424 remote_backlight_timer = 0; /* Disable the timeout */
425 return;
427 #endif
428 __remote_backlight_on();
432 #endif /* HAVE_REMOTE_LCD */
434 void backlight_thread(void)
436 struct event ev;
438 while(1)
440 queue_wait(&backlight_queue, &ev);
441 switch(ev.id)
443 #ifdef HAVE_REMOTE_LCD
444 case REMOTE_BACKLIGHT_ON:
445 remote_backlight_update_state();
446 break;
448 case REMOTE_BACKLIGHT_OFF:
449 remote_backlight_timer = 0; /* Disable the timeout */
450 #ifdef HAS_REMOTE_BUTTON_HOLD
451 if (remote_backlight_on_button_hold == 2 &&
452 remote_button_hold())
453 break; /* Keep on if "On" */
454 #endif
455 __remote_backlight_off();
456 break;
457 #endif /* HAVE_REMOTE_LCD */
459 case BACKLIGHT_ON:
460 backlight_update_state();
461 break;
463 case BACKLIGHT_OFF:
464 backlight_timer = 0; /* Disable the timeout */
465 #ifdef HAS_BUTTON_HOLD
466 if (backlight_on_button_hold == 2 && button_hold())
467 break; /* Keep on if "On" */
468 #endif
469 _backlight_off();
470 break;
472 #ifdef HAVE_LCD_SLEEP
473 case LCD_SLEEP:
474 lcd_sleep();
475 break;
476 #endif
478 #ifdef X5_BACKLIGHT_SHUTDOWN
479 case BACKLIGHT_QUIT:
480 remove_thread(NULL);
481 break;
482 #endif
484 #if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \
485 && !defined(SIMULATOR)
486 case BACKLIGHT_UNBOOST_CPU:
487 cpu_boost(false);
488 break;
489 #endif
491 case SYS_USB_CONNECTED:
492 /* Tell the USB thread that we are safe */
493 DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
494 usb_acknowledge(SYS_USB_CONNECTED_ACK);
495 break;
497 case SYS_USB_DISCONNECTED:
498 usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
499 break;
500 } /* end switch */
501 } /* end while */
504 static void backlight_tick(void)
506 #if CONFIG_CHARGING
507 static bool charger_was_inserted = false;
508 bool charger_is_inserted = charger_inserted()
509 #ifdef HAVE_USB_POWER
510 || usb_powered()
511 #endif
514 if( charger_was_inserted != charger_is_inserted )
516 backlight_on();
517 #ifdef HAVE_REMOTE_LCD
518 remote_backlight_on();
519 #endif
521 charger_was_inserted = charger_is_inserted;
522 #endif /* CONFIG_CHARGING */
524 if(backlight_timer)
526 backlight_timer--;
527 if(backlight_timer == 0)
529 backlight_off();
532 #ifdef HAVE_LCD_SLEEP
533 else if(lcd_sleep_timer)
535 lcd_sleep_timer--;
536 if(lcd_sleep_timer == 0)
538 /* Queue on bl thread or freeze! */
539 queue_post(&backlight_queue, LCD_SLEEP, 0);
542 #endif /* HAVE_LCD_SLEEP */
544 #ifdef HAVE_REMOTE_LCD
545 if(remote_backlight_timer)
547 remote_backlight_timer--;
548 if(remote_backlight_timer == 0)
550 remote_backlight_off();
553 #endif /* HAVE_REMOVE_LCD */
556 void backlight_init(void)
558 queue_init(&backlight_queue, true);
560 #ifdef SIMULATOR
561 /* do nothing */
562 #elif defined(__BACKLIGHT_INIT)
563 /* Remove the __BACKLIGHT_INIT references when __backlight_init is
564 available on all backlighted targets. Take them out of the
565 backlight-target.h files as well */
566 if (__backlight_init())
568 # if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
569 /* If backlight is already on, don't fade in. */
570 bl_dim_current = BL_PWM_COUNT;
571 bl_dim_target = BL_PWM_COUNT;
572 # endif
574 #elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
575 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
576 or_b(0x40, &PAIORH); /* ..and output */
577 #endif
578 backlight_on();
579 #ifdef HAVE_REMOTE_LCD
580 remote_backlight_on();
581 #endif
583 create_thread(backlight_thread, backlight_stack,
584 sizeof(backlight_stack), backlight_thread_name
585 IF_PRIO(, PRIORITY_SYSTEM)
586 IF_COP(, CPU, false));
587 tick_add_task(backlight_tick);
590 #ifdef X5_BACKLIGHT_SHUTDOWN
591 void x5_backlight_shutdown(void)
593 /* Turn on the screen and don't let anyone else mess with it. Called
594 from clean_shutdown in misc.c. */
595 queue_empty(&backlight_queue);
596 tick_remove_task(backlight_tick);
597 /* Next time the thread runs, if at all, it will just remove itself. */
598 queue_post(&backlight_queue, BACKLIGHT_QUIT, 0);
599 __backlight_on();
601 #endif /* X5_BACKLIGHT_SHUTDOWN */
603 void backlight_on(void)
605 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
606 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
609 void backlight_off(void)
611 queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
614 /* returns true when the backlight is on OR when it's set to always off */
615 bool is_backlight_on(void)
617 if (backlight_timer || backlight_get_current_timeout() <= 0)
618 return true;
619 else
620 return false;
623 /* return value in ticks; 0 means always on, <0 means always off */
624 int backlight_get_current_timeout(void)
626 #if CONFIG_CHARGING
627 if (charger_inserted()
628 #ifdef HAVE_USB_POWER
629 || usb_powered()
630 #endif
632 return backlight_timeout_plugged;
633 else
634 return backlight_timeout;
635 #else
636 return backlight_timeout;
637 #endif
640 void backlight_set_timeout(int index)
642 if((unsigned)index >= sizeof(backlight_timeout_value))
643 /* if given a weird value, use default */
644 index = 6;
645 backlight_timeout = HZ * backlight_timeout_value[index];
646 backlight_update_state();
649 #if CONFIG_CHARGING
650 void backlight_set_timeout_plugged(int index)
652 if((unsigned)index >= sizeof(backlight_timeout_value))
653 /* if given a weird value, use default */
654 index = 6;
655 backlight_timeout_plugged = HZ * backlight_timeout_value[index];
656 backlight_update_state();
658 #endif /* CONFIG_CHARGING */
660 #ifdef HAS_BUTTON_HOLD
661 /* Hold button change event handler. */
662 void backlight_hold_changed(bool hold_button)
664 /* Hold switch overrides all backlight behavior except when
665 set to "Normal" */
666 /* Queue or freeze */
667 if (hold_button && backlight_on_button_hold == 1)
668 backlight_off(); /* setting == Off */
669 else /* setting == On, Normal, no hold button, or anything else */
670 backlight_on();
673 void backlight_set_on_button_hold(int index)
675 if ((unsigned)index >= 3)
676 /* if given a weird value, use default */
677 index = 0;
679 if (index == backlight_on_button_hold)
680 return;
682 backlight_on_button_hold = index;
683 backlight_hold_changed(button_hold());
685 #endif /* HAS_BUTTON_HOLD */
687 #ifdef HAVE_LCD_SLEEP
688 void lcd_set_sleep_after_backlight_off(int index)
690 if ((unsigned)index >= sizeof(lcd_sleep_timeout_value))
691 /* if given a weird value, use default */
692 index = 3;
694 lcd_sleep_timeout = HZ * lcd_sleep_timeout_value[index];
696 if (backlight_timer > 0 || backlight_get_current_timeout() == 0)
697 /* Timer will be set when bl turns off or bl set to on. */
698 return;
700 /* Backlight is Off */
701 if (lcd_sleep_timeout < 0)
702 lcd_sleep_timer = 1; /* Always - sleep next tick */
703 else
704 lcd_sleep_timer = lcd_sleep_timeout; /* Never, other */
706 #endif /* HAVE_LCD_SLEEP */
708 #ifdef HAVE_REMOTE_LCD
709 void remote_backlight_on(void)
711 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0);
714 void remote_backlight_off(void)
716 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0);
719 void remote_backlight_set_timeout(int index)
721 if((unsigned)index >= sizeof(backlight_timeout_value))
722 /* if given a weird value, use default */
723 index=6;
724 remote_backlight_timeout = HZ * backlight_timeout_value[index];
725 remote_backlight_update_state();
728 #if CONFIG_CHARGING
729 void remote_backlight_set_timeout_plugged(int index)
731 if((unsigned)index >= sizeof(backlight_timeout_value))
732 /* if given a weird value, use default */
733 index=6;
734 remote_backlight_timeout_plugged = HZ * backlight_timeout_value[index];
735 remote_backlight_update_state();
737 #endif /* CONFIG_CHARGING */
739 #ifdef HAS_REMOTE_BUTTON_HOLD
740 /* Remote hold button change event handler. */
741 void remote_backlight_hold_changed(bool rc_hold_button)
743 /* Hold switch overrides all backlight behavior except when
744 set to "Normal" */
745 /* Queue or freeze */
746 if (rc_hold_button && remote_backlight_on_button_hold == 1)
747 remote_backlight_off(); /* setting == Off */
748 else /* setting == On, Normal, no hold button, or anything else */
749 remote_backlight_on();
753 void remote_backlight_set_on_button_hold(int index)
755 if ((unsigned)index >= 3)
756 /* if given a weird value, use default */
757 index = 0;
759 if (index == remote_backlight_on_button_hold)
760 return;
762 remote_backlight_on_button_hold = index;
763 remote_backlight_hold_changed(remote_button_hold());
765 #endif /* HAS_REMOTE_BUTTON_HOLD */
767 /* return value in ticks; 0 means always on, <0 means always off */
768 int remote_backlight_get_current_timeout(void)
770 #if CONFIG_CHARGING
771 if (charger_inserted()
772 #ifdef HAVE_USB_POWER
773 || usb_powered()
774 #endif
776 return remote_backlight_timeout_plugged;
777 else
778 return remote_backlight_timeout;
779 #else
780 return remote_backlight_timeout;
781 #endif
784 /* returns true when the backlight is on OR when it's set to always off */
785 bool is_remote_backlight_on(void)
787 if (remote_backlight_timer != 0 ||
788 remote_backlight_get_current_timeout() <= 0)
789 return true;
790 else
791 return false;
794 #endif /* HAVE_REMOTE_LCD */
796 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
797 void backlight_set_brightness(int val)
799 if (val < MIN_BRIGHTNESS_SETTING)
800 val = MIN_BRIGHTNESS_SETTING;
801 else if (val > MAX_BRIGHTNESS_SETTING)
802 val = MAX_BRIGHTNESS_SETTING;
804 __backlight_set_brightness(val);
806 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */
808 #else /* (CONFIG_BACKLIGHT == 0) || defined(BOOTLOADER)
809 -- no backlight, empty dummy functions */
811 #if defined(BOOTLOADER) && CONFIG_BACKLIGHT
812 void backlight_init(void)
814 #ifdef __BACKLIGHT_INIT
815 __backlight_init();
816 __backlight_on();
817 #endif
819 #endif
821 void backlight_on(void) {}
822 void backlight_off(void) {}
823 void backlight_set_timeout(int index) {(void)index;}
824 bool is_backlight_on(void) {return true;}
825 #ifdef HAVE_REMOTE_LCD
826 void remote_backlight_on(void) {}
827 void remote_backlight_off(void) {}
828 void remote_backlight_set_timeout(int index) {(void)index;}
829 bool is_remote_backlight_on(void) {return true;}
830 #endif /* HAVE_REMOTE_LCD */
831 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
832 void backlight_set_brightness(int val) { (void)val; }
833 #endif
834 #endif /* CONFIG_BACKLIGHT && !defined(BOOTLOADER) */