summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/lcd-remote.h16
-rw-r--r--firmware/export/lcd.h23
2 files changed, 28 insertions, 11 deletions
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 5f1551e395..13d78ac428 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -60,9 +60,18 @@ typedef void lcd_remote_pixelfunc_type(int x, int y);
60typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask, 60typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
61 unsigned bits); 61 unsigned bits);
62 62
63#if LCD_REMOTE_DEPTH > 1 /* greyscale */ 63#if LCD_REMOTE_DEPTH > 1 /* greyscale - 8 bit max */
64#ifdef HAVE_LCD_COLOR
65extern unsigned lcd_remote_color_to_native(unsigned color);
66#endif
67
64#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1) 68#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
65#define LCD_REMOTE_BRIGHTNESS(y) (((y) * LCD_REMOTE_MAX_LEVEL + 127) / 255) 69/**
70 * On 2 bit for example (y >> (8-DEPTH)) = (y >> 6) = y/64 gives:
71 * |000-063|064-127|128-191|192-255|
72 * | 0 | 1 | 2 | 3 |
73 */
74#define LCD_REMOTE_BRIGHTNESS(y) ((y) >> (8-LCD_REMOTE_DEPTH))
66 75
67#define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0) 76#define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0)
68#define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85) 77#define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85)
@@ -70,7 +79,6 @@ typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
70#define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255) 79#define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255)
71#define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK 80#define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK
72#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE 81#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
73
74#endif 82#endif
75 83
76/* Memory copy of display bitmap */ 84/* Memory copy of display bitmap */
@@ -91,7 +99,7 @@ extern void lcd_remote_clear_display(void);
91extern void lcd_remote_puts(int x, int y, const unsigned char *str); 99extern void lcd_remote_puts(int x, int y, const unsigned char *str);
92extern void lcd_remote_puts_style(int x, int y, const unsigned char *str, 100extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
93 int style); 101 int style);
94extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, 102extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,
95 int offset); 103 int offset);
96extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, 104extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
97 int style, int offset); 105 int style, int offset);
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 7fe76a5366..4949f51cdb 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -151,6 +151,15 @@ typedef void lcd_fastpixelfunc_type(fb_data *address);
151 151
152#ifdef HAVE_LCD_BITMAP 152#ifdef HAVE_LCD_BITMAP
153 153
154#if defined(HAVE_LCD_COLOR) && LCD_REMOTE_DEPTH > 1
155/* Just return color for screens use */
156static inline unsigned lcd_color_to_native(unsigned color)
157 { return color; }
158#define SCREEN_COLOR_TO_NATIVE(screen, color) (screen)->color_to_native(color)
159#else
160#define SCREEN_COLOR_TO_NATIVE(screen, color) (color)
161#endif
162
154#ifdef HAVE_LCD_COLOR 163#ifdef HAVE_LCD_COLOR
155#if LCD_DEPTH == 16 164#if LCD_DEPTH == 16
156#define LCD_MAX_RED 31 165#define LCD_MAX_RED 31
@@ -169,12 +178,12 @@ typedef void lcd_fastpixelfunc_type(fb_data *address);
169 |((_RGBPACK((r), (g), (b)) & 0x00ff) << 8)) 178 |((_RGBPACK((r), (g), (b)) & 0x00ff) << 8))
170#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(swap16(x)) 179#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(swap16(x))
171#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(swap16(x)) 180#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(swap16(x))
172#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(swap16(x)) 181#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(swap16(x))
173#else 182#else
174#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b)) 183#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b))
175#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x) 184#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x)
176#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x) 185#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x)
177#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x) 186#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x)
178#endif 187#endif
179#elif LCD_DEPTH == 18 188#elif LCD_DEPTH == 18
180#define LCD_MAX_RED 63 189#define LCD_MAX_RED 63
@@ -185,7 +194,7 @@ typedef void lcd_fastpixelfunc_type(fb_data *address);
185 | (((b) * (63*257) + (127*257)) >> 16)) 194 | (((b) * (63*257) + (127*257)) >> 16))
186#else 195#else
187/* other colour depths */ 196/* other colour depths */
188#endif 197#endif
189 198
190#define LCD_BLACK LCD_RGBPACK(0, 0, 0) 199#define LCD_BLACK LCD_RGBPACK(0, 0, 0)
191#define LCD_DARKGRAY LCD_RGBPACK(85, 85, 85) 200#define LCD_DARKGRAY LCD_RGBPACK(85, 85, 85)
@@ -220,7 +229,7 @@ extern fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH];
220extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; 229extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
221#elif LCD_DEPTH == 18 230#elif LCD_DEPTH == 18
222extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; 231extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
223#endif 232#endif
224 233
225#ifndef LCD_FBWIDTH 234#ifndef LCD_FBWIDTH
226#define LCD_FBWIDTH LCD_WIDTH 235#define LCD_FBWIDTH LCD_WIDTH
@@ -273,12 +282,12 @@ extern void lcd_setfont(int font);
273extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); 282extern int lcd_getstringsize(const unsigned char *str, int *w, int *h);
274 283
275extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); 284extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset);
276extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, 285extern void lcd_puts_style_offset(int x, int y, const unsigned char *str,
277 int style, int offset); 286 int style, int offset);
278extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, 287extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
279 int offset); 288 int offset);
280extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, 289extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
281 int style, int offset); 290 int style, int offset);
282 291
283/* low level drawing function pointer arrays */ 292/* low level drawing function pointer arrays */
284extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; 293extern lcd_pixelfunc_type* const lcd_pixelfuncs[8];
@@ -333,7 +342,7 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y,
333#endif /* HAVE_LCD_BITMAP */ 342#endif /* HAVE_LCD_BITMAP */
334 343
335/* internal usage, but in multiple drivers */ 344/* internal usage, but in multiple drivers */
336#ifdef HAVE_LCD_BITMAP 345#ifdef HAVE_LCD_BITMAP
337#define SCROLL_SPACING 3 346#define SCROLL_SPACING 3
338 347
339struct scrollinfo { 348struct scrollinfo {