summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-1bit-vert.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-1bit-vert.c')
-rw-r--r--firmware/drivers/lcd-1bit-vert.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index fd77ba7578..3a90856819 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -37,14 +37,16 @@
37#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */ 37#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
38#define LCDFN(fn) lcd_ ## fn 38#define LCDFN(fn) lcd_ ## fn
39#define FBFN(fn) fb_ ## fn 39#define FBFN(fn) fb_ ## fn
40#define FBSIZE FRAMEBUFFER_SIZE
40#define LCDM(ma) LCD_ ## ma 41#define LCDM(ma) LCD_ ## ma
41#define LCDNAME "lcd_" 42#define LCDNAME "lcd_"
43#define LCDFB(x,y) FBADDR(x, y)
42#define MAIN_LCD 44#define MAIN_LCD
43#endif 45#endif
44 46
45/*** globals ***/ 47/*** globals ***/
46 48FBFN(data) LCDFN(static_framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
47FBFN(data) LCDFN(framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER; 49FBFN(data) *LCDFN(framebuffer) = &LCDFN(static_framebuffer)[0][0];
48 50
49static struct viewport default_vp = 51static struct viewport default_vp =
50{ 52{
@@ -152,17 +154,17 @@ int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
152 154
153static void setpixel(int x, int y) 155static void setpixel(int x, int y)
154{ 156{
155 LCDFN(framebuffer)[y>>3][x] |= BIT_N(y & 7); 157 *LCDFB(x,y>>3) |= BIT_N(y & 7);
156} 158}
157 159
158static void clearpixel(int x, int y) 160static void clearpixel(int x, int y)
159{ 161{
160 LCDFN(framebuffer)[y>>3][x] &= ~BIT_N(y & 7); 162 *LCDFB(x,y>>3) &= ~BIT_N(y & 7);
161} 163}
162 164
163static void flippixel(int x, int y) 165static void flippixel(int x, int y)
164{ 166{
165 LCDFN(framebuffer)[y>>3][x] ^= BIT_N(y & 7); 167 *LCDFB(x,y>>3) ^= BIT_N(y & 7);
166} 168}
167 169
168static void nopixel(int x, int y) 170static void nopixel(int x, int y)
@@ -242,7 +244,7 @@ void LCDFN(clear_display)(void)
242{ 244{
243 unsigned bits = (current_vp->drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0; 245 unsigned bits = (current_vp->drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
244 246
245 memset(LCDFN(framebuffer), bits, sizeof LCDFN(framebuffer)); 247 memset(LCDFN(framebuffer), bits, FBSIZE);
246 LCDFN(scroll_info).lines = 0; 248 LCDFN(scroll_info).lines = 0;
247} 249}
248 250
@@ -422,7 +424,7 @@ void LCDFN(hline)(int x1, int x2, int y)
422 width = x2 - x1 + 1; 424 width = x2 - x1 + 1;
423 425
424 bfunc = LCDFN(blockfuncs)[current_vp->drawmode]; 426 bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
425 dst = &LCDFN(framebuffer)[y>>3][x1]; 427 dst = LCDFB(x1,y>>3);
426 mask = BIT_N(y & 7); 428 mask = BIT_N(y & 7);
427 429
428 dst_end = dst + width; 430 dst_end = dst + width;
@@ -478,7 +480,7 @@ void LCDFN(vline)(int x, int y1, int y2)
478#endif 480#endif
479 481
480 bfunc = LCDFN(blockfuncs)[current_vp->drawmode]; 482 bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
481 dst = &LCDFN(framebuffer)[y1>>3][x]; 483 dst = LCDFB(x,y1>>3);
482 ny = y2 - (y1 & ~7); 484 ny = y2 - (y1 & ~7);
483 mask = 0xFFu << (y1 & 7); 485 mask = 0xFFu << (y1 & 7);
484 mask_bottom = 0xFFu >> (~ny & 7); 486 mask_bottom = 0xFFu >> (~ny & 7);
@@ -583,7 +585,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
583 } 585 }
584 } 586 }
585 bfunc = LCDFN(blockfuncs)[current_vp->drawmode]; 587 bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
586 dst = &LCDFN(framebuffer)[y>>3][x]; 588 dst = LCDFB(x,y>>3);
587 ny = height - 1 + (y & 7); 589 ny = height - 1 + (y & 7);
588 mask = 0xFFu << (y & 7); 590 mask = 0xFFu << (y & 7);
589 mask_bottom = 0xFFu >> (~ny & 7); 591 mask_bottom = 0xFFu >> (~ny & 7);
@@ -696,7 +698,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
696 src += stride * (src_y >> 3) + src_x; /* move starting point */ 698 src += stride * (src_y >> 3) + src_x; /* move starting point */
697 src_y &= 7; 699 src_y &= 7;
698 y -= src_y; 700 y -= src_y;
699 dst = &LCDFN(framebuffer)[y>>3][x]; 701 dst = LCDFB(x,y>>3);
700 shift = y & 7; 702 shift = y & 7;
701 ny = height - 1 + shift + src_y; 703 ny = height - 1 + shift + src_y;
702 704