summaryrefslogtreecommitdiff
path: root/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-04-01 16:36:34 +0300
committerFred Sundvik <fsundvik@gmail.com>2017-04-09 18:34:59 +0300
commita8f5897b976ee9f16b1798db38fb0ee4b8981c9e (patch)
treefbe1ff0da6c03c0b8fc0fafca081ff52b6a81b2a /keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
parent2b24d35846693a3365a35b6ee9bc31b70659cfcf (diff)
Add support for blitting to the Infinity LCD
Diffstat (limited to 'keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c')
-rw-r--r--keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
index 4547f14193..2c8a168e76 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
+++ b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
@@ -254,6 +254,32 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
}
#endif
+LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
+ uint8_t* buffer = (uint8_t*)g->p.ptr;
+ int linelength = g->p.cx;
+ for (int i = 0; i < g->p.cy; i++) {
+ unsigned dstx = g->p.x;
+ unsigned dsty = g->p.y + i;
+ unsigned srcx = g->p.x1;
+ unsigned srcy = g->p.y1 + i;
+ unsigned srcbit = srcy * g->p.x2 + srcx;
+ for(int j=0; j < linelength; j++) {
+ uint8_t src = buffer[srcbit / 8];
+ uint8_t bit = 7-(srcbit % 8);
+ uint8_t bitset = (src >> bit) & 1;
+ uint8_t* dst = &(RAM(g)[xyaddr(dstx, dsty)]);
+ if (bitset) {
+ *dst |= xybit(dsty);
+ }
+ else {
+ *dst &= ~xybit(dsty);
+ }
+ dstx++;
+ srcbit++;
+ }
+ }
+}
+
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) {