diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/mpio_hd200_hd300.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/bootloader/mpio_hd200_hd300.c b/bootloader/mpio_hd200_hd300.c index 14f76354fb..be36daf2ef 100644 --- a/bootloader/mpio_hd200_hd300.c +++ b/bootloader/mpio_hd200_hd300.c | |||
@@ -344,6 +344,14 @@ void main(void) | |||
344 | bool blink_toggle = false; | 344 | bool blink_toggle = false; |
345 | 345 | ||
346 | int button; | 346 | int button; |
347 | |||
348 | /* hold status variables | ||
349 | * this two must have different | ||
350 | * values in the begining | ||
351 | */ | ||
352 | bool hold = false; | ||
353 | bool last_hold = true; | ||
354 | |||
347 | unsigned int event = EVENT_NONE; | 355 | unsigned int event = EVENT_NONE; |
348 | unsigned int last_event = EVENT_NONE; | 356 | unsigned int last_event = EVENT_NONE; |
349 | 357 | ||
@@ -364,21 +372,20 @@ void main(void) | |||
364 | 372 | ||
365 | lcd_init(); | 373 | lcd_init(); |
366 | 374 | ||
367 | /* only lowlevel functions no queue init */ | 375 | /* setup font system */ |
368 | _backlight_init(); | ||
369 | _backlight_hw_on(); | ||
370 | |||
371 | /* setup font system*/ | ||
372 | font_init(); | 376 | font_init(); |
373 | lcd_setfont(FONT_SYSFIXED); | 377 | lcd_setfont(FONT_SYSFIXED); |
374 | 378 | ||
375 | /* buttons reading init*/ | 379 | /* buttons reading init */ |
376 | adc_init(); | 380 | adc_init(); |
377 | button_init(); | 381 | button_init(); |
378 | 382 | ||
379 | usb_init(); | 383 | usb_init(); |
380 | cpu_idle_mode(true); | 384 | cpu_idle_mode(true); |
381 | 385 | ||
386 | /* lowlevel init only */ | ||
387 | _backlight_init(); | ||
388 | |||
382 | /* Handle wakeup event. Possibilities are: | 389 | /* Handle wakeup event. Possibilities are: |
383 | * RTC alarm (HD300) | 390 | * RTC alarm (HD300) |
384 | * ON button (PLAY or RC_PLAY on HD200) | 391 | * ON button (PLAY or RC_PLAY on HD200) |
@@ -387,6 +394,21 @@ void main(void) | |||
387 | */ | 394 | */ |
388 | while(1) | 395 | while(1) |
389 | { | 396 | { |
397 | /* check hold status */ | ||
398 | hold = button_hold(); | ||
399 | |||
400 | /* backlight handling | ||
401 | * change only on hold toggle */ | ||
402 | if ( hold != last_hold ) | ||
403 | { | ||
404 | if ( hold ) | ||
405 | _backlight_hw_off(); | ||
406 | else | ||
407 | _backlight_hw_on(); | ||
408 | |||
409 | last_hold = hold; | ||
410 | } | ||
411 | |||
390 | /* read buttons */ | 412 | /* read buttons */ |
391 | event = EVENT_NONE; | 413 | event = EVENT_NONE; |
392 | button = button_get_w_tmo(HZ); | 414 | button = button_get_w_tmo(HZ); |
@@ -407,6 +429,7 @@ void main(void) | |||
407 | if ( _rtc_alarm() ) | 429 | if ( _rtc_alarm() ) |
408 | event |= EVENT_RTC; | 430 | event |= EVENT_RTC; |
409 | #endif | 431 | #endif |
432 | |||
410 | reset_screen(); | 433 | reset_screen(); |
411 | switch (event) | 434 | switch (event) |
412 | { | 435 | { |