diff options
-rw-r--r-- | apps/SOURCES | 4 | ||||
-rw-r--r-- | apps/bookmark.c | 4 | ||||
-rw-r--r-- | apps/filetree.c | 4 | ||||
-rw-r--r-- | apps/gui/gwps-common.c | 6 | ||||
-rw-r--r-- | apps/gui/gwps.c | 32 | ||||
-rw-r--r-- | apps/onplay.c | 8 | ||||
-rw-r--r-- | apps/plugin.c | 6 | ||||
-rw-r--r-- | apps/recorder/backdrop.c | 17 | ||||
-rw-r--r-- | apps/recorder/backdrop.h | 9 | ||||
-rw-r--r-- | apps/settings.c | 23 | ||||
-rw-r--r-- | apps/settings.h | 2 | ||||
-rw-r--r-- | apps/settings_menu.c | 10 | ||||
-rw-r--r-- | apps/tree.c | 6 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 109 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 112 | ||||
-rw-r--r-- | firmware/export/lcd.h | 10 |
16 files changed, 285 insertions, 77 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index ccfc7fa280..0fdb6f5955 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -57,8 +57,10 @@ recorder/icons.c | |||
57 | recorder/keyboard.c | 57 | recorder/keyboard.c |
58 | recorder/peakmeter.c | 58 | recorder/peakmeter.c |
59 | recorder/widgets.c | 59 | recorder/widgets.c |
60 | #ifdef HAVE_LCD_COLOR | 60 | #if LCD_DEPTH > 1 |
61 | recorder/backdrop.c | 61 | recorder/backdrop.c |
62 | #endif | ||
63 | #ifdef HAVE_LCD_COLOR | ||
62 | gui/color_picker.c | 64 | gui/color_picker.c |
63 | #endif | 65 | #endif |
64 | #endif | 66 | #endif |
diff --git a/apps/bookmark.c b/apps/bookmark.c index cb1735f3d5..e6c6261856 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include "splash.h" | 51 | #include "splash.h" |
52 | #include "yesno.h" | 52 | #include "yesno.h" |
53 | 53 | ||
54 | #ifdef HAVE_LCD_COLOR | 54 | #if LCD_DEPTH > 1 |
55 | #include "backdrop.h" | 55 | #include "backdrop.h" |
56 | #endif | 56 | #endif |
57 | 57 | ||
@@ -218,7 +218,7 @@ bool bookmark_autobookmark(void) | |||
218 | str(LANG_RESUME_CONFIRM_PLAYER)}; | 218 | str(LANG_RESUME_CONFIRM_PLAYER)}; |
219 | struct text_message message={(char **)lines, 2}; | 219 | struct text_message message={(char **)lines, 2}; |
220 | #endif | 220 | #endif |
221 | #ifdef HAVE_LCD_COLOR | 221 | #if LCD_DEPTH > 1 |
222 | show_main_backdrop(); /* switch to main backdrop as we may come from wps */ | 222 | show_main_backdrop(); /* switch to main backdrop as we may come from wps */ |
223 | #endif | 223 | #endif |
224 | gui_syncstatusbar_draw(&statusbars, false); | 224 | gui_syncstatusbar_draw(&statusbars, false); |
diff --git a/apps/filetree.c b/apps/filetree.c index 9d5109ceb9..f10c02b449 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -54,7 +54,7 @@ static int boot_size = 0; | |||
54 | static int boot_cluster; | 54 | static int boot_cluster; |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #ifdef HAVE_LCD_COLOR | 57 | #if LCD_DEPTH > 1 |
58 | #include "backdrop.h" | 58 | #include "backdrop.h" |
59 | #endif | 59 | #endif |
60 | 60 | ||
@@ -466,7 +466,7 @@ int ft_enter(struct tree_context* c) | |||
466 | /* wps config file */ | 466 | /* wps config file */ |
467 | case TREE_ATTR_WPS: | 467 | case TREE_ATTR_WPS: |
468 | gui_syncsplash(0, true, str(LANG_WAIT)); | 468 | gui_syncsplash(0, true, str(LANG_WAIT)); |
469 | #ifdef HAVE_LCD_COLOR | 469 | #if LCD_DEPTH > 1 |
470 | unload_wps_backdrop(); | 470 | unload_wps_backdrop(); |
471 | #endif | 471 | #endif |
472 | wps_data_load(gui_wps[0].data, buf, true); | 472 | wps_data_load(gui_wps[0].data, buf, true); |
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 98f2c7e2ed..212f40f3c0 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include "bmp.h" | 48 | #include "bmp.h" |
49 | #include "atoi.h" | 49 | #include "atoi.h" |
50 | #endif | 50 | #endif |
51 | #ifdef HAVE_LCD_COLOR | 51 | #if LCD_DEPTH > 1 |
52 | #include "backdrop.h" | 52 | #include "backdrop.h" |
53 | #endif | 53 | #endif |
54 | #include "dsp.h" | 54 | #include "dsp.h" |
@@ -143,7 +143,7 @@ bool wps_data_preload_tags(struct wps_data *data, char *buf, | |||
143 | } | 143 | } |
144 | break; | 144 | break; |
145 | 145 | ||
146 | #ifdef HAVE_LCD_COLOR | 146 | #if LCD_DEPTH > 1 |
147 | case 'X': | 147 | case 'X': |
148 | /* Backdrop image - must be the same size as the LCD */ | 148 | /* Backdrop image - must be the same size as the LCD */ |
149 | { | 149 | { |
@@ -2473,7 +2473,7 @@ bool gui_wps_display(void) | |||
2473 | if(i == 0) | 2473 | if(i == 0) |
2474 | { | 2474 | { |
2475 | #ifdef HAVE_LCD_BITMAP | 2475 | #ifdef HAVE_LCD_BITMAP |
2476 | #ifdef HAVE_LCD_COLOR | 2476 | #if LCD_DEPTH > 1 |
2477 | unload_wps_backdrop(); | 2477 | unload_wps_backdrop(); |
2478 | #endif | 2478 | #endif |
2479 | wps_data_load(gui_wps[i].data, | 2479 | wps_data_load(gui_wps[i].data, |
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 115e9f7441..482442cb53 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include "abrepeat.h" | 54 | #include "abrepeat.h" |
55 | #include "playback.h" | 55 | #include "playback.h" |
56 | #include "splash.h" | 56 | #include "splash.h" |
57 | #ifdef HAVE_LCD_COLOR | 57 | #if LCD_DEPTH > 1 |
58 | #include "backdrop.h" | 58 | #include "backdrop.h" |
59 | #endif | 59 | #endif |
60 | #include "ata_idle_notify.h" | 60 | #include "ata_idle_notify.h" |
@@ -104,9 +104,9 @@ long gui_wps_show(void) | |||
104 | { | 104 | { |
105 | gui_wps_set_margin(&gui_wps[i]); | 105 | gui_wps_set_margin(&gui_wps[i]); |
106 | } | 106 | } |
107 | #ifdef HAVE_LCD_COLOR | 107 | #if LCD_DEPTH > 1 |
108 | show_wps_backdrop(); | 108 | show_wps_backdrop(); |
109 | #endif /* HAVE_LCD_COLOR */ | 109 | #endif /* LCD_DEPTH > 1 */ |
110 | #endif | 110 | #endif |
111 | 111 | ||
112 | #ifdef AB_REPEAT_ENABLE | 112 | #ifdef AB_REPEAT_ENABLE |
@@ -201,12 +201,12 @@ long gui_wps_show(void) | |||
201 | switch(button) | 201 | switch(button) |
202 | { | 202 | { |
203 | case ACTION_WPS_CONTEXT: | 203 | case ACTION_WPS_CONTEXT: |
204 | #ifdef HAVE_LCD_COLOR | 204 | #if LCD_DEPTH > 1 |
205 | show_main_backdrop(); | 205 | show_main_backdrop(); |
206 | #endif | 206 | #endif |
207 | action_signalscreenchange(); | 207 | action_signalscreenchange(); |
208 | onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); | 208 | onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); |
209 | #ifdef HAVE_LCD_COLOR | 209 | #if LCD_DEPTH > 1 |
210 | show_wps_backdrop(); | 210 | show_wps_backdrop(); |
211 | #endif | 211 | #endif |
212 | #ifdef HAVE_LCD_BITMAP | 212 | #ifdef HAVE_LCD_BITMAP |
@@ -422,13 +422,13 @@ long gui_wps_show(void) | |||
422 | FOR_NB_SCREENS(i) | 422 | FOR_NB_SCREENS(i) |
423 | gui_wps[i].display->stop_scroll(); | 423 | gui_wps[i].display->stop_scroll(); |
424 | 424 | ||
425 | #ifdef HAVE_LCD_COLOR | 425 | #if LCD_DEPTH > 1 |
426 | show_main_backdrop(); | 426 | show_main_backdrop(); |
427 | #endif | 427 | #endif |
428 | action_signalscreenchange(); | 428 | action_signalscreenchange(); |
429 | if (main_menu()) | 429 | if (main_menu()) |
430 | return true; | 430 | return true; |
431 | #ifdef HAVE_LCD_COLOR | 431 | #if LCD_DEPTH > 1 |
432 | show_wps_backdrop(); | 432 | show_wps_backdrop(); |
433 | #endif | 433 | #endif |
434 | #ifdef HAVE_LCD_BITMAP | 434 | #ifdef HAVE_LCD_BITMAP |
@@ -443,12 +443,12 @@ long gui_wps_show(void) | |||
443 | 443 | ||
444 | #ifdef HAVE_QUICKSCREEN | 444 | #ifdef HAVE_QUICKSCREEN |
445 | case ACTION_WPS_QUICKSCREEN: | 445 | case ACTION_WPS_QUICKSCREEN: |
446 | #ifdef HAVE_LCD_COLOR | 446 | #if LCD_DEPTH > 1 |
447 | show_main_backdrop(); | 447 | show_main_backdrop(); |
448 | #endif | 448 | #endif |
449 | if (quick_screen_quick(button)) | 449 | if (quick_screen_quick(button)) |
450 | return SYS_USB_CONNECTED; | 450 | return SYS_USB_CONNECTED; |
451 | #ifdef HAVE_LCD_COLOR | 451 | #if LCD_DEPTH > 1 |
452 | show_wps_backdrop(); | 452 | show_wps_backdrop(); |
453 | #endif | 453 | #endif |
454 | #ifdef HAVE_LCD_BITMAP | 454 | #ifdef HAVE_LCD_BITMAP |
@@ -464,7 +464,7 @@ long gui_wps_show(void) | |||
464 | /* screen settings */ | 464 | /* screen settings */ |
465 | #ifdef BUTTON_F3 | 465 | #ifdef BUTTON_F3 |
466 | case ACTION_F3: | 466 | case ACTION_F3: |
467 | #ifdef HAVE_LCD_COLOR | 467 | #if LCD_DEPTH > 1 |
468 | show_main_backdrop(); | 468 | show_main_backdrop(); |
469 | #endif | 469 | #endif |
470 | if (quick_screen_f3(BUTTON_F3)) | 470 | if (quick_screen_f3(BUTTON_F3)) |
@@ -482,13 +482,13 @@ long gui_wps_show(void) | |||
482 | /* pitch screen */ | 482 | /* pitch screen */ |
483 | #ifdef HAVE_PITCHSCREEN | 483 | #ifdef HAVE_PITCHSCREEN |
484 | case ACTION_WPS_PITCHSCREEN: | 484 | case ACTION_WPS_PITCHSCREEN: |
485 | #ifdef HAVE_LCD_COLOR | 485 | #if LCD_DEPTH > 1 |
486 | show_main_backdrop(); | 486 | show_main_backdrop(); |
487 | #endif | 487 | #endif |
488 | action_signalscreenchange(); | 488 | action_signalscreenchange(); |
489 | if (1 == pitch_screen()) | 489 | if (1 == pitch_screen()) |
490 | return SYS_USB_CONNECTED; | 490 | return SYS_USB_CONNECTED; |
491 | #ifdef HAVE_LCD_COLOR | 491 | #if LCD_DEPTH > 1 |
492 | show_wps_backdrop(); | 492 | show_wps_backdrop(); |
493 | #endif | 493 | #endif |
494 | restore = true; | 494 | restore = true; |
@@ -533,11 +533,11 @@ long gui_wps_show(void) | |||
533 | break; | 533 | break; |
534 | 534 | ||
535 | case ACTION_WPS_ID3SCREEN: | 535 | case ACTION_WPS_ID3SCREEN: |
536 | #ifdef HAVE_LCD_COLOR | 536 | #if LCD_DEPTH > 1 |
537 | show_main_backdrop(); | 537 | show_main_backdrop(); |
538 | #endif | 538 | #endif |
539 | browse_id3(); | 539 | browse_id3(); |
540 | #ifdef HAVE_LCD_COLOR | 540 | #if LCD_DEPTH > 1 |
541 | show_wps_backdrop(); | 541 | show_wps_backdrop(); |
542 | #endif | 542 | #endif |
543 | #ifdef HAVE_LCD_BITMAP | 543 | #ifdef HAVE_LCD_BITMAP |
@@ -559,7 +559,7 @@ long gui_wps_show(void) | |||
559 | 559 | ||
560 | case SYS_POWEROFF: | 560 | case SYS_POWEROFF: |
561 | bookmark_autobookmark(); | 561 | bookmark_autobookmark(); |
562 | #ifdef HAVE_LCD_COLOR | 562 | #if LCD_DEPTH > 1 |
563 | show_main_backdrop(); | 563 | show_main_backdrop(); |
564 | #endif | 564 | #endif |
565 | default_event_handler(SYS_POWEROFF); | 565 | default_event_handler(SYS_POWEROFF); |
@@ -868,7 +868,7 @@ void gui_sync_wps_init(void) | |||
868 | gui_wps_set_data(&gui_wps[i], &wps_datas[i]); | 868 | gui_wps_set_data(&gui_wps[i], &wps_datas[i]); |
869 | gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); | 869 | gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); |
870 | } | 870 | } |
871 | #ifdef HAVE_LCD_COLOR | 871 | #if LCD_DEPTH > 1 |
872 | unload_wps_backdrop(); | 872 | unload_wps_backdrop(); |
873 | #endif | 873 | #endif |
874 | } | 874 | } |
diff --git a/apps/onplay.c b/apps/onplay.c index 60a737938f..59fa8caa85 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include "action.h" | 50 | #include "action.h" |
51 | #include "splash.h" | 51 | #include "splash.h" |
52 | #include "yesno.h" | 52 | #include "yesno.h" |
53 | #ifdef HAVE_LCD_COLOR | 53 | #if LCD_DEPTH > 1 |
54 | #include "backdrop.h" | 54 | #include "backdrop.h" |
55 | #endif | 55 | #endif |
56 | #ifdef HAVE_LCD_BITMAP | 56 | #ifdef HAVE_LCD_BITMAP |
@@ -493,7 +493,7 @@ static bool delete_dir(void) | |||
493 | return delete_handler(true); | 493 | return delete_handler(true); |
494 | } | 494 | } |
495 | 495 | ||
496 | #ifdef HAVE_LCD_COLOR | 496 | #if LCD_DEPTH > 1 |
497 | static bool set_backdrop(void) | 497 | static bool set_backdrop(void) |
498 | { | 498 | { |
499 | /* load the image */ | 499 | /* load the image */ |
@@ -837,7 +837,7 @@ int onplay(char* file, int attr, int from) | |||
837 | struct menu_item items[12]; | 837 | struct menu_item items[12]; |
838 | #endif | 838 | #endif |
839 | int m, i=0, result; | 839 | int m, i=0, result; |
840 | #ifdef HAVE_LCD_COLOR | 840 | #if LCD_DEPTH > 1 |
841 | char *suffix; | 841 | char *suffix; |
842 | #endif | 842 | #endif |
843 | 843 | ||
@@ -920,7 +920,7 @@ int onplay(char* file, int attr, int from) | |||
920 | items[i].function = delete_file; | 920 | items[i].function = delete_file; |
921 | i++; | 921 | i++; |
922 | 922 | ||
923 | #ifdef HAVE_LCD_COLOR | 923 | #if LCD_DEPTH > 1 |
924 | suffix = strrchr(file, '.'); | 924 | suffix = strrchr(file, '.'); |
925 | if (suffix) | 925 | if (suffix) |
926 | { | 926 | { |
diff --git a/apps/plugin.c b/apps/plugin.c index 0d9635b88e..4827476545 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -485,7 +485,7 @@ int plugin_load(const char* plugin, void* parameter) | |||
485 | #ifdef HAVE_REMOTE_LCD | 485 | #ifdef HAVE_REMOTE_LCD |
486 | int rxm, rym; | 486 | int rxm, rym; |
487 | #endif | 487 | #endif |
488 | #ifdef HAVE_LCD_COLOR | 488 | #if LCD_DEPTH > 1 |
489 | fb_data* old_backdrop; | 489 | fb_data* old_backdrop; |
490 | #endif | 490 | #endif |
491 | 491 | ||
@@ -567,7 +567,7 @@ int plugin_load(const char* plugin, void* parameter) | |||
567 | xm = lcd_getxmargin(); | 567 | xm = lcd_getxmargin(); |
568 | ym = lcd_getymargin(); | 568 | ym = lcd_getymargin(); |
569 | lcd_setmargins(0,0); | 569 | lcd_setmargins(0,0); |
570 | #ifdef HAVE_LCD_COLOR | 570 | #if LCD_DEPTH > 1 |
571 | old_backdrop = lcd_get_backdrop(); | 571 | old_backdrop = lcd_get_backdrop(); |
572 | lcd_set_backdrop(NULL); | 572 | lcd_set_backdrop(NULL); |
573 | #endif | 573 | #endif |
@@ -594,8 +594,8 @@ int plugin_load(const char* plugin, void* parameter) | |||
594 | 594 | ||
595 | #ifdef HAVE_LCD_BITMAP | 595 | #ifdef HAVE_LCD_BITMAP |
596 | #if LCD_DEPTH > 1 | 596 | #if LCD_DEPTH > 1 |
597 | #ifdef HAVE_LCD_COLOR | ||
598 | lcd_set_backdrop(old_backdrop); | 597 | lcd_set_backdrop(old_backdrop); |
598 | #ifdef HAVE_LCD_COLOR | ||
599 | lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color, | 599 | lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color, |
600 | global_settings.bg_color); | 600 | global_settings.bg_color); |
601 | #else | 601 | #else |
diff --git a/apps/recorder/backdrop.c b/apps/recorder/backdrop.c index 374dba9f4b..7779792621 100644 --- a/apps/recorder/backdrop.c +++ b/apps/recorder/backdrop.c | |||
@@ -21,10 +21,20 @@ | |||
21 | #include "config.h" | 21 | #include "config.h" |
22 | #include "lcd.h" | 22 | #include "lcd.h" |
23 | #include "backdrop.h" | 23 | #include "backdrop.h" |
24 | #include "splash.h" /* debugging */ | ||
25 | 24 | ||
25 | #if LCD_DEPTH >= 8 | ||
26 | fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH]; | 26 | fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH]; |
27 | fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH]; | 27 | fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH]; |
28 | #elif LCD_DEPTH == 2 | ||
29 | #if LCD_PIXELFORMAT == VERTICAL_PACKING | ||
30 | fb_data main_backdrop[(LCD_HEIGHT+3)/4][LCD_WIDTH]; | ||
31 | fb_data wps_backdrop[(LCD_HEIGHT+3)/4][LCD_WIDTH]; | ||
32 | #else | ||
33 | fb_data main_backdrop[LCD_HEIGHT][LCD_FBWIDTH]; | ||
34 | fb_data wps_backdrop[LCD_HEIGHT][LCD_FBWIDTH]; | ||
35 | #endif | ||
36 | #endif | ||
37 | |||
28 | bool main_backdrop_valid = false; | 38 | bool main_backdrop_valid = false; |
29 | bool wps_backdrop_valid = false; | 39 | bool wps_backdrop_valid = false; |
30 | 40 | ||
@@ -52,27 +62,23 @@ bool load_backdrop(char* filename, fb_data* backdrop_buffer) | |||
52 | bool load_main_backdrop(char* filename) | 62 | bool load_main_backdrop(char* filename) |
53 | { | 63 | { |
54 | main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); | 64 | main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); |
55 | /* gui_syncsplash(100, true, "MAIN backdrop load: %s", main_backdrop_valid ? "OK" : "FAIL");*/ | ||
56 | return main_backdrop_valid; | 65 | return main_backdrop_valid; |
57 | } | 66 | } |
58 | 67 | ||
59 | bool load_wps_backdrop(char* filename) | 68 | bool load_wps_backdrop(char* filename) |
60 | { | 69 | { |
61 | wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); | 70 | wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); |
62 | /* gui_syncsplash(100, true, "WPS backdrop load: %s", main_backdrop_valid ? "OK" : "FAIL");*/ | ||
63 | return wps_backdrop_valid; | 71 | return wps_backdrop_valid; |
64 | } | 72 | } |
65 | 73 | ||
66 | void unload_main_backdrop(void) | 74 | void unload_main_backdrop(void) |
67 | { | 75 | { |
68 | main_backdrop_valid = false; | 76 | main_backdrop_valid = false; |
69 | /* gui_syncsplash(100, true, "MAIN backdrop unload");*/ | ||
70 | } | 77 | } |
71 | 78 | ||
72 | void unload_wps_backdrop(void) | 79 | void unload_wps_backdrop(void) |
73 | { | 80 | { |
74 | wps_backdrop_valid = false; | 81 | wps_backdrop_valid = false; |
75 | /* gui_syncsplash(100, true, "WPS backdrop unload");*/ | ||
76 | } | 82 | } |
77 | 83 | ||
78 | void show_main_backdrop(void) | 84 | void show_main_backdrop(void) |
@@ -89,7 +95,6 @@ void show_wps_backdrop(void) | |||
89 | } | 95 | } |
90 | else | 96 | else |
91 | { | 97 | { |
92 | /* gui_syncsplash(100, true, "WPS backdrop show: fallback to MAIN");*/ | ||
93 | show_main_backdrop(); | 98 | show_main_backdrop(); |
94 | } | 99 | } |
95 | } | 100 | } |
diff --git a/apps/recorder/backdrop.h b/apps/recorder/backdrop.h index da515af261..93373f1321 100644 --- a/apps/recorder/backdrop.h +++ b/apps/recorder/backdrop.h | |||
@@ -20,15 +20,10 @@ | |||
20 | #ifndef _BACKDROP_H | 20 | #ifndef _BACKDROP_H |
21 | #define _BACKDROP_H | 21 | #define _BACKDROP_H |
22 | 22 | ||
23 | #ifdef HAVE_LCD_COLOR | 23 | #if LCD_DEPTH > 1 |
24 | 24 | ||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "bmp.h" | 26 | #include "bmp.h" |
27 | #include "backdrop.h" | ||
28 | /* | ||
29 | extern fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH]; | ||
30 | extern fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH]; | ||
31 | */ | ||
32 | 27 | ||
33 | bool load_main_backdrop(char* filename); | 28 | bool load_main_backdrop(char* filename); |
34 | bool load_wps_backdrop(char* filename); | 29 | bool load_wps_backdrop(char* filename); |
@@ -39,6 +34,6 @@ void unload_wps_backdrop(void); | |||
39 | void show_main_backdrop(void); | 34 | void show_main_backdrop(void); |
40 | void show_wps_backdrop(void); | 35 | void show_wps_backdrop(void); |
41 | 36 | ||
42 | #endif /* HAVE_LCD_COLOR */ | 37 | #endif /* LCD_DEPTH > 1 */ |
43 | 38 | ||
44 | #endif /* _BACKDROP_H */ | 39 | #endif /* _BACKDROP_H */ |
diff --git a/apps/settings.c b/apps/settings.c index ea7e303d1d..fc0e5248a3 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include "statusbar.h" | 72 | #include "statusbar.h" |
73 | #include "splash.h" | 73 | #include "splash.h" |
74 | #include "list.h" | 74 | #include "list.h" |
75 | #ifdef HAVE_LCD_COLOR | 75 | #if LCD_DEPTH > 1 |
76 | #include "backdrop.h" | 76 | #include "backdrop.h" |
77 | #endif | 77 | #endif |
78 | 78 | ||
@@ -1034,7 +1034,7 @@ int settings_save( void ) | |||
1034 | i+= MAX_FILENAME; | 1034 | i+= MAX_FILENAME; |
1035 | #endif | 1035 | #endif |
1036 | 1036 | ||
1037 | #ifdef HAVE_LCD_COLOR | 1037 | #if LCD_DEPTH > 1 |
1038 | strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file, | 1038 | strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file, |
1039 | MAX_FILENAME); | 1039 | MAX_FILENAME); |
1040 | i+= MAX_FILENAME; | 1040 | i+= MAX_FILENAME; |
@@ -1198,7 +1198,7 @@ void settings_apply(void) | |||
1198 | global_settings.peak_meter_clip_hold); | 1198 | global_settings.peak_meter_clip_hold); |
1199 | #endif | 1199 | #endif |
1200 | 1200 | ||
1201 | #ifdef HAVE_LCD_COLOR | 1201 | #if LCD_DEPTH > 1 |
1202 | unload_wps_backdrop(); | 1202 | unload_wps_backdrop(); |
1203 | #endif | 1203 | #endif |
1204 | if ( global_settings.wps_file[0] && | 1204 | if ( global_settings.wps_file[0] && |
@@ -1212,7 +1212,7 @@ void settings_apply(void) | |||
1212 | wps_data_init(gui_wps[0].data); | 1212 | wps_data_init(gui_wps[0].data); |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | #ifdef HAVE_LCD_COLOR | 1215 | #if LCD_DEPTH > 1 |
1216 | if ( global_settings.backdrop_file[0] && | 1216 | if ( global_settings.backdrop_file[0] && |
1217 | global_settings.backdrop_file[0] != 0xff ) { | 1217 | global_settings.backdrop_file[0] != 0xff ) { |
1218 | snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", | 1218 | snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", |
@@ -1222,7 +1222,9 @@ void settings_apply(void) | |||
1222 | unload_main_backdrop(); | 1222 | unload_main_backdrop(); |
1223 | } | 1223 | } |
1224 | show_main_backdrop(); | 1224 | show_main_backdrop(); |
1225 | #endif | ||
1225 | 1226 | ||
1227 | #ifdef HAVE_LCD_COLOR | ||
1226 | screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); | 1228 | screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); |
1227 | screens[SCREEN_MAIN].set_background(global_settings.bg_color); | 1229 | screens[SCREEN_MAIN].set_background(global_settings.bg_color); |
1228 | #endif | 1230 | #endif |
@@ -1438,7 +1440,7 @@ void settings_load(int which) | |||
1438 | i+= MAX_FILENAME; | 1440 | i+= MAX_FILENAME; |
1439 | #endif | 1441 | #endif |
1440 | 1442 | ||
1441 | #ifdef HAVE_LCD_COLOR | 1443 | #if LCD_DEPTH > 1 |
1442 | strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i], | 1444 | strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i], |
1443 | MAX_FILENAME); | 1445 | MAX_FILENAME); |
1444 | i+= MAX_FILENAME; | 1446 | i+= MAX_FILENAME; |
@@ -1593,7 +1595,7 @@ bool settings_load_config(const char* file) | |||
1593 | 1595 | ||
1594 | /* check for the string values */ | 1596 | /* check for the string values */ |
1595 | if (!strcasecmp(name, "wps")) { | 1597 | if (!strcasecmp(name, "wps")) { |
1596 | #ifdef HAVE_LCD_COLOR | 1598 | #if LCD_DEPTH > 1 |
1597 | unload_wps_backdrop(); | 1599 | unload_wps_backdrop(); |
1598 | #endif | 1600 | #endif |
1599 | int fd2; | 1601 | int fd2; |
@@ -1629,7 +1631,7 @@ bool settings_load_config(const char* file) | |||
1629 | set_file(value, (char *)global_settings.font_file, MAX_FILENAME); | 1631 | set_file(value, (char *)global_settings.font_file, MAX_FILENAME); |
1630 | } | 1632 | } |
1631 | #endif | 1633 | #endif |
1632 | #ifdef HAVE_LCD_COLOR | 1634 | #if LCD_DEPTH > 1 |
1633 | else if (!strcasecmp(name, "backdrop")) { | 1635 | else if (!strcasecmp(name, "backdrop")) { |
1634 | if (load_main_backdrop(value)) { | 1636 | if (load_main_backdrop(value)) { |
1635 | set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME); | 1637 | set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME); |
@@ -1795,7 +1797,7 @@ bool settings_save_config(void) | |||
1795 | global_settings.font_file); | 1797 | global_settings.font_file); |
1796 | #endif | 1798 | #endif |
1797 | 1799 | ||
1798 | #ifdef HAVE_LCD_COLOR | 1800 | #if LCD_DEPTH > 1 |
1799 | if (global_settings.backdrop_file[0] != 0) | 1801 | if (global_settings.backdrop_file[0] != 0) |
1800 | fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR, | 1802 | fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR, |
1801 | global_settings.backdrop_file); | 1803 | global_settings.backdrop_file); |
@@ -1898,9 +1900,10 @@ void settings_reset(void) { | |||
1898 | #endif | 1900 | #endif |
1899 | global_settings.font_file[0] = '\0'; | 1901 | global_settings.font_file[0] = '\0'; |
1900 | global_settings.lang_file[0] = '\0'; | 1902 | global_settings.lang_file[0] = '\0'; |
1901 | #ifdef HAVE_LCD_COLOR | 1903 | #if LCD_DEPTH > 1 |
1902 | global_settings.backdrop_file[0] = '\0'; | 1904 | global_settings.backdrop_file[0] = '\0'; |
1903 | 1905 | #endif | |
1906 | #ifdef HAVE_LCD_COLOR | ||
1904 | global_settings.fg_color = LCD_DEFAULT_FG; | 1907 | global_settings.fg_color = LCD_DEFAULT_FG; |
1905 | global_settings.bg_color = LCD_DEFAULT_BG; | 1908 | global_settings.bg_color = LCD_DEFAULT_BG; |
1906 | #endif | 1909 | #endif |
diff --git a/apps/settings.h b/apps/settings.h index 7b70ab748c..c0c6a943ce 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -454,7 +454,7 @@ struct user_settings | |||
454 | bool dithering_enabled; | 454 | bool dithering_enabled; |
455 | #endif | 455 | #endif |
456 | 456 | ||
457 | #ifdef HAVE_LCD_COLOR | 457 | #if LCD_DEPTH > 1 |
458 | unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */ | 458 | unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */ |
459 | #endif | 459 | #endif |
460 | 460 | ||
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 0cbe5344fb..83f2452613 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -81,7 +81,7 @@ void dac_line_in(bool enable); | |||
81 | #include "dsp.h" | 81 | #include "dsp.h" |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | #ifdef HAVE_LCD_COLOR | 84 | #if LCD_DEPTH > 1 |
85 | #include "backdrop.h" | 85 | #include "backdrop.h" |
86 | #endif | 86 | #endif |
87 | 87 | ||
@@ -393,7 +393,7 @@ static bool invert_cursor(void) | |||
393 | return rc; | 393 | return rc; |
394 | } | 394 | } |
395 | 395 | ||
396 | #ifdef HAVE_LCD_COLOR | 396 | #if LCD_DEPTH > 1 |
397 | /** | 397 | /** |
398 | * Menu to clear the backdrop image | 398 | * Menu to clear the backdrop image |
399 | */ | 399 | */ |
@@ -404,7 +404,9 @@ static bool clear_main_backdrop(void) | |||
404 | show_main_backdrop(); | 404 | show_main_backdrop(); |
405 | return false; | 405 | return false; |
406 | } | 406 | } |
407 | #endif | ||
407 | 408 | ||
409 | #ifdef HAVE_LCD_COLOR | ||
408 | /** | 410 | /** |
409 | * Menu for fore/back colors | 411 | * Menu for fore/back colors |
410 | */ | 412 | */ |
@@ -1969,8 +1971,10 @@ static bool lcd_settings_menu(void) | |||
1969 | #endif | 1971 | #endif |
1970 | { ID2P(LANG_INVERT_CURSOR), invert_cursor }, | 1972 | { ID2P(LANG_INVERT_CURSOR), invert_cursor }, |
1971 | #endif | 1973 | #endif |
1972 | #ifdef HAVE_LCD_COLOR | 1974 | #if LCD_DEPTH > 1 |
1973 | { ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop }, | 1975 | { ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop }, |
1976 | #endif | ||
1977 | #ifdef HAVE_LCD_COLOR | ||
1974 | { ID2P(LANG_BACKGROUND_COLOR), set_bg_color }, | 1978 | { ID2P(LANG_BACKGROUND_COLOR), set_bg_color }, |
1975 | { ID2P(LANG_FOREGROUND_COLOR), set_fg_color }, | 1979 | { ID2P(LANG_FOREGROUND_COLOR), set_fg_color }, |
1976 | { ID2P(LANG_RESET_COLORS), reset_color }, | 1980 | { ID2P(LANG_RESET_COLORS), reset_color }, |
diff --git a/apps/tree.c b/apps/tree.c index 623046a4b0..fea7b21529 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -83,7 +83,7 @@ | |||
83 | #include "widgets.h" | 83 | #include "widgets.h" |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | #ifdef HAVE_LCD_COLOR | 86 | #if LCD_DEPTH > 1 |
87 | #include "backdrop.h" | 87 | #include "backdrop.h" |
88 | #endif | 88 | #endif |
89 | 89 | ||
@@ -118,7 +118,7 @@ const struct filetype filetypes[] = { | |||
118 | #ifdef HAVE_REMOTE_LCD | 118 | #ifdef HAVE_REMOTE_LCD |
119 | { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS }, | 119 | { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS }, |
120 | #endif | 120 | #endif |
121 | #ifdef HAVE_LCD_COLOR | 121 | #if LCD_DEPTH > 1 |
122 | { "bmp", TREE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS }, | 122 | { "bmp", TREE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS }, |
123 | #endif | 123 | #endif |
124 | #ifdef CONFIG_TUNER | 124 | #ifdef CONFIG_TUNER |
@@ -966,7 +966,7 @@ static bool dirbrowse(void) | |||
966 | #endif | 966 | #endif |
967 | reload_dir = true; | 967 | reload_dir = true; |
968 | #endif | 968 | #endif |
969 | #ifdef HAVE_LCD_COLOR | 969 | #if LCD_DEPTH > 1 |
970 | show_main_backdrop(); | 970 | show_main_backdrop(); |
971 | #endif | 971 | #endif |
972 | #ifdef HAVE_TAGCACHE | 972 | #ifdef HAVE_TAGCACHE |
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 5ca0426d12..54357433b9 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -44,6 +44,9 @@ static const unsigned char pixmask[4] ICONST_ATTR = { | |||
44 | 0xC0, 0x30, 0x0C, 0x03 | 44 | 0xC0, 0x30, 0x0C, 0x03 |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static fb_data* lcd_backdrop = NULL; | ||
48 | static long lcd_backdrop_offset IDATA_ATTR = 0; | ||
49 | |||
47 | static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ | 50 | static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ |
48 | static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ | 51 | static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ |
49 | static int drawmode = DRMODE_SOLID; | 52 | static int drawmode = DRMODE_SOLID; |
@@ -164,6 +167,15 @@ static void clearpixel(int x, int y) | |||
164 | *address = data ^ ((data ^ bg_pattern) & mask); | 167 | *address = data ^ ((data ^ bg_pattern) & mask); |
165 | } | 168 | } |
166 | 169 | ||
170 | static void clearimgpixel(int x, int y) | ||
171 | { | ||
172 | unsigned mask = pixmask[x & 3]; | ||
173 | fb_data *address = &lcd_framebuffer[y][x>>2]; | ||
174 | unsigned data = *address; | ||
175 | |||
176 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask); | ||
177 | } | ||
178 | |||
167 | static void flippixel(int x, int y) | 179 | static void flippixel(int x, int y) |
168 | { | 180 | { |
169 | unsigned mask = pixmask[x & 3]; | 181 | unsigned mask = pixmask[x & 3]; |
@@ -178,11 +190,19 @@ static void nopixel(int x, int y) | |||
178 | (void)y; | 190 | (void)y; |
179 | } | 191 | } |
180 | 192 | ||
181 | lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { | 193 | lcd_pixelfunc_type* const lcd_pixelfuncs_bgcolor[8] = { |
182 | flippixel, nopixel, setpixel, setpixel, | 194 | flippixel, nopixel, setpixel, setpixel, |
183 | nopixel, clearpixel, nopixel, clearpixel | 195 | nopixel, clearpixel, nopixel, clearpixel |
184 | }; | 196 | }; |
185 | 197 | ||
198 | lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = { | ||
199 | flippixel, nopixel, setpixel, setpixel, | ||
200 | nopixel, clearimgpixel, nopixel, clearimgpixel | ||
201 | }; | ||
202 | |||
203 | lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | ||
204 | |||
205 | |||
186 | /* 'mask' and 'bits' contain 2 bits per pixel */ | 206 | /* 'mask' and 'bits' contain 2 bits per pixel */ |
187 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | 207 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) |
188 | ICODE_ATTR; | 208 | ICODE_ATTR; |
@@ -200,6 +220,15 @@ static void bgblock(fb_data *address, unsigned mask, unsigned bits) | |||
200 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); | 220 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); |
201 | } | 221 | } |
202 | 222 | ||
223 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
224 | ICODE_ATTR; | ||
225 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
226 | { | ||
227 | unsigned data = *address; | ||
228 | |||
229 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); | ||
230 | } | ||
231 | |||
203 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 232 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) |
204 | ICODE_ATTR; | 233 | ICODE_ATTR; |
205 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 234 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) |
@@ -220,6 +249,17 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits) | |||
220 | *address = data ^ ((data ^ bits) & mask); | 249 | *address = data ^ ((data ^ bits) & mask); |
221 | } | 250 | } |
222 | 251 | ||
252 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
253 | ICODE_ATTR; | ||
254 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
255 | { | ||
256 | unsigned data = *address; | ||
257 | unsigned bgp = *(address + lcd_backdrop_offset); | ||
258 | |||
259 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | ||
260 | *address = data ^ ((data ^ bits) & mask); | ||
261 | } | ||
262 | |||
223 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 263 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) |
224 | ICODE_ATTR; | 264 | ICODE_ATTR; |
225 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 265 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) |
@@ -236,6 +276,15 @@ static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | |||
236 | *address = data ^ ((data ^ bg_pattern) & mask & bits); | 276 | *address = data ^ ((data ^ bg_pattern) & mask & bits); |
237 | } | 277 | } |
238 | 278 | ||
279 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
280 | ICODE_ATTR; | ||
281 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
282 | { | ||
283 | unsigned data = *address; | ||
284 | |||
285 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); | ||
286 | } | ||
287 | |||
239 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 288 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) |
240 | ICODE_ATTR; | 289 | ICODE_ATTR; |
241 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 290 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) |
@@ -256,11 +305,53 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | |||
256 | *address = data ^ ((data ^ bits) & mask); | 305 | *address = data ^ ((data ^ bits) & mask); |
257 | } | 306 | } |
258 | 307 | ||
259 | lcd_blockfunc_type* const lcd_blockfuncs[8] = { | 308 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) |
309 | ICODE_ATTR; | ||
310 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
311 | { | ||
312 | unsigned data = *address; | ||
313 | unsigned fgp = fg_pattern; | ||
314 | |||
315 | bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); | ||
316 | *address = data ^ ((data ^ bits) & mask); | ||
317 | } | ||
318 | |||
319 | lcd_blockfunc_type* const lcd_blockfuncs_bgcolor[8] = { | ||
260 | flipblock, bgblock, fgblock, solidblock, | 320 | flipblock, bgblock, fgblock, solidblock, |
261 | flipinvblock, bginvblock, fginvblock, solidinvblock | 321 | flipinvblock, bginvblock, fginvblock, solidinvblock |
262 | }; | 322 | }; |
263 | 323 | ||
324 | lcd_blockfunc_type* const lcd_blockfuncs_backdrop[8] = { | ||
325 | flipblock, bgimgblock, fgblock, solidimgblock, | ||
326 | flipinvblock, bgimginvblock, fginvblock, solidimginvblock | ||
327 | }; | ||
328 | |||
329 | lcd_blockfunc_type* const * lcd_blockfuncs = lcd_blockfuncs_bgcolor; | ||
330 | |||
331 | |||
332 | void lcd_set_backdrop(fb_data* backdrop) | ||
333 | { | ||
334 | lcd_backdrop = backdrop; | ||
335 | if (backdrop) | ||
336 | { | ||
337 | lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer; | ||
338 | lcd_pixelfuncs = lcd_pixelfuncs_backdrop; | ||
339 | lcd_blockfuncs = lcd_blockfuncs_backdrop; | ||
340 | } | ||
341 | else | ||
342 | { | ||
343 | lcd_backdrop_offset = 0; | ||
344 | lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | ||
345 | lcd_blockfuncs = lcd_blockfuncs_bgcolor; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | fb_data* lcd_get_backdrop(void) | ||
350 | { | ||
351 | return lcd_backdrop; | ||
352 | } | ||
353 | |||
354 | |||
264 | static inline void setblock(fb_data *address, unsigned mask, unsigned bits) | 355 | static inline void setblock(fb_data *address, unsigned mask, unsigned bits) |
265 | { | 356 | { |
266 | unsigned data = *address; | 357 | unsigned data = *address; |
@@ -274,9 +365,17 @@ static inline void setblock(fb_data *address, unsigned mask, unsigned bits) | |||
274 | /* Clear the whole display */ | 365 | /* Clear the whole display */ |
275 | void lcd_clear_display(void) | 366 | void lcd_clear_display(void) |
276 | { | 367 | { |
277 | unsigned bits = (drawmode & DRMODE_INVERSEVID) ? fg_pattern : bg_pattern; | 368 | if (drawmode & DRMODE_INVERSEVID) |
278 | 369 | { | |
279 | memset(lcd_framebuffer, bits, sizeof lcd_framebuffer); | 370 | memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer); |
371 | } | ||
372 | else | ||
373 | { | ||
374 | if (lcd_backdrop) | ||
375 | memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer); | ||
376 | else | ||
377 | memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer); | ||
378 | } | ||
280 | scrolling_lines = 0; | 379 | scrolling_lines = 0; |
281 | } | 380 | } |
282 | 381 | ||
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index 799865c36d..ec20068d95 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c | |||
@@ -48,6 +48,9 @@ static const unsigned char pixmask[4] ICONST_ATTR = { | |||
48 | 0x03, 0x0C, 0x30, 0xC0 | 48 | 0x03, 0x0C, 0x30, 0xC0 |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static fb_data* lcd_backdrop = NULL; | ||
52 | static long lcd_backdrop_offset IDATA_ATTR = 0; | ||
53 | |||
51 | static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ | 54 | static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ |
52 | static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ | 55 | static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ |
53 | static int drawmode = DRMODE_SOLID; | 56 | static int drawmode = DRMODE_SOLID; |
@@ -167,6 +170,15 @@ static void clearpixel(int x, int y) | |||
167 | *address = data ^ ((data ^ bg_pattern) & mask); | 170 | *address = data ^ ((data ^ bg_pattern) & mask); |
168 | } | 171 | } |
169 | 172 | ||
173 | static void clearimgpixel(int x, int y) | ||
174 | { | ||
175 | unsigned mask = pixmask[y & 3]; | ||
176 | fb_data *address = &lcd_framebuffer[y>>2][x]; | ||
177 | unsigned data = *address; | ||
178 | |||
179 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask); | ||
180 | } | ||
181 | |||
170 | static void flippixel(int x, int y) | 182 | static void flippixel(int x, int y) |
171 | { | 183 | { |
172 | unsigned mask = pixmask[y & 3]; | 184 | unsigned mask = pixmask[y & 3]; |
@@ -181,11 +193,19 @@ static void nopixel(int x, int y) | |||
181 | (void)y; | 193 | (void)y; |
182 | } | 194 | } |
183 | 195 | ||
184 | lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { | 196 | lcd_pixelfunc_type* const lcd_pixelfuncs_bgcolor[8] = { |
185 | flippixel, nopixel, setpixel, setpixel, | 197 | flippixel, nopixel, setpixel, setpixel, |
186 | nopixel, clearpixel, nopixel, clearpixel | 198 | nopixel, clearpixel, nopixel, clearpixel |
187 | }; | 199 | }; |
188 | 200 | ||
201 | lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = { | ||
202 | flippixel, nopixel, setpixel, setpixel, | ||
203 | nopixel, clearimgpixel, nopixel, clearimgpixel | ||
204 | }; | ||
205 | |||
206 | |||
207 | lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | ||
208 | |||
189 | /* 'mask' and 'bits' contain 2 bits per pixel */ | 209 | /* 'mask' and 'bits' contain 2 bits per pixel */ |
190 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | 210 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) |
191 | ICODE_ATTR; | 211 | ICODE_ATTR; |
@@ -203,6 +223,15 @@ static void bgblock(fb_data *address, unsigned mask, unsigned bits) | |||
203 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); | 223 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); |
204 | } | 224 | } |
205 | 225 | ||
226 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
227 | ICODE_ATTR; | ||
228 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
229 | { | ||
230 | unsigned data = *address; | ||
231 | |||
232 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); | ||
233 | } | ||
234 | |||
206 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 235 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) |
207 | ICODE_ATTR; | 236 | ICODE_ATTR; |
208 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 237 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) |
@@ -223,6 +252,17 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits) | |||
223 | *address = data ^ ((data ^ bits) & mask); | 252 | *address = data ^ ((data ^ bits) & mask); |
224 | } | 253 | } |
225 | 254 | ||
255 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
256 | ICODE_ATTR; | ||
257 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
258 | { | ||
259 | unsigned data = *address; | ||
260 | unsigned bgp = *(address + lcd_backdrop_offset); | ||
261 | |||
262 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | ||
263 | *address = data ^ ((data ^ bits) & mask); | ||
264 | } | ||
265 | |||
226 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 266 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) |
227 | ICODE_ATTR; | 267 | ICODE_ATTR; |
228 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 268 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) |
@@ -239,6 +279,15 @@ static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | |||
239 | *address = data ^ ((data ^ bg_pattern) & mask & bits); | 279 | *address = data ^ ((data ^ bg_pattern) & mask & bits); |
240 | } | 280 | } |
241 | 281 | ||
282 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
283 | ICODE_ATTR; | ||
284 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
285 | { | ||
286 | unsigned data = *address; | ||
287 | |||
288 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); | ||
289 | } | ||
290 | |||
242 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 291 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) |
243 | ICODE_ATTR; | 292 | ICODE_ATTR; |
244 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 293 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) |
@@ -259,11 +308,53 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | |||
259 | *address = data ^ ((data ^ bits) & mask); | 308 | *address = data ^ ((data ^ bits) & mask); |
260 | } | 309 | } |
261 | 310 | ||
262 | lcd_blockfunc_type* const lcd_blockfuncs[8] = { | 311 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) |
312 | ICODE_ATTR; | ||
313 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
314 | { | ||
315 | unsigned data = *address; | ||
316 | unsigned fgp = fg_pattern; | ||
317 | |||
318 | bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); | ||
319 | *address = data ^ ((data ^ bits) & mask); | ||
320 | } | ||
321 | |||
322 | lcd_blockfunc_type* const lcd_blockfuncs_bgcolor[8] = { | ||
263 | flipblock, bgblock, fgblock, solidblock, | 323 | flipblock, bgblock, fgblock, solidblock, |
264 | flipinvblock, bginvblock, fginvblock, solidinvblock | 324 | flipinvblock, bginvblock, fginvblock, solidinvblock |
265 | }; | 325 | }; |
266 | 326 | ||
327 | lcd_blockfunc_type* const lcd_blockfuncs_backdrop[8] = { | ||
328 | flipblock, bgimgblock, fgblock, solidimgblock, | ||
329 | flipinvblock, bgimginvblock, fginvblock, solidimginvblock | ||
330 | }; | ||
331 | |||
332 | lcd_blockfunc_type* const * lcd_blockfuncs = lcd_blockfuncs_bgcolor; | ||
333 | |||
334 | |||
335 | void lcd_set_backdrop(fb_data* backdrop) | ||
336 | { | ||
337 | lcd_backdrop = backdrop; | ||
338 | if (backdrop) | ||
339 | { | ||
340 | lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer; | ||
341 | lcd_pixelfuncs = lcd_pixelfuncs_backdrop; | ||
342 | lcd_blockfuncs = lcd_blockfuncs_backdrop; | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | lcd_backdrop_offset = 0; | ||
347 | lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | ||
348 | lcd_blockfuncs = lcd_blockfuncs_bgcolor; | ||
349 | } | ||
350 | } | ||
351 | |||
352 | fb_data* lcd_get_backdrop(void) | ||
353 | { | ||
354 | return lcd_backdrop; | ||
355 | } | ||
356 | |||
357 | |||
267 | static inline void setblock(fb_data *address, unsigned mask, unsigned bits) | 358 | static inline void setblock(fb_data *address, unsigned mask, unsigned bits) |
268 | { | 359 | { |
269 | unsigned data = *address; | 360 | unsigned data = *address; |
@@ -277,9 +368,17 @@ static inline void setblock(fb_data *address, unsigned mask, unsigned bits) | |||
277 | /* Clear the whole display */ | 368 | /* Clear the whole display */ |
278 | void lcd_clear_display(void) | 369 | void lcd_clear_display(void) |
279 | { | 370 | { |
280 | unsigned bits = (drawmode & DRMODE_INVERSEVID) ? fg_pattern : bg_pattern; | 371 | if (drawmode & DRMODE_INVERSEVID) |
281 | 372 | { | |
282 | memset(lcd_framebuffer, bits, sizeof lcd_framebuffer); | 373 | memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer); |
374 | } | ||
375 | else | ||
376 | { | ||
377 | if (lcd_backdrop) | ||
378 | memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer); | ||
379 | else | ||
380 | memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer); | ||
381 | } | ||
283 | scrolling_lines = 0; | 382 | scrolling_lines = 0; |
284 | } | 383 | } |
285 | 384 | ||
@@ -487,7 +586,7 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
487 | 586 | ||
488 | if (drawmode & DRMODE_INVERSEVID) | 587 | if (drawmode & DRMODE_INVERSEVID) |
489 | { | 588 | { |
490 | if (drawmode & DRMODE_BG) | 589 | if ((drawmode & DRMODE_BG) && !lcd_backdrop) |
491 | { | 590 | { |
492 | fillopt = true; | 591 | fillopt = true; |
493 | bits = bg_pattern; | 592 | bits = bg_pattern; |
@@ -1090,4 +1189,3 @@ static void scroll_thread(void) | |||
1090 | sleep(scroll_ticks); | 1189 | sleep(scroll_ticks); |
1091 | } | 1190 | } |
1092 | } | 1191 | } |
1093 | |||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index a39147628d..ceb0f6e3d2 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -310,10 +310,14 @@ extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *stri | |||
310 | int style, int offset); | 310 | int style, int offset); |
311 | 311 | ||
312 | /* low level drawing function pointer arrays */ | 312 | /* low level drawing function pointer arrays */ |
313 | #if LCD_DEPTH >= 8 | ||
314 | extern lcd_fastpixelfunc_type* const *lcd_fastpixelfuncs; | ||
315 | #elif LCD_DEPTH > 1 | ||
316 | extern lcd_pixelfunc_type* const *lcd_pixelfuncs; | ||
317 | extern lcd_blockfunc_type* const *lcd_blockfuncs; | ||
318 | #else | ||
313 | extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; | 319 | extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; |
314 | extern lcd_blockfunc_type* const lcd_blockfuncs[8]; | 320 | extern lcd_blockfunc_type* const lcd_blockfuncs[8]; |
315 | #if LCD_DEPTH >= 8 | ||
316 | extern lcd_fastpixelfunc_type* const * lcd_fastpixelfuncs; | ||
317 | #endif | 321 | #endif |
318 | 322 | ||
319 | extern void lcd_drawpixel(int x, int y); | 323 | extern void lcd_drawpixel(int x, int y); |
@@ -339,10 +343,8 @@ extern void lcd_set_background(unsigned background); | |||
339 | extern unsigned lcd_get_background(void); | 343 | extern unsigned lcd_get_background(void); |
340 | extern void lcd_set_drawinfo(int mode, unsigned foreground, | 344 | extern void lcd_set_drawinfo(int mode, unsigned foreground, |
341 | unsigned background); | 345 | unsigned background); |
342 | #ifdef HAVE_LCD_COLOR | ||
343 | void lcd_set_backdrop(fb_data* backdrop); | 346 | void lcd_set_backdrop(fb_data* backdrop); |
344 | fb_data* lcd_get_backdrop(void); | 347 | fb_data* lcd_get_backdrop(void); |
345 | #endif | ||
346 | 348 | ||
347 | extern void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | 349 | extern void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, |
348 | int stride, int x, int y, int width, int height); | 350 | int stride, int x, int y, int width, int height); |