summaryrefslogtreecommitdiff
path: root/firmware/export/lcd-remote.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/lcd-remote.h')
-rw-r--r--firmware/export/lcd-remote.h74
1 files changed, 38 insertions, 36 deletions
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 1819a4de72..030b01c736 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -34,29 +34,12 @@
34#define REMOTETYPE_H100_LCD 1 34#define REMOTETYPE_H100_LCD 1
35#define REMOTETYPE_H300_LCD 2 35#define REMOTETYPE_H300_LCD 2
36#define REMOTETYPE_H300_NONLCD 3 36#define REMOTETYPE_H300_NONLCD 3
37int remote_type(void); 37 int remote_type(void);
38#endif
39
40#if LCD_REMOTE_DEPTH <= 8
41#if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
42 || (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
43typedef unsigned short fb_remote_data;
44#define FB_RDATA_SZ 2
45#else
46typedef unsigned char fb_remote_data;
47#define FB_RDATA_SZ 1
48#endif
49#elif LCD_DEPTH <= 16
50typedef unsigned short fb_remote_data;
51#define FB_RDATA_SZ 2
52#else
53typedef unsigned long fb_remote_data;
54#define FB_RDATA_SZ 4
55#endif 38#endif
56 39
57#if LCD_REMOTE_DEPTH > 1 /* greyscale - 8 bit max */ 40#if LCD_REMOTE_DEPTH > 1 /* greyscale - 8 bit max */
58#ifdef HAVE_LCD_COLOR 41#ifdef HAVE_LCD_COLOR
59extern unsigned lcd_remote_color_to_native(unsigned color); 42 extern unsigned lcd_remote_color_to_native(unsigned color);
60#endif 43#endif
61 44
62#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1) 45#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
@@ -77,12 +60,19 @@ extern unsigned lcd_remote_color_to_native(unsigned color);
77 60
78/* Frame buffer dimensions (format checks only cover existing targets!) */ 61/* Frame buffer dimensions (format checks only cover existing targets!) */
79#if LCD_REMOTE_DEPTH == 1 62#if LCD_REMOTE_DEPTH == 1
80#define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8) 63#define LCD_REMOTE_STRIDE(w, h) (h)
64#define LCD_REMOTE_FBSTRIDE(w, h) ((h+7)/8)
65#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_FBSTRIDE(LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT)
66#define LCD_REMOTE_NBELEMS(w, h) (((w*LCD_REMOTE_FBSTRIDE(w, h)) + h) / sizeof(fb_remote_data))
81#elif LCD_REMOTE_DEPTH == 2 67#elif LCD_REMOTE_DEPTH == 2
82#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED 68#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
83#define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8) 69#define LCD_REMOTE_STRIDE(w, h) (h)
70#define LCD_REMOTE_FBSTRIDE(w, h) ((h+7)/8)
71#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_FBSTRIDE(LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT)
72#define LCD_REMOTE_NBELEMS(w, h) (((w*LCD_REMOTE_FBSTRIDE(w, h)) + h) / sizeof(fb_remote_data))
84#endif 73#endif
85#endif /* LCD_REMOTE_DEPTH */ 74#endif /* LCD_REMOTE_DEPTH */
75
86/* Set defaults if not defined different yet. The defaults apply to both 76/* Set defaults if not defined different yet. The defaults apply to both
87 * dimensions for LCD_REMOTE_DEPTH >= 8 */ 77 * dimensions for LCD_REMOTE_DEPTH >= 8 */
88#ifndef LCD_REMOTE_FBWIDTH 78#ifndef LCD_REMOTE_FBWIDTH
@@ -92,11 +82,20 @@ extern unsigned lcd_remote_color_to_native(unsigned color);
92#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_HEIGHT 82#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_HEIGHT
93#endif 83#endif
94 84
95/* The actual framebuffer */ 85#ifndef LCD_REMOTE_NBELEMS
96extern fb_remote_data *lcd_remote_framebuffer; 86/* At this time (2020) known remote screens only have vertical stride */
97extern fb_remote_data lcd_remote_static_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; 87#define LCD_REMOTE_NBELEMS(w, h) ((w*STRIDE_REMOTE(w, h)) + h) / sizeof(fb_remote_data))
98#define FBREMOTEADDR(x, y) (lcd_remote_framebuffer + ((y) * LCD_REMOTE_FBWIDTH) + (x)) 88#define LCD_REMOTE_STRIDE(w, h) STRIDE_REMOTE(w, h)
99#define FRAMEBUFFER_REMOTE_SIZE (sizeof(lcd_remote_static_framebuffer)) 89#define LCD_REMOTE_FBSTRIDE(w, h) STRIDE_REMOTE(w, h)
90#endif
91
92#ifndef LCD_REMOTE_NATIVE_STRIDE
93#define LCD_REMOTE_NATIVE_STRIDE(s) (s)
94#endif
95
96extern struct viewport* lcd_remote_current_viewport;
97#define FBREMOTEADDR(x,y) (fb_remote_data *)(lcd_remote_current_viewport->buffer->get_address_fn(x, y))
98#define FRAMEBUFFER_REMOTE_SIZE (sizeof(fb_remote_data)*LCD_REMOTE_FBWIDTH*LCD_REMOTE_FBHEIGHT)
100 99
101#if LCD_REMOTE_DEPTH > 1 100#if LCD_REMOTE_DEPTH > 1
102extern void lcd_remote_set_foreground(unsigned foreground); 101extern void lcd_remote_set_foreground(unsigned foreground);
@@ -112,13 +111,13 @@ extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
112 int src_y, int stride, int x, int y, 111 int src_y, int stride, int x, int y,
113 int width, int height); 112 int width, int height);
114extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y, 113extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y,
115 int width, int height); 114 int width, int height);
116extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src, 115extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src,
117 int src_x, int src_y, 116 int src_x, int src_y,
118 int stride, int x, int y, 117 int stride, int x, int y,
119 int width, int height); 118 int width, int height);
120extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x, 119extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
121 int y, int width, int height); 120 int y, int width, int height);
122#else /* LCD_REMOTE_DEPTH == 1 */ 121#else /* LCD_REMOTE_DEPTH == 1 */
123#define lcd_remote_mono_bitmap lcd_remote_bitmap 122#define lcd_remote_mono_bitmap lcd_remote_bitmap
124#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part 123#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
@@ -137,7 +136,7 @@ extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
137extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y, 136extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y,
138 int width, int height); 137 int width, int height);
139extern void lcd_remote_nine_segment_bmp(const struct bitmap* bm, int x, int y, 138extern void lcd_remote_nine_segment_bmp(const struct bitmap* bm, int x, int y,
140 int width, int height); 139 int width, int height);
141 140
142/* Low-level drawing function types */ 141/* Low-level drawing function types */
143typedef void lcd_remote_pixelfunc_type(int x, int y); 142typedef void lcd_remote_pixelfunc_type(int x, int y);
@@ -146,17 +145,17 @@ typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
146 145
147/* low level drawing function pointer arrays */ 146/* low level drawing function pointer arrays */
148#if LCD_REMOTE_DEPTH > 1 147#if LCD_REMOTE_DEPTH > 1
149extern lcd_remote_pixelfunc_type* const *lcd_remote_pixelfuncs; 148 extern lcd_remote_pixelfunc_type* const *lcd_remote_pixelfuncs;
150extern lcd_remote_blockfunc_type* const *lcd_remote_blockfuncs; 149 extern lcd_remote_blockfunc_type* const *lcd_remote_blockfuncs;
151#else 150#else
152extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8]; 151 extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8];
153extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8]; 152 extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8];
154#endif 153#endif
155 154
156#endif /* HAVE_LCD_REMOTE */ 155#endif /* HAVE_LCD_REMOTE */
157 156
158#ifdef HAVE_REMOTE_LCD_TICKING 157#ifdef HAVE_REMOTE_LCD_TICKING
159void lcd_remote_emireduce(bool state); 158 void lcd_remote_emireduce(bool state);
160#endif 159#endif
161 160
162void lcd_remote_init_device(void); 161void lcd_remote_init_device(void);
@@ -170,7 +169,10 @@ extern void lcd_remote_init(void);
170extern int lcd_remote_default_contrast(void); 169extern int lcd_remote_default_contrast(void);
171extern void lcd_remote_set_contrast(int val); 170extern void lcd_remote_set_contrast(int val);
172 171
173extern void lcd_remote_set_viewport(struct viewport* vp); 172extern struct viewport* lcd_remote_init_viewport(struct viewport* vp);
173extern struct viewport* lcd_remote_set_viewport(struct viewport* vp);
174extern struct viewport* lcd_remote_set_viewport_ex(struct viewport* vp, int flags);
175
174extern void lcd_remote_clear_display(void); 176extern void lcd_remote_clear_display(void);
175extern void lcd_remote_clear_viewport(void); 177extern void lcd_remote_clear_viewport(void);
176extern void lcd_remote_puts(int x, int y, const unsigned char *str); 178extern void lcd_remote_puts(int x, int y, const unsigned char *str);
@@ -212,7 +214,7 @@ extern void lcd_remote_bidir_scroll(int threshold);
212extern void lcd_remote_scroll_step(int pixels); 214extern void lcd_remote_scroll_step(int pixels);
213 215
214extern void lcd_remote_bmp_part(const struct bitmap* bm, int src_x, int src_y, 216extern void lcd_remote_bmp_part(const struct bitmap* bm, int src_x, int src_y,
215 int x, int y, int width, int height); 217 int x, int y, int width, int height);
216extern void lcd_remote_bmp(const struct bitmap* bm, int x, int y); 218extern void lcd_remote_bmp(const struct bitmap* bm, int x, int y);
217 219
218#endif /* __LCD_REMOTE_H__ */ 220#endif /* __LCD_REMOTE_H__ */