Start OLED support for ana-digi

This commit is contained in:
Nils Faerber 2011-08-10 20:13:00 +02:00
parent fc1c62b9c0
commit 59068bbd13
6 changed files with 173 additions and 1 deletions

View file

@ -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; x<mwbuf->res_x; x++) {
for (y=0; y<mwbuf->res_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;