Start OLED support for ana-digi
This commit is contained in:
parent
fc1c62b9c0
commit
59068bbd13
6 changed files with 173 additions and 1 deletions
25
mw_utility.c
25
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; 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue