diff options
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 32 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100.c | 32 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 32 | ||||
-rw-r--r-- | firmware/export/lcd.h | 16 |
4 files changed, 81 insertions, 31 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index bdc5799726..8112aecdb1 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c @@ -500,41 +500,57 @@ lcd_pixelfunc_type* lcd_remote_pixelfuncs[8] = { }; static void flipblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void flipblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= (bits & mask); } static void bgblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void bgblock(unsigned char *address, unsigned mask, unsigned bits) { *address &= (bits | ~mask); } static void fgblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void fgblock(unsigned char *address, unsigned mask, unsigned bits) { *address |= (bits & mask); } static void solidblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void solidblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (bits & mask); } static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= (~bits & mask); } static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) { *address &= ~(bits & mask); } static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) { *address |= (~bits & mask); } static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (~bits & mask); } @@ -707,8 +723,8 @@ void lcd_remote_vline(int x, int y1, int y2) dst += LCD_REMOTE_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; - bfunc(dst, mask_bottom, 0xFFu); + mask &= mask_bottom; + bfunc(dst, mask, 0xFFu); } /* Draw a rectangular box */ @@ -782,14 +798,14 @@ void lcd_remote_fillrect(int x, int y, int width, int height) dst += LCD_REMOTE_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; + mask &= mask_bottom; - if (fillopt && (mask_bottom == 0xFFu)) + if (fillopt && (mask == 0xFFu)) memset(dst, bits, width); else { for (i = width; i > 0; i--) - bfunc(dst++, mask_bottom, 0xFFu); + bfunc(dst++, mask, 0xFFu); } } @@ -871,14 +887,14 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, dst += LCD_REMOTE_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; + mask &= mask_bottom; - if (copyopt && (mask_bottom == 0xFFu)) + if (copyopt && (mask == 0xFFu)) memcpy(dst, src, width); else { for (i = width; i > 0; i--) - bfunc(dst++, mask_bottom, *src++); + bfunc(dst++, mask, *src++); } } else diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c index 929a4fa301..3d858e2271 100644 --- a/firmware/drivers/lcd-h100.c +++ b/firmware/drivers/lcd-h100.c @@ -339,41 +339,57 @@ lcd_pixelfunc_type* lcd_pixelfuncs[8] = { }; static void flipblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void flipblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= (bits & mask); } static void bgblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void bgblock(unsigned char *address, unsigned mask, unsigned bits) { *address &= (bits | ~mask); } static void fgblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void fgblock(unsigned char *address, unsigned mask, unsigned bits) { *address |= (bits & mask); } static void solidblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void solidblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (bits & mask); } static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= (~bits & mask); } static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) { *address &= ~(bits & mask); } static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) { *address |= (~bits & mask); } static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (~bits & mask); } @@ -544,8 +560,8 @@ void lcd_vline(int x, int y1, int y2) dst += LCD_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; - bfunc(dst, mask_bottom, 0xFFu); + mask &= mask_bottom; + bfunc(dst, mask, 0xFFu); } /* Draw a rectangular box */ @@ -619,14 +635,14 @@ void lcd_fillrect(int x, int y, int width, int height) dst += LCD_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; + mask &= mask_bottom; - if (fillopt && (mask_bottom == 0xFFu)) + if (fillopt && (mask == 0xFFu)) memset(dst, bits, width); else { for (i = width; i > 0; i--) - bfunc(dst++, mask_bottom, 0xFFu); + bfunc(dst++, mask, 0xFFu); } } @@ -708,14 +724,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, dst += LCD_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; + mask &= mask_bottom; - if (copyopt && (mask_bottom == 0xFFu)) + if (copyopt && (mask == 0xFFu)) memcpy(dst, src, width); else { for (i = width; i > 0; i--) - bfunc(dst++, mask_bottom, *src++); + bfunc(dst++, mask, *src++); } } else diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 6747f7fcd3..f933e6ca5c 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -396,41 +396,57 @@ lcd_pixelfunc_type* lcd_pixelfuncs[8] = { }; static void flipblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void flipblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= (bits & mask); } static void bgblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void bgblock(unsigned char *address, unsigned mask, unsigned bits) { *address &= (bits | ~mask); } static void fgblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void fgblock(unsigned char *address, unsigned mask, unsigned bits) { *address |= (bits & mask); } static void solidblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void solidblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (bits & mask); } static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= (~bits & mask); } static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) { *address &= ~(bits & mask); } static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) { *address |= (~bits & mask); } static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) + __attribute__ ((section(".icode"))); +static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (~bits & mask); } @@ -601,8 +617,8 @@ void lcd_vline(int x, int y1, int y2) dst += LCD_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; - bfunc(dst, mask_bottom, 0xFFu); + mask &= mask_bottom; + bfunc(dst, mask, 0xFFu); } /* Draw a rectangular box */ @@ -676,14 +692,14 @@ void lcd_fillrect(int x, int y, int width, int height) dst += LCD_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; + mask &= mask_bottom; - if (fillopt && (mask_bottom == 0xFFu)) + if (fillopt && (mask == 0xFFu)) memset(dst, bits, width); else { for (i = width; i > 0; i--) - bfunc(dst++, mask_bottom, 0xFFu); + bfunc(dst++, mask, 0xFFu); } } @@ -765,14 +781,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, dst += LCD_WIDTH; mask = 0xFFu; } - mask_bottom &= mask; + mask &= mask_bottom; - if (copyopt && (mask_bottom == 0xFFu)) + if (copyopt && (mask == 0xFFu)) memcpy(dst, src, width); else { for (i = width; i > 0; i--) - bfunc(dst++, mask_bottom, *src++); + bfunc(dst++, mask, *src++); } } else diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 77e79799f8..5f93e7cbc3 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -113,22 +113,23 @@ extern void lcd_jump_scroll(int mode); /* 0=off, 1=once, ..., ALWAYS */ extern void lcd_jump_scroll_delay(int ms); #endif -#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) - -/* draw modes */ +/* Draw modes */ #define DRMODE_COMPLEMENT 0 #define DRMODE_BG 1 #define DRMODE_FG 2 #define DRMODE_SOLID 3 #define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */ +/* Low-level drawing function types */ +typedef void lcd_pixelfunc_type(int x, int y); /* for b&w */ +typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits); + +#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) + #define DRAW_PIXEL(x,y) lcd_framebuffer[(y)>>3][(x)] |= (1<<((y)&7)) #define CLEAR_PIXEL(x,y) lcd_framebuffer[(y)>>3][(x)] &= ~(1<<((y)&7)) #define INVERT_PIXEL(x,y) lcd_framebuffer[(y)>>3][(x)] ^= (1<<((y)&7)) -typedef void lcd_pixelfunc_type(int x, int y); /* for b&w */ -typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits); - /* Memory copy of display bitmap */ extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; @@ -156,7 +157,8 @@ extern void lcd_drawrect(int x, int y, int width, int height); extern void lcd_fillrect(int x, int y, int width, int height); extern void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, int stride, int x, int y, int width, int height); -extern void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny); +extern void lcd_bitmap(const unsigned char *src, int x, int y, int width, + int height); extern void lcd_putsxy(int x, int y, const unsigned char *string); extern void lcd_invertscroll(int x, int y); |