X-Git-Url: https://git.kernelconcepts.de/?p=metawatch.git;a=blobdiff_plain;f=mw_utility.c;h=2ddc12dde098f7e2dafe4f9b9bb2ac0f5ed2893f;hp=baf3d0a07d94eb30da3adfc5776403674e77a12e;hb=59068bbd135c3d2ed046be5fd64850166ca04a5c;hpb=fc1c62b9c0c3395297f2871028516a62d5effa19 diff --git a/mw_utility.c b/mw_utility.c index baf3d0a..2ddc12d 100644 --- a/mw_utility.c +++ b/mw_utility.c @@ -64,8 +64,10 @@ void mw_free_pbuffer(mw_buffer *mwbuf) } /* - * makes a buffer for sending to the watch from the drawing buffer, e.g. + * makes a buffer for sending to the LCD watch from the drawing buffer, e.g. * mw_send_bitmap(mw_fd, MW_SCREEN_MODE_IDLE, 96, 65, 31, bbuf, len); + * + * NOT reentrant ! */ unsigned char *mw_make_mw_buffer(mw_buffer *mwbuf, int *buflen) { @@ -88,6 +90,27 @@ unsigned char *mw_make_mw_buffer(mw_buffer *mwbuf, int *buflen) return wbuf; } +unsigned char *mw_make_mw_oled_buffer(mw_buffer *mwbuf, int *buflen) +{ + static unsigned char wbuf[2*80]; /* size of one OLED, two rows */ + int x, y; + unsigned char clr; + + memset(wbuf, 0, 2*80); + + for (x=0; xres_x; x++) { + for (y=0; yres_y; y++) { + clr = *(unsigned char *)(mwbuf->pbuf+((y*mwbuf->res_x)+x)); + if (clr) { + *(unsigned char *)(wbuf+(x+80*(y/8))) |= 1 << (7-(y%8)); + } + } + } + *buflen = (mwbuf->res_y / 8) * 80; + + return wbuf; +} + void mw_dump_mw_buffer(mw_buffer *mwbuf) { int x, y;