summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/lcd.h81
1 files changed, 62 insertions, 19 deletions
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 3f3d8f875f..c301c4c0d1 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -46,6 +46,68 @@ struct viewport {
46#endif 46#endif
47}; 47};
48 48
49/* Frame buffer stride
50 *
51 * Stride describes the amount that you need to increment to get to the next
52 * line. For screens that have the pixels in contiguous horizontal strips
53 * stride should be equal to the image width.
54 *
55 * For example, if the screen pixels are layed out as follows:
56 *
57 * width0 width1 width2 widthX-1
58 * ------ ------ ------ ------------------ --------
59 * height0 | pixel0 pixel1 pixel2 ----------------> pixelX-1
60 * height1 | pixelX
61 *
62 * then you need to add X pixels to get to the next line. (the next line
63 * in this case is height1).
64 *
65 * Similarly, if the screens is has the pixels in contiguous vertical strips
66 * the stride would be equal to the image height.
67 *
68 * For example if the screen pixels are layed out as follows:
69 *
70 * width0 width1
71 * ------ ------
72 * height0 | pixel0 pixelY
73 * height1 | pixel1
74 * height2 | pixel2
75 * | | |
76 * \|/ | \|/
77 * heightY-1 | pixelY-1
78 *
79 * then you would need to add Y pixels to get to the next line (the next
80 * line in this case is from width0 to width1).
81 *
82 * The remote might have a different stride than the main screen so the screen
83 * number needs to be passed to the STRIDE macro so that the appropriate height
84 * or width can be passed to the lcd_bitmap, or lcd_remote_bitmap calls.
85 *
86 * STRIDE_REMOTE and STRIDE_MAIN should never used when it is not clear whether
87 * lcd_remote_bitmap calls or lcd_bitmap calls are being made (for example the
88 * screens api).
89 *
90 * Screen should always use the screen_type enum that is at the top of this
91 * header.
92 */
93enum screen_type {
94 SCREEN_MAIN
95#ifdef HAVE_REMOTE_LCD
96 ,SCREEN_REMOTE
97#endif
98};
99
100#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
101#define STRIDE_MAIN(w, h) (h)
102#else
103#define STRIDE_MAIN(w, h) (w)
104#endif
105
106#define STRIDE_REMOTE(w, h) (w)
107
108#define STRIDE(screen, w, h) (screen==SCREEN_MAIN?STRIDE_MAIN((w), \
109 (h)):STRIDE_REMOTE((w),(h)))
110
49#define STYLE_DEFAULT 0x00000000 111#define STYLE_DEFAULT 0x00000000
50#define STYLE_COLORED 0x10000000 112#define STYLE_COLORED 0x10000000
51#define STYLE_INVERT 0x20000000 113#define STYLE_INVERT 0x20000000
@@ -306,25 +368,6 @@ static inline unsigned lcd_color_to_native(unsigned color)
306 368
307#endif /* HAVE_LCD_COLOR */ 369#endif /* HAVE_LCD_COLOR */
308 370
309enum screen_type {
310 SCREEN_MAIN
311#ifdef HAVE_REMOTE_LCD
312 ,SCREEN_REMOTE
313#endif
314};
315
316/* Frame buffer stride */
317#define STRIDE_REMOTE(w, h) (w)
318
319#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
320#define STRIDE_MAIN(w, h) (h)
321#else
322#define STRIDE_MAIN(w, h) (w)
323#endif
324
325#define STRIDE(screen, w, h) (screen==SCREEN_MAIN?STRIDE_MAIN((w), \
326 (h)):STRIDE_REMOTE((w),(h)))
327
328/* Frame buffer dimensions */ 371/* Frame buffer dimensions */
329#if LCD_DEPTH == 1 372#if LCD_DEPTH == 1
330#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 373#if LCD_PIXELFORMAT == HORIZONTAL_PACKING