diff --git a/glcd/console.c b/glcd/console.c index 714351d0..caddfce2 100644 --- a/glcd/console.c +++ b/glcd/console.c @@ -1,171 +1,171 @@ -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "ch.h" - -#include "fonts.h" -#include "glcd.h" -#include "console.h" - -/* - * Interface implementation. The interface is write only - */ - -static size_t writes(void *ip, const uint8_t *bp, size_t n) { - return lcdConsoleWrite((GLCDConsole *)ip, bp, n); -} - -static size_t reads(void *ip, uint8_t *bp, size_t n) { - (void)ip; - (void)bp; - (void)n; - - return 0; -} - -static msg_t put(void *ip, uint8_t b) { - return lcdConsolePut((GLCDConsole *)ip, (char)b); -} - -static msg_t get(void *ip) { - (void)ip; - - return RDY_OK; -} - -static msg_t putt(void *ip, uint8_t b, systime_t timeout) { - (void)timeout; - - /* TODO: handle timeout */ - - return lcdConsolePut((GLCDConsole *)ip, (char)b); -} - -static msg_t gett(void *ip, systime_t timeout) { - (void)ip; - (void)timeout; - - return RDY_OK; -} - -static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t time) { - (void)time; - - return lcdConsoleWrite((GLCDConsole *)ip, bp, n); -} - -static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) { - (void)ip; - (void)bp; - (void)n; - (void)time; - - return 0; -} - -static chnflags_t getflags(void *ip) { - _chn_get_and_clear_flags_impl(ip); -} - -static const struct GLCDConsoleVMT vmt = { - writes, reads, put, get, - putt, gett, writet, readt, - getflags -}; - - -msg_t lcdConsoleInit(GLCDConsole *console, uint16_t x0, uint16_t y0, uint16_t width, uint16_t height, font_t font, uint16_t bkcolor, uint16_t color) { - const uint8_t* ptr; - uint16_t chi; - uint16_t x,y; - - console->vmt = &vmt; - /* read font, get height */ - console->fy = font[FONT_TABLE_HEIGHT_IDX]; - - /* calculate the size of the console as an integer multiple of characters height*/ - console->sx = width; - console->sy = (((int16_t)(height/console->fy))-1)*console->fy; - - console->cx = 0; - console->cy = 0; - console->x0 = x0; - console->y0 = y0; - - console->bkcolor = bkcolor; - console->color = color; - - console->font = font; - - lcdFillArea(x0, y0, x0+width, y0+height, console->bkcolor); -} - -msg_t lcdConsolePut(GLCDConsole *console, char c) { - uint8_t width; - - if(c == '\n') { - /* clear the text at the end of the line */ - if(console->cx < console->sx) - lcdFillArea(console->x0 + console->cx, console->y0 + console->cy, - console->x0 + console->sx, console->y0 + console->cy + console->fy, - console->bkcolor); - console->cx = 0; - console->cy += console->fy; - } else if(c == '\r') { - /* TODO: work backwards through the buffer to the start of the current line */ - //console->cx = 0; - } else { - width = lcdMeasureChar(c, console->font); - if((console->cx + width) >= console->sx) { - /* clear the text at the end of the line */ - lcdFillArea(console->x0 + console->cx, console->y0 + console->cy, - console->x0 + console->cx + width, console->y0 + console->cy + console->fy, - console->bkcolor); - console->cx = 0; - console->cy += console->fy; - } - - if((console->cy > console->sy)) { - - lcdVerticalScroll(console->x0, console->y0, console->x0 + console->sx, - console->y0 + console->sy + console->fy, console->fy); - /* reset the cursor */ - console->cx = 0; - console->cy = console->sy; - } - - lcdDrawChar(console->x0 + console->cx, console->y0 + console->cy, c, - console->font, console->color, console->bkcolor, solid); - - /* update cursor */ - console->cx += width; - } - -} - -msg_t lcdConsoleWrite(GLCDConsole *console, uint8_t *bp, size_t n) { - size_t i; - for(i = 0; i < n; i++) - lcdConsolePut(console, bp[i]); - - return RDY_OK; -} - - +/* + ChibiOS/RT - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "ch.h" + +#include "glcd.h" +#include "console.h" + +/* + * Interface implementation. The interface is write only + */ + +static size_t writes(void *ip, const uint8_t *bp, size_t n) { + return lcdConsoleWrite((GLCDConsole *)ip, bp, n); +} + +static size_t reads(void *ip, uint8_t *bp, size_t n) { + (void)ip; + (void)bp; + (void)n; + + return 0; +} + +static msg_t put(void *ip, uint8_t b) { + return lcdConsolePut((GLCDConsole *)ip, (char)b); +} + +static msg_t get(void *ip) { + (void)ip; + + return RDY_OK; +} + +static msg_t putt(void *ip, uint8_t b, systime_t timeout) { + (void)timeout; + + /* TODO: handle timeout */ + + return lcdConsolePut((GLCDConsole *)ip, (char)b); +} + +static msg_t gett(void *ip, systime_t timeout) { + (void)ip; + (void)timeout; + + return RDY_OK; +} + +static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t time) { + (void)time; + + return lcdConsoleWrite((GLCDConsole *)ip, bp, n); +} + +static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) { + (void)ip; + (void)bp; + (void)n; + (void)time; + + return 0; +} + +static uint16_t getflags(void *ip) { + _chn_get_and_clear_flags_impl(ip); +} + +static const struct GLCDConsoleVMT vmt = { + writes, reads, put, get, + putt, gett, writet, readt, + getflags +}; + + +msg_t lcdConsoleInit(GLCDConsole *console, uint16_t x0, uint16_t y0, uint16_t width, uint16_t height, font_t font, uint16_t bkcolor, uint16_t color) { + const uint8_t* ptr; + uint16_t chi; + uint16_t x,y; + + console->vmt = &vmt; + /* read font, get height */ + console->fy = lcdGetFontHeight(font); + + /* calculate the size of the console as an integer multiple of characters height*/ + console->sx = width; + console->sy = (((int16_t)(height/console->fy))-1)*console->fy; + + console->cx = 0; + console->cy = 0; + console->x0 = x0; + console->y0 = y0; + + console->bkcolor = bkcolor; + console->color = color; + + console->font = font; + + lcdFillArea(x0, y0, x0+width, y0+height, console->bkcolor); + return RDY_OK; +} + +msg_t lcdConsolePut(GLCDConsole *console, char c) { + uint8_t width; + + if(c == '\n') { + /* clear the text at the end of the line */ + if(console->cx < console->sx) + lcdFillArea(console->x0 + console->cx, console->y0 + console->cy, + console->x0 + console->sx, console->y0 + console->cy + console->fy, + console->bkcolor); + console->cx = 0; + console->cy += console->fy; + } else if(c == '\r') { + /* TODO: work backwards through the buffer to the start of the current line */ + //console->cx = 0; + } else { + width = lcdMeasureChar(c, console->font); + if((console->cx + width) >= console->sx) { + /* clear the text at the end of the line */ + lcdFillArea(console->x0 + console->cx, console->y0 + console->cy, + console->x0 + console->cx + width, console->y0 + console->cy + console->fy, + console->bkcolor); + console->cx = 0; + console->cy += console->fy; + } + + if((console->cy > console->sy)) { + + lcdVerticalScroll(console->x0, console->y0, console->x0 + console->sx, + console->y0 + console->sy + console->fy, console->fy); + /* reset the cursor */ + console->cx = 0; + console->cy = console->sy; + } + + lcdDrawChar(console->x0 + console->cx, console->y0 + console->cy, c, + console->font, console->color, console->bkcolor, solid); + + /* update cursor */ + console->cx += width; + } + return RDY_OK; +} + +msg_t lcdConsoleWrite(GLCDConsole *console, uint8_t *bp, size_t n) { + size_t i; + for(i = 0; i < n; i++) + lcdConsolePut(console, bp[i]); + + return RDY_OK; +} + + diff --git a/glcd/fonts.c b/glcd/fonts.c deleted file mode 100644 index 7f8a5c98..00000000 --- a/glcd/fonts.c +++ /dev/null @@ -1,767 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "fonts.h" - -#if 1 // font_Small - for side buttons -// -// Medium bold font, height = 11 (including the decenders) -// The font table contains 3 sections: Header, Table Of Character Indexes, Pixel data -// -// The Header contains two bytes: -// Byte0 = Font height (including decenders) -// Byte1 = Number of additional pixels that should be drawn right of char -// Byte2 = Recommended line spacing -// Byte3 = Height of decenders -// Byte4 = Unused byte -// -// The Table Of Character Indexes, is a table of 2 byte words that index to the pixel data within this table -// Word0 = Index into this table to the pixels for ASCII char 0x20 -// Word1 = Index into this table to the pixels for ASCII char 0x21 -// Word2 = Index into this table to the pixels for ASCII char 0x22 -// ... -// Word95 = Index into this table to the pixels for ASCII char 0x7F -// -// The Pixel data table contains the bitmap for each character -// Data is written in columns of pixels, each column is 16 bits (2 bytes) -// Byte0 = width of the ASCII 0x20 character in pixels -// Byte1 = pixel data for the 0x20 char's 1st top column, bit 0 is the top pixel, bit 7 is the 8th pixel down from the top -// Byte2 = pixel data for the 0x20 char's 1st bottom column, bit 0 is the 9th pixel -// Byte5 = pixel data for the 0x20 char's 2nd top column -// Byte6 = pixel data for the 0x20 char's 2nd bottom column -// ... = remaining pairs of bytes of the columns in the 0x20 char -// ... = width of the 0x21 char in pixels -// ... = pixel data for the 0x21 char -// ... -// -const uint8_t font_Small[] = { - 0x0B, 0x00, 0x0E, 0x02, 0x00, - - 0xC5, 0x00, 0xCE, 0x00, 0xD5, 0x00, 0xE2, 0x00, 0xF3, 0x00, 0x02, 0x01, - 0x15, 0x01, 0x24, 0x01, 0x2B, 0x01, 0x34, 0x01, 0x3D, 0x01, 0x48, 0x01, - 0x57, 0x01, 0x60, 0x01, 0x69, 0x01, 0x70, 0x01, 0x7D, 0x01, 0x8C, 0x01, - 0x9B, 0x01, 0xAA, 0x01, 0xB9, 0x01, 0xC8, 0x01, 0xD7, 0x01, 0xE6, 0x01, - 0xF5, 0x01, 0x04, 0x02, 0x13, 0x02, 0x1A, 0x02, 0x23, 0x02, 0x30, 0x02, - 0x3F, 0x02, 0x4C, 0x02, 0x5B, 0x02, 0x74, 0x02, 0x85, 0x02, 0x94, 0x02, - 0xA5, 0x02, 0xB6, 0x02, 0xC5, 0x02, 0xD4, 0x02, 0xE5, 0x02, 0xF6, 0x02, - 0xFD, 0x02, 0x08, 0x03, 0x19, 0x03, 0x28, 0x03, 0x3B, 0x03, 0x4C, 0x03, - 0x5D, 0x03, 0x6E, 0x03, 0x7F, 0x03, 0x90, 0x03, 0x9F, 0x03, 0xAE, 0x03, - 0xBF, 0x03, 0xD0, 0x03, 0xE9, 0x03, 0xFA, 0x03, 0x0B, 0x04, 0x1C, 0x04, - 0x25, 0x04, 0x32, 0x04, 0x3B, 0x04, 0x4A, 0x04, 0x59, 0x04, 0x62, 0x04, - 0x71, 0x04, 0x80, 0x04, 0x8F, 0x04, 0x9E, 0x04, 0xAD, 0x04, 0xB6, 0x04, - 0xC5, 0x04, 0xD4, 0x04, 0xDB, 0x04, 0xE2, 0x04, 0xF1, 0x04, 0xF8, 0x04, - 0x0B, 0x05, 0x1A, 0x05, 0x29, 0x05, 0x38, 0x05, 0x47, 0x05, 0x50, 0x05, - 0x5D, 0x05, 0x66, 0x05, 0x75, 0x05, 0x84, 0x05, 0x97, 0x05, 0xA4, 0x05, - 0xB1, 0x05, 0xBE, 0x05, 0xC9, 0x05, 0xD0, 0x05, 0xDB, 0x05, 0xEC, 0x05, - - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x7F, 0x01, 0x7F, 0x01, 0x06, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x07, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x44, 0x00, 0xFF, 0x01, - 0xFF, 0x01, 0x44, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x44, 0x00, 0x07, 0x00, - 0x00, 0x8C, 0x00, 0x9E, 0x01, 0xFF, 0x03, 0xFF, 0x03, 0xE6, 0x01, 0xC4, - 0x00, 0x09, 0x00, 0x00, 0x82, 0x00, 0xC7, 0x00, 0x65, 0x00, 0xB7, 0x00, - 0xDA, 0x01, 0x4C, 0x01, 0xC6, 0x01, 0x82, 0x00, 0x07, 0x00, 0x00, 0xE6, - 0x00, 0xFF, 0x01, 0x3F, 0x01, 0xE6, 0x01, 0xE0, 0x01, 0x20, 0x01, 0x03, - 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0xFE, 0x03, 0xFF, - 0x07, 0x01, 0x04, 0x04, 0x00, 0x00, 0x01, 0x04, 0xFF, 0x07, 0xFE, 0x03, - 0x05, 0x00, 0x00, 0x0A, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x0A, 0x00, 0x07, - 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x20, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x04, - 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x80, 0x01, 0xE0, 0x01, 0x78, 0x00, - 0x1F, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0xFF, 0x01, 0x01, - 0x01, 0x01, 0x01, 0xFF, 0x01, 0xFE, 0x00, 0x07, 0x00, 0x00, 0x02, 0x00, - 0x02, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, - 0x00, 0x82, 0x01, 0xC3, 0x01, 0x61, 0x01, 0x31, 0x01, 0x1F, 0x01, 0x0E, - 0x01, 0x07, 0x00, 0x00, 0x82, 0x00, 0x83, 0x01, 0x11, 0x01, 0x11, 0x01, - 0xFF, 0x01, 0xEE, 0x00, 0x07, 0x00, 0x00, 0x60, 0x00, 0x78, 0x00, 0x5E, - 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x40, 0x00, 0x07, 0x00, 0x00, 0x9F, 0x00, - 0x9F, 0x01, 0x09, 0x01, 0x09, 0x01, 0xF9, 0x01, 0xF1, 0x00, 0x07, 0x00, - 0x00, 0xFE, 0x00, 0xFF, 0x01, 0x11, 0x01, 0x11, 0x01, 0xF3, 0x01, 0xE2, - 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0xC1, 0x01, 0xF1, 0x01, 0x3D, 0x00, - 0x0F, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0xEE, 0x00, 0xFF, 0x01, 0x11, - 0x01, 0x11, 0x01, 0xFF, 0x01, 0xEE, 0x00, 0x07, 0x00, 0x00, 0x8E, 0x00, - 0x9F, 0x01, 0x11, 0x01, 0x11, 0x01, 0xFF, 0x01, 0xFE, 0x00, 0x03, 0x00, - 0x00, 0x08, 0x01, 0x08, 0x01, 0x04, 0x00, 0x00, 0x00, 0x02, 0x08, 0x03, - 0x08, 0x01, 0x06, 0x00, 0x00, 0x20, 0x00, 0x70, 0x00, 0xD8, 0x00, 0x8C, - 0x01, 0x04, 0x01, 0x07, 0x00, 0x00, 0x50, 0x00, 0x50, 0x00, 0x50, 0x00, - 0x50, 0x00, 0x50, 0x00, 0x50, 0x00, 0x06, 0x00, 0x00, 0x04, 0x01, 0x8C, - 0x01, 0xD8, 0x00, 0x70, 0x00, 0x20, 0x00, 0x07, 0x00, 0x00, 0x02, 0x00, - 0x03, 0x00, 0x61, 0x01, 0x71, 0x01, 0x1F, 0x00, 0x0E, 0x00, 0x0C, 0x00, - 0x00, 0x78, 0x00, 0xFE, 0x01, 0x86, 0x01, 0x33, 0x03, 0x79, 0x02, 0x49, - 0x02, 0x79, 0x02, 0x7B, 0x02, 0x46, 0x02, 0x7E, 0x00, 0x78, 0x00, 0x08, - 0x80, 0x01, 0xF0, 0x01, 0x7C, 0x00, 0x4F, 0x00, 0x4F, 0x00, 0x7C, 0x00, - 0xF0, 0x01, 0x80, 0x01, 0x07, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x11, - 0x01, 0x11, 0x01, 0xFF, 0x01, 0xEE, 0x00, 0x08, 0x00, 0x00, 0xFE, 0x00, - 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x83, 0x01, 0x82, 0x00, - 0x08, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x83, - 0x01, 0xFE, 0x00, 0x7C, 0x00, 0x07, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, - 0x11, 0x01, 0x11, 0x01, 0x11, 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0xFF, - 0x01, 0xFF, 0x01, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x01, 0x00, 0x08, - 0x00, 0x00, 0xFE, 0x00, 0xFF, 0x01, 0x01, 0x01, 0x11, 0x01, 0x91, 0x01, - 0xF3, 0x01, 0xF2, 0x01, 0x08, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x10, - 0x00, 0x10, 0x00, 0x10, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x03, 0x00, 0x00, - 0xFF, 0x01, 0xFF, 0x01, 0x05, 0xC0, 0x00, 0xC0, 0x01, 0x00, 0x01, 0xFF, - 0x01, 0xFF, 0x00, 0x08, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x3C, 0x00, - 0x66, 0x00, 0xC3, 0x00, 0x81, 0x01, 0x00, 0x01, 0x07, 0x00, 0x00, 0xFF, - 0x01, 0xFF, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x09, - 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x3C, 0x00, 0xF0, 0x00, 0xF0, 0x00, - 0x3C, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x08, 0x00, 0x00, 0xFF, 0x01, 0xFF, - 0x01, 0x1E, 0x00, 0x38, 0x00, 0xE0, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x08, - 0x00, 0x00, 0xFE, 0x00, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0xFF, 0x01, 0xFE, 0x00, 0x08, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x11, - 0x00, 0x11, 0x00, 0x11, 0x00, 0x1F, 0x00, 0x0E, 0x00, 0x08, 0x00, 0x00, - 0xFE, 0x00, 0xFF, 0x01, 0x01, 0x01, 0x41, 0x01, 0xC1, 0x01, 0xFF, 0x03, - 0xFE, 0x02, 0x08, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x11, 0x00, 0x11, - 0x00, 0x11, 0x00, 0xFF, 0x01, 0xEE, 0x01, 0x07, 0x00, 0x00, 0x8E, 0x00, - 0x9F, 0x01, 0x11, 0x01, 0x11, 0x01, 0xF3, 0x01, 0xE2, 0x00, 0x07, 0x00, - 0x00, 0x01, 0x00, 0x01, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x01, 0x00, 0x01, - 0x00, 0x08, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x01, 0x00, 0x01, 0x00, 0x01, - 0x00, 0x01, 0xFF, 0x01, 0xFF, 0x00, 0x08, 0x03, 0x00, 0x1F, 0x00, 0x7C, - 0x00, 0xE0, 0x01, 0xE0, 0x01, 0x7C, 0x00, 0x1F, 0x00, 0x03, 0x00, 0x0C, - 0x03, 0x00, 0x1F, 0x00, 0x7C, 0x00, 0xE0, 0x01, 0xE0, 0x01, 0x7C, 0x00, - 0x7C, 0x00, 0xE0, 0x01, 0xE0, 0x01, 0x7C, 0x00, 0x1F, 0x00, 0x03, 0x00, - 0x08, 0x83, 0x01, 0xC7, 0x01, 0x6C, 0x00, 0x38, 0x00, 0x38, 0x00, 0x6C, - 0x00, 0xC7, 0x01, 0x83, 0x01, 0x08, 0x03, 0x00, 0x07, 0x00, 0x0C, 0x00, - 0xF8, 0x01, 0xF8, 0x01, 0x0C, 0x00, 0x07, 0x00, 0x03, 0x00, 0x08, 0x81, - 0x01, 0xC1, 0x01, 0x61, 0x01, 0x31, 0x01, 0x19, 0x01, 0x0D, 0x01, 0x07, - 0x01, 0x03, 0x01, 0x04, 0x00, 0x00, 0xFF, 0x07, 0xFF, 0x07, 0x01, 0x04, - 0x06, 0x00, 0x00, 0x07, 0x00, 0x1F, 0x00, 0x78, 0x00, 0xE0, 0x01, 0x80, - 0x01, 0x04, 0x00, 0x00, 0x01, 0x04, 0xFF, 0x07, 0xFF, 0x07, 0x07, 0x00, - 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00, 0x02, - 0x00, 0x07, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, - 0x00, 0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x02, - 0x00, 0x07, 0x00, 0x00, 0xC0, 0x00, 0xE8, 0x01, 0x28, 0x01, 0x28, 0x01, - 0xF8, 0x01, 0xF0, 0x01, 0x07, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x08, - 0x01, 0x08, 0x01, 0xF8, 0x01, 0xF0, 0x00, 0x07, 0x00, 0x00, 0xF0, 0x00, - 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, 0x98, 0x01, 0x90, 0x00, 0x07, 0x00, - 0x00, 0xF0, 0x00, 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, 0xFF, 0x01, 0xFF, - 0x01, 0x07, 0x00, 0x00, 0xF0, 0x00, 0xF8, 0x01, 0x28, 0x01, 0x28, 0x01, - 0xB8, 0x01, 0xB0, 0x00, 0x04, 0x00, 0x00, 0xFE, 0x01, 0xFF, 0x01, 0x09, - 0x00, 0x07, 0x00, 0x00, 0xF0, 0x04, 0xF8, 0x05, 0x08, 0x05, 0x08, 0x05, - 0xF8, 0x07, 0xF8, 0x03, 0x07, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x18, - 0x00, 0x08, 0x00, 0xF8, 0x01, 0xF0, 0x01, 0x03, 0x00, 0x00, 0xF9, 0x01, - 0xF9, 0x01, 0x03, 0x00, 0x00, 0xF9, 0x07, 0xF9, 0x07, 0x07, 0x00, 0x00, - 0xFF, 0x01, 0xFF, 0x01, 0x70, 0x00, 0xD8, 0x00, 0x88, 0x01, 0x00, 0x01, - 0x03, 0x00, 0x00, 0xFF, 0x01, 0xFF, 0x01, 0x09, 0x00, 0x00, 0xF8, 0x01, - 0xF8, 0x01, 0x08, 0x00, 0xF8, 0x01, 0xF8, 0x01, 0x08, 0x00, 0xF8, 0x01, - 0xF0, 0x01, 0x07, 0x00, 0x00, 0xF8, 0x01, 0xF8, 0x01, 0x18, 0x00, 0x08, - 0x00, 0xF8, 0x01, 0xF0, 0x01, 0x07, 0x00, 0x00, 0xF0, 0x00, 0xF8, 0x01, - 0x08, 0x01, 0x08, 0x01, 0xF8, 0x01, 0xF0, 0x00, 0x07, 0x00, 0x00, 0xF8, - 0x07, 0xF8, 0x07, 0x08, 0x01, 0x08, 0x01, 0xF8, 0x01, 0xF0, 0x00, 0x07, - 0x00, 0x00, 0xF0, 0x00, 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, 0xF8, 0x07, - 0xF8, 0x07, 0x04, 0x00, 0x00, 0xF8, 0x01, 0xF8, 0x01, 0x08, 0x00, 0x06, - 0x00, 0x00, 0x90, 0x00, 0xB8, 0x01, 0x68, 0x01, 0xD8, 0x01, 0x90, 0x00, - 0x04, 0x00, 0x00, 0xFE, 0x00, 0xFE, 0x01, 0x08, 0x01, 0x07, 0x00, 0x00, - 0xF8, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x80, 0x01, 0xF8, 0x01, 0xF8, 0x01, - 0x07, 0x00, 0x00, 0x18, 0x00, 0x78, 0x00, 0xE0, 0x01, 0xE0, 0x01, 0x78, - 0x00, 0x18, 0x00, 0x09, 0x00, 0x00, 0x78, 0x00, 0xF8, 0x01, 0xE0, 0x01, - 0x78, 0x00, 0x78, 0x00, 0xE0, 0x01, 0xF8, 0x01, 0x78, 0x00, 0x06, 0x00, - 0x00, 0x98, 0x01, 0xF8, 0x01, 0x60, 0x00, 0xF8, 0x01, 0x98, 0x01, 0x06, - 0x00, 0x04, 0x78, 0x04, 0xF8, 0x07, 0x80, 0x03, 0xF8, 0x00, 0x78, 0x00, - 0x06, 0x00, 0x00, 0x88, 0x01, 0xC8, 0x01, 0x68, 0x01, 0x38, 0x01, 0x18, - 0x01, 0x05, 0x00, 0x00, 0x10, 0x00, 0xFF, 0x01, 0xEF, 0x03, 0x00, 0x02, - 0x03, 0x00, 0x00, 0xFF, 0x03, 0xFF, 0x03, 0x05, 0x00, 0x00, 0x00, 0x02, - 0xEF, 0x03, 0xFF, 0x01, 0x10, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x06, - 0x00, 0x02, 0x00, 0x06, 0x00, 0x04, 0x00, 0x06, 0x00, 0x02, 0x00, 0x04, - 0x00, 0x00, 0xFE, 0x03, 0xFE, 0x03, 0xFE, 0x03 -}; -#endif - -#if 1 // font_Larger (Tahoma, 11Bold) -// -// Medium bold font, height = 11 (including the decenders) -// The font table contains 3 sections: Header, Table Of Character Indexes, Pixel data -// -// The Header contains two bytes: -// Byte0 = Font height (including decenders) -// Byte1 = Number of additional pixels that should be drawn right of char -// Byte2 = Recommended line spacing -// Byte3 = Height of decenders -// Byte4 = Unused byte -// -// The Table Of Character Indexes, is a table of 2 byte words that index to the pixel data within this table -// Word0 = Index into this table to the pixels for ASCII char 0x20 -// Word1 = Index into this table to the pixels for ASCII char 0x21 -// Word2 = Index into this table to the pixels for ASCII char 0x22 -// ... -// Word95 = Index into this table to the pixels for ASCII char 0x7F -// -// The Pixel data table contains the bitmap for each character -// Data is written in columns of pixels, each column is 16 bits (2 bytes) -// Byte0 = width of the ASCII 0x20 character in pixels -// Byte1 = pixel data for the 0x20 char's 1st top column, bit 0 is the top pixel, bit 7 is the 8th pixel down from the top -// Byte2 = pixel data for the 0x20 char's 1st bottom column, bit 0 is the 9th pixel -// Byte5 = pixel data for the 0x20 char's 2nd top column -// Byte6 = pixel data for the 0x20 char's 2nd bottom column -// ... = remaining pairs of bytes of the columns in the 0x20 char -// ... = width of the 0x21 char in pixels -// ... = pixel data for the 0x21 char -// ... -// -const uint8_t font_Larger[] = { - 0x0C, 0x01, 0x0D, 0x02, 0x00, - - 0xC5, 0x00, 0xCE, 0x00, 0xD5, 0x00, 0xE0, 0x00, 0xF1, 0x00, 0x00, 0x01, - 0x1B, 0x01, 0x2C, 0x01, 0x31, 0x01, 0x3A, 0x01, 0x43, 0x01, 0x52, 0x01, - 0x63, 0x01, 0x6A, 0x01, 0x73, 0x01, 0x7A, 0x01, 0x85, 0x01, 0x94, 0x01, - 0xA3, 0x01, 0xB2, 0x01, 0xC1, 0x01, 0xD0, 0x01, 0xDF, 0x01, 0xEE, 0x01, - 0xFD, 0x01, 0x0C, 0x02, 0x1B, 0x02, 0x22, 0x02, 0x29, 0x02, 0x3C, 0x02, - 0x4D, 0x02, 0x60, 0x02, 0x6D, 0x02, 0x80, 0x02, 0x91, 0x02, 0xA0, 0x02, - 0xAF, 0x02, 0xC0, 0x02, 0xCD, 0x02, 0xD8, 0x02, 0xE7, 0x02, 0xF8, 0x02, - 0x01, 0x03, 0x0C, 0x03, 0x1B, 0x03, 0x28, 0x03, 0x3D, 0x03, 0x4C, 0x03, - 0x5D, 0x03, 0x6C, 0x03, 0x7D, 0x03, 0x8E, 0x03, 0x9D, 0x03, 0xAA, 0x03, - 0xB9, 0x03, 0xC8, 0x03, 0xDF, 0x03, 0xEE, 0x03, 0xFB, 0x03, 0x08, 0x04, - 0x11, 0x04, 0x1C, 0x04, 0x25, 0x04, 0x38, 0x04, 0x49, 0x04, 0x54, 0x04, - 0x61, 0x04, 0x70, 0x04, 0x7B, 0x04, 0x8A, 0x04, 0x97, 0x04, 0xA2, 0x04, - 0xB1, 0x04, 0xC0, 0x04, 0xC5, 0x04, 0xCC, 0x04, 0xD9, 0x04, 0xDE, 0x04, - 0xF3, 0x04, 0x02, 0x05, 0x11, 0x05, 0x20, 0x05, 0x2F, 0x05, 0x38, 0x05, - 0x43, 0x05, 0x4E, 0x05, 0x5D, 0x05, 0x6A, 0x05, 0x7F, 0x05, 0x8C, 0x05, - 0x99, 0x05, 0xA4, 0x05, 0xB1, 0x05, 0xBA, 0x05, 0xC7, 0x05, 0xDA, 0x05, - - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x7E, 0x03, 0x7E, 0x03, 0x05, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, - 0x00, 0x07, 0x00, 0x08, 0xC0, 0x00, 0xD8, 0x03, 0xF8, 0x00, 0xDE, 0x00, - 0xD8, 0x03, 0xF8, 0x00, 0xDE, 0x00, 0x18, 0x00, 0x07, 0x18, 0x01, 0x3C, - 0x02, 0x64, 0x02, 0xFF, 0x0F, 0x64, 0x02, 0xC4, 0x03, 0x88, 0x01, 0x0D, - 0x1C, 0x00, 0x3E, 0x00, 0x22, 0x00, 0x3E, 0x02, 0x1C, 0x01, 0xC0, 0x00, - 0x20, 0x00, 0x18, 0x00, 0xC4, 0x01, 0xE2, 0x03, 0x20, 0x02, 0xE0, 0x03, - 0xC0, 0x01, 0x08, 0xCC, 0x01, 0xFE, 0x03, 0x32, 0x02, 0x72, 0x02, 0xDE, - 0x03, 0x8C, 0x01, 0xE0, 0x03, 0x60, 0x02, 0x02, 0x07, 0x00, 0x07, 0x00, - 0x04, 0xF8, 0x01, 0xFE, 0x07, 0x07, 0x0E, 0x01, 0x08, 0x04, 0x01, 0x08, - 0x07, 0x0E, 0xFE, 0x07, 0xF8, 0x01, 0x07, 0x00, 0x00, 0x0A, 0x00, 0x04, - 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x08, 0x00, 0x00, - 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xFC, 0x01, 0x20, 0x00, 0x20, 0x00, - 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x07, 0x04, 0x20, 0x00, - 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x03, 0x05, 0x00, 0x0C, 0x80, 0x03, 0x60, 0x00, 0x1C, 0x00, 0x03, 0x00, - 0x07, 0xFC, 0x01, 0xFE, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFE, - 0x03, 0xFC, 0x01, 0x07, 0x00, 0x00, 0x04, 0x02, 0x04, 0x02, 0xFE, 0x03, - 0xFE, 0x03, 0x00, 0x02, 0x00, 0x02, 0x07, 0x04, 0x02, 0x02, 0x03, 0x82, - 0x03, 0xC2, 0x02, 0x62, 0x02, 0x3E, 0x02, 0x1C, 0x02, 0x07, 0x04, 0x01, - 0x02, 0x02, 0x22, 0x02, 0x22, 0x02, 0x22, 0x02, 0xFE, 0x03, 0xDC, 0x01, - 0x07, 0x60, 0x00, 0x50, 0x00, 0x48, 0x00, 0x44, 0x00, 0xFE, 0x03, 0xFE, - 0x03, 0x40, 0x00, 0x07, 0x00, 0x01, 0x1E, 0x02, 0x1E, 0x02, 0x12, 0x02, - 0x12, 0x02, 0xF2, 0x03, 0xE2, 0x01, 0x07, 0xF8, 0x01, 0xFC, 0x03, 0x16, - 0x02, 0x12, 0x02, 0x12, 0x02, 0xF2, 0x03, 0xE0, 0x01, 0x07, 0x02, 0x00, - 0x02, 0x00, 0x82, 0x03, 0xE2, 0x03, 0x7A, 0x00, 0x1E, 0x00, 0x06, 0x00, - 0x07, 0xDC, 0x01, 0xFE, 0x03, 0x22, 0x02, 0x22, 0x02, 0x22, 0x02, 0xFE, - 0x03, 0xDC, 0x01, 0x07, 0x3C, 0x00, 0x7E, 0x02, 0x42, 0x02, 0x42, 0x02, - 0x42, 0x03, 0xFE, 0x01, 0xFC, 0x00, 0x03, 0x00, 0x00, 0x18, 0x03, 0x18, - 0x03, 0x03, 0x00, 0x00, 0x18, 0x0F, 0x18, 0x07, 0x09, 0x00, 0x00, 0x60, - 0x00, 0x60, 0x00, 0x90, 0x00, 0x90, 0x00, 0x08, 0x01, 0x08, 0x01, 0x04, - 0x02, 0x04, 0x02, 0x08, 0x00, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, - 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x09, 0x00, 0x00, 0x04, - 0x02, 0x04, 0x02, 0x08, 0x01, 0x08, 0x01, 0x90, 0x00, 0x90, 0x00, 0x60, - 0x00, 0x60, 0x00, 0x06, 0x04, 0x00, 0x02, 0x00, 0x62, 0x03, 0x72, 0x03, - 0x1E, 0x00, 0x0C, 0x00, 0x09, 0xF8, 0x01, 0x04, 0x02, 0xF2, 0x04, 0xFA, - 0x05, 0x0A, 0x05, 0xFA, 0x04, 0xFA, 0x05, 0x04, 0x01, 0xF8, 0x00, 0x08, - 0x80, 0x03, 0xF0, 0x03, 0xFC, 0x00, 0x8E, 0x00, 0x8E, 0x00, 0xFC, 0x00, - 0xF0, 0x03, 0x80, 0x03, 0x07, 0xFE, 0x03, 0xFE, 0x03, 0x22, 0x02, 0x22, - 0x02, 0x22, 0x02, 0xFE, 0x03, 0xDC, 0x01, 0x07, 0xFC, 0x01, 0xFE, 0x03, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x8C, 0x01, 0x08, 0xFE, - 0x03, 0xFE, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x06, 0x03, 0xFC, - 0x01, 0xF8, 0x00, 0x06, 0xFE, 0x03, 0xFE, 0x03, 0x22, 0x02, 0x22, 0x02, - 0x22, 0x02, 0x22, 0x02, 0x05, 0xFE, 0x03, 0xFE, 0x03, 0x22, 0x00, 0x22, - 0x00, 0x22, 0x00, 0x07, 0xFC, 0x01, 0xFE, 0x03, 0x02, 0x02, 0x02, 0x02, - 0x22, 0x02, 0xE2, 0x03, 0xEC, 0x03, 0x08, 0xFE, 0x03, 0xFE, 0x03, 0x20, - 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xFE, 0x03, 0xFE, 0x03, 0x04, - 0x02, 0x02, 0xFE, 0x03, 0xFE, 0x03, 0x02, 0x02, 0x05, 0x00, 0x02, 0x02, - 0x02, 0x02, 0x02, 0xFE, 0x03, 0xFE, 0x01, 0x07, 0xFE, 0x03, 0xFE, 0x03, - 0x70, 0x00, 0xD8, 0x00, 0x8C, 0x01, 0x06, 0x03, 0x02, 0x02, 0x06, 0xFE, - 0x03, 0xFE, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x0A, - 0xFE, 0x03, 0x0E, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x70, 0x00, 0x30, 0x00, - 0x18, 0x00, 0x0C, 0x00, 0xFE, 0x03, 0xFE, 0x03, 0x07, 0xFE, 0x03, 0x0E, - 0x00, 0x1C, 0x00, 0x70, 0x00, 0xE0, 0x01, 0x80, 0x03, 0xFE, 0x03, 0x08, - 0xFC, 0x01, 0xFE, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0xFE, 0x03, 0xFC, 0x01, 0x07, 0xFE, 0x03, 0xFE, 0x03, 0x42, 0x00, 0x42, - 0x00, 0x42, 0x00, 0x7E, 0x00, 0x3C, 0x00, 0x08, 0xFC, 0x01, 0xFE, 0x03, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x06, 0x02, 0x0E, 0xFE, 0x0B, 0xFC, 0x09, - 0x08, 0xFE, 0x03, 0xFE, 0x03, 0x22, 0x00, 0x62, 0x00, 0xE2, 0x00, 0xBE, - 0x01, 0x1C, 0x03, 0x00, 0x02, 0x07, 0x9C, 0x01, 0x3E, 0x02, 0x22, 0x02, - 0x22, 0x02, 0x22, 0x02, 0xE2, 0x03, 0xCC, 0x01, 0x06, 0x02, 0x00, 0x02, - 0x00, 0xFE, 0x03, 0xFE, 0x03, 0x02, 0x00, 0x02, 0x00, 0x07, 0xFE, 0x01, - 0xFE, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xFE, 0x03, 0xFE, 0x01, - 0x07, 0x0E, 0x00, 0x7E, 0x00, 0xF0, 0x03, 0x80, 0x03, 0xF0, 0x03, 0x7E, - 0x00, 0x0E, 0x00, 0x0B, 0x1E, 0x00, 0xFE, 0x00, 0xE0, 0x03, 0xE0, 0x03, - 0xFC, 0x00, 0x0E, 0x00, 0xFC, 0x00, 0xE0, 0x03, 0xE0, 0x03, 0xFE, 0x00, - 0x1E, 0x00, 0x07, 0x06, 0x03, 0x8E, 0x03, 0xF8, 0x00, 0x70, 0x00, 0xF8, - 0x00, 0x8E, 0x03, 0x06, 0x03, 0x06, 0x0E, 0x00, 0x3E, 0x00, 0xF0, 0x03, - 0xF0, 0x03, 0x3E, 0x00, 0x0E, 0x00, 0x06, 0x82, 0x03, 0xC2, 0x03, 0x62, - 0x02, 0x32, 0x02, 0x1E, 0x02, 0x0E, 0x02, 0x04, 0xFF, 0x0F, 0xFF, 0x0F, - 0x01, 0x08, 0x01, 0x08, 0x05, 0x03, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x80, - 0x03, 0x00, 0x0C, 0x04, 0x01, 0x08, 0x01, 0x08, 0xFF, 0x0F, 0xFF, 0x0F, - 0x09, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, - 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, - 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0x06, - 0x80, 0x01, 0xD0, 0x03, 0x48, 0x02, 0x48, 0x02, 0xF8, 0x03, 0xF0, 0x03, - 0x07, 0xFF, 0x03, 0xFF, 0x03, 0x10, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF8, - 0x03, 0xF0, 0x01, 0x05, 0xF0, 0x01, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, - 0x08, 0x02, 0x07, 0xF0, 0x01, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, 0x08, - 0x01, 0xFF, 0x03, 0xFF, 0x03, 0x06, 0xF0, 0x01, 0xF8, 0x03, 0x48, 0x02, - 0x48, 0x02, 0x78, 0x02, 0x70, 0x01, 0x05, 0x08, 0x00, 0xFE, 0x03, 0xFF, - 0x03, 0x09, 0x00, 0x01, 0x00, 0x07, 0xF0, 0x01, 0xF8, 0x0B, 0x08, 0x0A, - 0x08, 0x0A, 0x08, 0x09, 0xF8, 0x0F, 0xF8, 0x07, 0x07, 0xFF, 0x03, 0xFF, - 0x03, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x03, 0xF0, 0x03, 0x02, - 0xFA, 0x03, 0xFA, 0x03, 0x03, 0x08, 0x08, 0xFA, 0x0F, 0xFA, 0x07, 0x06, - 0xFF, 0x03, 0xFF, 0x03, 0xE0, 0x00, 0xB0, 0x01, 0x18, 0x03, 0x08, 0x02, - 0x02, 0xFF, 0x03, 0xFF, 0x03, 0x0A, 0xF8, 0x03, 0xF8, 0x03, 0x08, 0x00, - 0x08, 0x00, 0xF8, 0x03, 0xF0, 0x03, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x03, - 0xF0, 0x03, 0x07, 0xF8, 0x03, 0xF8, 0x03, 0x10, 0x00, 0x08, 0x00, 0x08, - 0x00, 0xF8, 0x03, 0xF0, 0x03, 0x07, 0xF0, 0x01, 0xF8, 0x03, 0x08, 0x02, - 0x08, 0x02, 0x08, 0x02, 0xF8, 0x03, 0xF0, 0x01, 0x07, 0xF8, 0x0F, 0xF8, - 0x0F, 0x10, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF8, 0x03, 0xF0, 0x01, 0x07, - 0xF0, 0x01, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, 0x08, 0x01, 0xF8, 0x0F, - 0xF8, 0x0F, 0x04, 0xF8, 0x03, 0xF8, 0x03, 0x10, 0x00, 0x18, 0x00, 0x05, - 0x30, 0x01, 0x78, 0x02, 0x48, 0x02, 0xC8, 0x03, 0x90, 0x01, 0x05, 0x08, - 0x00, 0xFE, 0x01, 0xFE, 0x03, 0x08, 0x02, 0x08, 0x02, 0x07, 0xF8, 0x01, - 0xF8, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0xF8, 0x03, 0xF8, 0x03, - 0x06, 0x38, 0x00, 0xF8, 0x00, 0xC0, 0x03, 0xC0, 0x03, 0xF8, 0x00, 0x38, - 0x00, 0x0A, 0x18, 0x00, 0xF8, 0x00, 0xE0, 0x03, 0x80, 0x03, 0xF8, 0x00, - 0xF8, 0x00, 0x80, 0x03, 0xE0, 0x03, 0xF8, 0x00, 0x18, 0x00, 0x06, 0x18, - 0x03, 0xB8, 0x03, 0xE0, 0x00, 0xE0, 0x00, 0xB8, 0x03, 0x18, 0x03, 0x06, - 0x38, 0x00, 0xF8, 0x0C, 0xC0, 0x0F, 0xC0, 0x03, 0xF8, 0x00, 0x38, 0x00, - 0x05, 0x88, 0x03, 0xC8, 0x03, 0x68, 0x02, 0x38, 0x02, 0x18, 0x02, 0x06, - 0x20, 0x00, 0x20, 0x00, 0xFE, 0x07, 0xDF, 0x0F, 0x01, 0x08, 0x01, 0x08, - 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0xFF, 0x0F, 0x06, 0x01, 0x08, - 0x01, 0x08, 0xDF, 0x0F, 0xFE, 0x07, 0x20, 0x00, 0x20, 0x00, 0x09, 0xE0, - 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x60, 0x00, 0xC0, 0x00, 0xC0, - 0x00, 0xC0, 0x00, 0x70, 0x00, 0x06, 0x00, 0x00, 0xFE, 0x03, 0xFE, 0x03, - 0x02, 0x02, 0xFE, 0x03, 0xFE, 0x03 -}; -#endif - -#if 1 // font_MediumBold (UI Font) -// The font table contains 3 sections: Header, Table Of Character Indexes, Pixel data -// -// The Header contains two bytes: -// Byte0 = Font height (including decenders) -// Byte1 = Number of additional pixels that should be drawn right of char -// Byte2 = Recommended line spacing -// Byte3 = Height of decenders -// Byte4 = Unused byte -// -// The Table Of Character Indexes, is a table of 2 byte words that index to the pixel data within this table -// Word0 = Index into this table to the pixels for ASCII char 0x20 -// Word1 = Index into this table to the pixels for ASCII char 0x21 -// Word2 = Index into this table to the pixels for ASCII char 0x22 -// ... -// Word95 = Index into this table to the pixels for ASCII char 0x7F -// -// The Pixel data table contains the bitmap for each character -// Data is written in columns of pixels, each column is 16 bits (2 bytes) -// Byte0 = width of the ASCII 0x20 character in pixels -// Byte1 = pixel data for the 0x20 char's 1st top column, bit 0 is the top pixel, bit 7 is the 8th pixel down from the top -// Byte2 = pixel data for the 0x20 char's 1st bottom column, bit 0 is the 9th pixel -// Byte5 = pixel data for the 0x20 char's 2nd top column -// Byte6 = pixel data for the 0x20 char's 2nd bottom column -// ... = remaining pairs of bytes of the columns in the 0x20 char -// ... = width of the 0x21 char in pixels -// ... = pixel data for the 0x21 char -// ... -// -const uint8_t font_MediumBold[] = { - 0x0D, 0x00, 0x0F, 0x02, 0x00, - - 0xC5, 0x00, 0xD2, 0x00, 0xD9, 0x00, 0xE6, 0x00, 0xF7, 0x00, 0x06, 0x01, - 0x21, 0x01, 0x34, 0x01, 0x3B, 0x01, 0x46, 0x01, 0x51, 0x01, 0x5E, 0x01, - 0x6F, 0x01, 0x76, 0x01, 0x81, 0x01, 0x88, 0x01, 0x97, 0x01, 0xA6, 0x01, - 0xB5, 0x01, 0xC4, 0x01, 0xD3, 0x01, 0xE2, 0x01, 0xF1, 0x01, 0x00, 0x02, - 0x0F, 0x02, 0x1E, 0x02, 0x2D, 0x02, 0x34, 0x02, 0x3B, 0x02, 0x4C, 0x02, - 0x5D, 0x02, 0x6E, 0x02, 0x7B, 0x02, 0x90, 0x02, 0xA1, 0x02, 0xB0, 0x02, - 0xBF, 0x02, 0xD0, 0x02, 0xDF, 0x02, 0xEE, 0x02, 0xFF, 0x02, 0x10, 0x03, - 0x1B, 0x03, 0x26, 0x03, 0x35, 0x03, 0x44, 0x03, 0x57, 0x03, 0x68, 0x03, - 0x79, 0x03, 0x88, 0x03, 0x99, 0x03, 0xAA, 0x03, 0xB9, 0x03, 0xCA, 0x03, - 0xDB, 0x03, 0xEA, 0x03, 0x01, 0x04, 0x10, 0x04, 0x1F, 0x04, 0x2E, 0x04, - 0x39, 0x04, 0x48, 0x04, 0x53, 0x04, 0x66, 0x04, 0x77, 0x04, 0x82, 0x04, - 0x91, 0x04, 0xA0, 0x04, 0xAD, 0x04, 0xBC, 0x04, 0xCB, 0x04, 0xD6, 0x04, - 0xE5, 0x04, 0xF4, 0x04, 0xFB, 0x04, 0x04, 0x05, 0x13, 0x05, 0x1A, 0x05, - 0x31, 0x05, 0x40, 0x05, 0x4F, 0x05, 0x5E, 0x05, 0x6D, 0x05, 0x7A, 0x05, - 0x87, 0x05, 0x92, 0x05, 0xA1, 0x05, 0xB0, 0x05, 0xC3, 0x05, 0xD2, 0x05, - 0xE1, 0x05, 0xEE, 0x05, 0xFD, 0x05, 0x06, 0x06, 0x15, 0x06, 0x26, 0x06, - - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00, 0xFC, 0x02, 0xFC, 0x02, 0x06, 0x00, 0x00, 0x0E, - 0x00, 0x0E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x08, 0x00, 0x00, - 0x80, 0x00, 0x90, 0x03, 0xF0, 0x00, 0x9C, 0x03, 0xF0, 0x00, 0x9C, 0x00, - 0x10, 0x00, 0x07, 0x00, 0x00, 0x30, 0x01, 0x78, 0x02, 0xC8, 0x0F, 0x7E, - 0x02, 0xC8, 0x03, 0x90, 0x01, 0x0D, 0x00, 0x00, 0x38, 0x00, 0x7C, 0x00, - 0x44, 0x00, 0x7C, 0x00, 0x38, 0x03, 0xC0, 0x00, 0x30, 0x00, 0xCC, 0x01, - 0xE0, 0x03, 0x20, 0x02, 0xE0, 0x03, 0xC0, 0x01, 0x09, 0x00, 0x00, 0xD8, - 0x01, 0xFC, 0x03, 0x24, 0x02, 0x7C, 0x02, 0xD8, 0x02, 0x80, 0x01, 0x60, - 0x03, 0x20, 0x02, 0x03, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x05, 0x00, - 0x00, 0xF0, 0x01, 0xFC, 0x07, 0x0E, 0x0E, 0x02, 0x08, 0x05, 0x00, 0x00, - 0x02, 0x08, 0x0E, 0x0E, 0xFC, 0x07, 0xF0, 0x01, 0x06, 0x00, 0x00, 0x14, - 0x00, 0x08, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, - 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xF8, 0x03, 0x40, 0x00, 0x40, 0x00, - 0x40, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x07, 0x05, 0x00, 0x00, - 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x03, 0x07, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0F, 0xE0, 0x03, - 0xF8, 0x00, 0x1E, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0xF8, 0x01, 0xFC, - 0x03, 0x04, 0x02, 0x04, 0x02, 0xFC, 0x03, 0xF8, 0x01, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x02, 0xFC, 0x03, 0xFC, 0x03, 0x00, 0x02, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x08, 0x03, 0x8C, 0x03, 0xC4, 0x02, 0x64, 0x02, 0x3C, - 0x02, 0x18, 0x02, 0x07, 0x00, 0x00, 0x08, 0x01, 0x0C, 0x03, 0x24, 0x02, - 0x24, 0x02, 0xFC, 0x03, 0xD8, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x00, 0xA0, - 0x00, 0x90, 0x00, 0xF8, 0x03, 0xFC, 0x03, 0x80, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x01, 0x3C, 0x03, 0x3C, 0x02, 0x24, 0x02, 0xE4, 0x03, 0xC4, 0x01, - 0x07, 0x00, 0x00, 0xF0, 0x01, 0xF8, 0x03, 0x2C, 0x02, 0x24, 0x02, 0xE4, - 0x03, 0xC0, 0x01, 0x07, 0x00, 0x00, 0x04, 0x00, 0x04, 0x03, 0xC4, 0x03, - 0xF4, 0x00, 0x3C, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x00, 0xD8, 0x01, 0xFC, - 0x03, 0x24, 0x02, 0x24, 0x02, 0xFC, 0x03, 0xD8, 0x01, 0x07, 0x00, 0x00, - 0x38, 0x00, 0x7C, 0x02, 0x44, 0x02, 0x44, 0x03, 0xFC, 0x01, 0xF8, 0x00, - 0x03, 0x00, 0x00, 0x30, 0x03, 0x30, 0x03, 0x03, 0x00, 0x00, 0x30, 0x0F, - 0x30, 0x07, 0x08, 0x00, 0x00, 0x40, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x10, - 0x01, 0x10, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x00, 0x00, 0x90, 0x00, - 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, - 0x08, 0x00, 0x00, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, 0x10, 0x01, 0xA0, - 0x00, 0xA0, 0x00, 0x40, 0x00, 0x06, 0x00, 0x00, 0x08, 0x00, 0xC4, 0x02, - 0xE4, 0x02, 0x3C, 0x00, 0x18, 0x00, 0x0A, 0x00, 0x00, 0xF0, 0x01, 0x08, - 0x02, 0xE4, 0x04, 0xF4, 0x05, 0x14, 0x05, 0xF4, 0x05, 0xF4, 0x05, 0x04, - 0x01, 0xF8, 0x00, 0x08, 0x00, 0x00, 0x80, 0x03, 0xF0, 0x03, 0xFC, 0x00, - 0x8C, 0x00, 0xFC, 0x00, 0xF0, 0x03, 0x80, 0x03, 0x07, 0x00, 0x00, 0xFC, - 0x03, 0xFC, 0x03, 0x24, 0x02, 0x24, 0x02, 0xFC, 0x03, 0xD8, 0x01, 0x07, - 0x00, 0x00, 0xF8, 0x01, 0xFC, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, - 0x08, 0x01, 0x08, 0x00, 0x00, 0xFC, 0x03, 0xFC, 0x03, 0x04, 0x02, 0x04, - 0x02, 0x0C, 0x03, 0xF8, 0x01, 0xF0, 0x00, 0x07, 0x00, 0x00, 0xFC, 0x03, - 0xFC, 0x03, 0x24, 0x02, 0x24, 0x02, 0x24, 0x02, 0x24, 0x02, 0x07, 0x00, - 0x00, 0xFC, 0x03, 0xFC, 0x03, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, - 0x00, 0x08, 0x00, 0x00, 0xF8, 0x01, 0xFC, 0x03, 0x04, 0x02, 0x04, 0x02, - 0x44, 0x02, 0xC4, 0x03, 0xC8, 0x03, 0x08, 0x00, 0x00, 0xFC, 0x03, 0xFC, - 0x03, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xFC, 0x03, 0xFC, 0x03, 0x05, - 0x00, 0x00, 0x04, 0x02, 0xFC, 0x03, 0xFC, 0x03, 0x04, 0x02, 0x05, 0x00, - 0x02, 0x04, 0x02, 0x04, 0x02, 0xFC, 0x03, 0xFC, 0x01, 0x07, 0x00, 0x00, - 0xFC, 0x03, 0xFC, 0x03, 0xF0, 0x00, 0x98, 0x01, 0x0C, 0x03, 0x04, 0x02, - 0x07, 0x00, 0x00, 0xFC, 0x03, 0xFC, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, - 0x02, 0x00, 0x02, 0x09, 0x00, 0x00, 0xFC, 0x03, 0x1C, 0x00, 0x38, 0x00, - 0x70, 0x00, 0x20, 0x00, 0x10, 0x00, 0xF8, 0x03, 0xFC, 0x03, 0x08, 0x00, - 0x00, 0xFC, 0x03, 0x18, 0x00, 0x30, 0x00, 0x60, 0x00, 0xC0, 0x00, 0x80, - 0x01, 0xFC, 0x03, 0x08, 0x00, 0x00, 0xF8, 0x01, 0xFC, 0x03, 0x04, 0x02, - 0x04, 0x02, 0x04, 0x02, 0xFC, 0x03, 0xF8, 0x01, 0x07, 0x00, 0x00, 0xFC, - 0x03, 0xFC, 0x03, 0x44, 0x00, 0x44, 0x00, 0x7C, 0x00, 0x38, 0x00, 0x08, - 0x00, 0x00, 0xF8, 0x01, 0xFC, 0x03, 0x04, 0x02, 0x04, 0x06, 0x04, 0x0E, - 0xFC, 0x0B, 0xF8, 0x09, 0x08, 0x00, 0x00, 0xFC, 0x03, 0xFC, 0x03, 0x44, - 0x00, 0xC4, 0x00, 0xFC, 0x01, 0x38, 0x03, 0x00, 0x02, 0x07, 0x00, 0x00, - 0x38, 0x01, 0x7C, 0x02, 0x64, 0x02, 0x64, 0x02, 0xE4, 0x03, 0xC8, 0x01, - 0x08, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0xFC, 0x03, 0xFC, 0x03, 0x04, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0xFC, 0x01, 0xFC, 0x03, - 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xFC, 0x03, 0xFC, 0x01, 0x07, 0x00, - 0x00, 0x1C, 0x00, 0xFC, 0x00, 0xE0, 0x03, 0xE0, 0x03, 0xFC, 0x00, 0x1C, - 0x00, 0x0B, 0x00, 0x00, 0x1C, 0x00, 0xFC, 0x00, 0xE0, 0x03, 0xC0, 0x03, - 0x7C, 0x00, 0x7C, 0x00, 0xC0, 0x03, 0xE0, 0x03, 0xFC, 0x00, 0x1C, 0x00, - 0x07, 0x00, 0x00, 0x0C, 0x03, 0x9C, 0x03, 0xF0, 0x00, 0xF0, 0x00, 0x9C, - 0x03, 0x0C, 0x03, 0x07, 0x00, 0x00, 0x0C, 0x00, 0x3C, 0x00, 0xF0, 0x03, - 0xF0, 0x03, 0x3C, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x00, 0x84, 0x03, 0xC4, - 0x03, 0xE4, 0x02, 0x74, 0x02, 0x3C, 0x02, 0x1C, 0x02, 0x05, 0x00, 0x00, - 0xFE, 0x0F, 0xFE, 0x0F, 0x02, 0x08, 0x02, 0x08, 0x07, 0x00, 0x00, 0x06, - 0x00, 0x1E, 0x00, 0xF8, 0x00, 0xE0, 0x03, 0x00, 0x0F, 0x00, 0x0C, 0x05, - 0x00, 0x00, 0x02, 0x08, 0x02, 0x08, 0xFE, 0x0F, 0xFE, 0x0F, 0x09, 0x00, - 0x00, 0x20, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, - 0x00, 0x30, 0x00, 0x20, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, - 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, - 0x80, 0x01, 0xD0, 0x03, 0x50, 0x02, 0x50, 0x02, 0xF0, 0x03, 0xE0, 0x03, - 0x07, 0x00, 0x00, 0xFE, 0x03, 0xFE, 0x03, 0x10, 0x02, 0x10, 0x02, 0xF0, - 0x03, 0xE0, 0x01, 0x06, 0x00, 0x00, 0xE0, 0x01, 0xF0, 0x03, 0x10, 0x02, - 0x10, 0x02, 0x10, 0x02, 0x07, 0x00, 0x00, 0xE0, 0x01, 0xF0, 0x03, 0x10, - 0x02, 0x10, 0x02, 0xFE, 0x03, 0xFE, 0x03, 0x07, 0x00, 0x00, 0xE0, 0x01, - 0xF0, 0x03, 0x50, 0x02, 0x50, 0x02, 0x70, 0x02, 0x60, 0x01, 0x05, 0x10, - 0x00, 0xFC, 0x03, 0xFE, 0x03, 0x12, 0x00, 0x12, 0x00, 0x07, 0x00, 0x00, - 0xE0, 0x01, 0xF0, 0x0B, 0x10, 0x0A, 0x10, 0x0A, 0xF0, 0x0F, 0xF0, 0x07, - 0x07, 0x00, 0x00, 0xFE, 0x03, 0xFE, 0x03, 0x10, 0x00, 0x10, 0x00, 0xF0, - 0x03, 0xE0, 0x03, 0x03, 0x00, 0x00, 0xF4, 0x03, 0xF4, 0x03, 0x04, 0x00, - 0x08, 0x10, 0x08, 0xF4, 0x0F, 0xF4, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, - 0xFE, 0x03, 0xC0, 0x00, 0xE0, 0x01, 0x30, 0x03, 0x10, 0x02, 0x03, 0x00, - 0x00, 0xFE, 0x03, 0xFE, 0x03, 0x0B, 0x00, 0x00, 0xF0, 0x03, 0xF0, 0x03, - 0x10, 0x00, 0x10, 0x00, 0xF0, 0x03, 0xE0, 0x03, 0x10, 0x00, 0x10, 0x00, - 0xF0, 0x03, 0xE0, 0x03, 0x07, 0x00, 0x00, 0xF0, 0x03, 0xF0, 0x03, 0x10, - 0x00, 0x10, 0x00, 0xF0, 0x03, 0xE0, 0x03, 0x07, 0x00, 0x00, 0xE0, 0x01, - 0xF0, 0x03, 0x10, 0x02, 0x10, 0x02, 0xF0, 0x03, 0xE0, 0x01, 0x07, 0x00, - 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x10, 0x02, 0x10, 0x02, 0xF0, 0x03, 0xE0, - 0x01, 0x07, 0x00, 0x00, 0xE0, 0x01, 0xF0, 0x03, 0x10, 0x02, 0x10, 0x02, - 0xF0, 0x0F, 0xF0, 0x0F, 0x06, 0x00, 0x00, 0xF0, 0x03, 0xF0, 0x03, 0x20, - 0x00, 0x30, 0x00, 0x30, 0x00, 0x06, 0x00, 0x00, 0x60, 0x02, 0xF0, 0x02, - 0xD0, 0x02, 0xD0, 0x03, 0x90, 0x01, 0x05, 0x10, 0x00, 0xFC, 0x01, 0xFC, - 0x03, 0x10, 0x02, 0x10, 0x02, 0x07, 0x00, 0x00, 0xF0, 0x01, 0xF0, 0x03, - 0x00, 0x02, 0x00, 0x02, 0xF0, 0x03, 0xF0, 0x03, 0x07, 0x00, 0x00, 0x70, - 0x00, 0xF0, 0x01, 0x80, 0x03, 0x80, 0x03, 0xF0, 0x01, 0x70, 0x00, 0x09, - 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x03, 0x00, 0x03, 0xF0, 0x00, 0xF0, 0x00, - 0x00, 0x03, 0xF0, 0x03, 0xF0, 0x00, 0x07, 0x00, 0x00, 0x30, 0x03, 0xF0, - 0x03, 0xC0, 0x00, 0xC0, 0x00, 0xF0, 0x03, 0x30, 0x03, 0x07, 0x00, 0x00, - 0x30, 0x00, 0xF0, 0x0C, 0xC0, 0x0F, 0xC0, 0x03, 0xF0, 0x00, 0x30, 0x00, - 0x06, 0x00, 0x00, 0x10, 0x03, 0x90, 0x03, 0xD0, 0x02, 0x70, 0x02, 0x30, - 0x02, 0x07, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0xFC, 0x07, 0xBE, 0x0F, - 0x02, 0x08, 0x02, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0xFE, - 0x0F, 0x07, 0x00, 0x00, 0x02, 0x08, 0x02, 0x08, 0xBE, 0x0F, 0xFC, 0x07, - 0x40, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00, 0xC0, 0x01, 0x20, 0x00, 0x20, - 0x00, 0xC0, 0x00, 0x00, 0x01, 0x00, 0x01, 0xE0, 0x00, 0x04, 0xFC, 0x03, - 0xFC, 0x03, 0xFC, 0x03, 0xFC, 0x03 - }; -#endif - -#if 0 // font_MediumBold (UI Font Option 2) -// -// Font table for Tahoma font, height = 11 (including the decenders) -// The font table contains 3 sections: Header, Table Of Character Indexes, Pixel data -// -// The Header contains two bytes: -// Byte0 = Font height (including decenders) -// Byte1 = Number of additional pixels that should be drawn right of char -// Byte2 = Recommended line spacing -// Byte3 = Height of decenders -// Byte4 = Unused byte -// -// The Table Of Character Indexes, is a table of 2 byte words that index to the pixel data within this table -// Word0 = Index into this table to the pixels for ASCII char 0x20 -// Word1 = Index into this table to the pixels for ASCII char 0x21 -// Word2 = Index into this table to the pixels for ASCII char 0x22 -// ... -// Word95 = Index into this table to the pixels for ASCII char 0x7F -// -// The Pixel data table contains the bitmap for each character -// Data is written in columns of pixels, each column is 16 bits (2 bytes) -// Byte0 = width of the ASCII 0x20 character in pixels -// Byte1 = pixel data for the 0x20 char's 1st top column, bit 0 is the top pixel, bit 7 is the 8th pixel down from the top -// Byte2 = pixel data for the 0x20 char's 1st bottom column, bit 0 is the 9th pixel -// Byte5 = pixel data for the 0x20 char's 2nd top column -// Byte6 = pixel data for the 0x20 char's 2nd bottom column -// ... = remaining pairs of bytes of the columns in the 0x20 char -// ... = width of the 0x21 char in pixels -// ... = pixel data for the 0x21 char -// ... -// -const uint8_t font_MediumBold[] = { - 0x0B, 0x01, 0x0D, 0x02, 0x00, - - 0xC5, 0x00, 0xCE, 0x00, 0xD3, 0x00, 0xDE, 0x00, 0xEF, 0x00, 0xFC, 0x00, - 0x15, 0x01, 0x26, 0x01, 0x2B, 0x01, 0x34, 0x01, 0x3D, 0x01, 0x4A, 0x01, - 0x5B, 0x01, 0x60, 0x01, 0x69, 0x01, 0x6E, 0x01, 0x79, 0x01, 0x86, 0x01, - 0x93, 0x01, 0xA0, 0x01, 0xAD, 0x01, 0xBA, 0x01, 0xC7, 0x01, 0xD4, 0x01, - 0xE1, 0x01, 0xEE, 0x01, 0xFB, 0x01, 0x00, 0x02, 0x05, 0x02, 0x16, 0x02, - 0x27, 0x02, 0x38, 0x02, 0x43, 0x02, 0x56, 0x02, 0x65, 0x02, 0x72, 0x02, - 0x7F, 0x02, 0x8E, 0x02, 0x99, 0x02, 0xA4, 0x02, 0xB3, 0x02, 0xC2, 0x02, - 0xCB, 0x02, 0xD6, 0x02, 0xE3, 0x02, 0xEE, 0x02, 0x01, 0x03, 0x0E, 0x03, - 0x1D, 0x03, 0x2A, 0x03, 0x39, 0x03, 0x48, 0x03, 0x55, 0x03, 0x62, 0x03, - 0x71, 0x03, 0x7E, 0x03, 0x93, 0x03, 0xA0, 0x03, 0xAD, 0x03, 0xBA, 0x03, - 0xC3, 0x03, 0xCE, 0x03, 0xD7, 0x03, 0xE6, 0x03, 0xF5, 0x03, 0xFE, 0x03, - 0x0B, 0x04, 0x18, 0x04, 0x23, 0x04, 0x30, 0x04, 0x3D, 0x04, 0x46, 0x04, - 0x53, 0x04, 0x60, 0x04, 0x65, 0x04, 0x6C, 0x04, 0x79, 0x04, 0x7E, 0x04, - 0x93, 0x04, 0xA0, 0x04, 0xAD, 0x04, 0xBA, 0x04, 0xC7, 0x04, 0xD0, 0x04, - 0xDB, 0x04, 0xE4, 0x04, 0xF1, 0x04, 0xFE, 0x04, 0x0F, 0x05, 0x1C, 0x05, - 0x29, 0x05, 0x34, 0x05, 0x41, 0x05, 0x4A, 0x05, 0x57, 0x05, 0x68, 0x05, - - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7E, 0x01, - 0x7E, 0x01, 0x05, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, - 0x00, 0x08, 0xC0, 0x00, 0xD8, 0x03, 0xF8, 0x00, 0xDE, 0x00, 0xD8, 0x03, - 0xF8, 0x00, 0xDE, 0x00, 0x18, 0x00, 0x06, 0x98, 0x00, 0x3C, 0x01, 0xE4, - 0x07, 0x3F, 0x01, 0xE4, 0x01, 0xC8, 0x00, 0x0C, 0x1C, 0x00, 0x3E, 0x00, - 0x22, 0x00, 0x3E, 0x00, 0x9C, 0x01, 0x60, 0x00, 0x18, 0x00, 0xE6, 0x00, - 0xF0, 0x01, 0x10, 0x01, 0xF0, 0x01, 0xE0, 0x00, 0x08, 0xEC, 0x00, 0xFE, - 0x01, 0x12, 0x01, 0x3E, 0x01, 0x6C, 0x01, 0xC0, 0x00, 0xB0, 0x01, 0x10, - 0x01, 0x02, 0x07, 0x00, 0x07, 0x00, 0x04, 0xF8, 0x00, 0xFE, 0x03, 0x07, - 0x07, 0x01, 0x04, 0x04, 0x01, 0x04, 0x07, 0x07, 0xFE, 0x03, 0xF8, 0x00, - 0x06, 0x0A, 0x00, 0x04, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x04, 0x00, 0x0A, - 0x00, 0x08, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xFC, 0x01, - 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x02, 0x80, 0x07, 0x80, 0x03, 0x04, - 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x02, 0x80, 0x01, 0x80, - 0x01, 0x05, 0x00, 0x06, 0x80, 0x01, 0x70, 0x00, 0x0C, 0x00, 0x03, 0x00, - 0x06, 0xFC, 0x00, 0xFE, 0x01, 0x02, 0x01, 0x02, 0x01, 0xFE, 0x01, 0xFC, - 0x00, 0x06, 0x00, 0x00, 0x04, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0x00, 0x01, - 0x00, 0x00, 0x06, 0x84, 0x01, 0xC6, 0x01, 0x62, 0x01, 0x32, 0x01, 0x1E, - 0x01, 0x0C, 0x01, 0x06, 0x84, 0x00, 0x86, 0x01, 0x12, 0x01, 0x12, 0x01, - 0xFE, 0x01, 0xEC, 0x00, 0x06, 0x60, 0x00, 0x50, 0x00, 0x48, 0x00, 0xFC, - 0x01, 0xFE, 0x01, 0x40, 0x00, 0x06, 0x80, 0x00, 0x9E, 0x01, 0x1E, 0x01, - 0x12, 0x01, 0xF2, 0x01, 0xE2, 0x00, 0x06, 0xFC, 0x00, 0xFE, 0x01, 0x12, - 0x01, 0x12, 0x01, 0xF2, 0x01, 0xE0, 0x00, 0x06, 0x02, 0x00, 0x02, 0x00, - 0xC2, 0x01, 0xFA, 0x01, 0x3E, 0x00, 0x06, 0x00, 0x06, 0xEC, 0x00, 0xFE, - 0x01, 0x12, 0x01, 0x12, 0x01, 0xFE, 0x01, 0xEC, 0x00, 0x06, 0x1C, 0x00, - 0x3E, 0x01, 0x22, 0x01, 0x22, 0x01, 0xFE, 0x01, 0xFC, 0x00, 0x02, 0x98, - 0x01, 0x98, 0x01, 0x02, 0x98, 0x07, 0x98, 0x03, 0x08, 0x00, 0x00, 0x20, - 0x00, 0x50, 0x00, 0x50, 0x00, 0x88, 0x00, 0x88, 0x00, 0x04, 0x01, 0x04, - 0x01, 0x08, 0x00, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, - 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x08, 0x00, 0x00, 0x04, 0x01, 0x04, - 0x01, 0x88, 0x00, 0x88, 0x00, 0x50, 0x00, 0x50, 0x00, 0x20, 0x00, 0x05, - 0x04, 0x00, 0x62, 0x01, 0x72, 0x01, 0x1E, 0x00, 0x0C, 0x00, 0x09, 0xF8, - 0x00, 0x04, 0x01, 0x72, 0x02, 0xFA, 0x02, 0x8A, 0x02, 0x7A, 0x02, 0xFA, - 0x02, 0x84, 0x00, 0x78, 0x00, 0x07, 0xC0, 0x01, 0xF8, 0x01, 0x7E, 0x00, - 0x46, 0x00, 0x7E, 0x00, 0xF8, 0x01, 0xC0, 0x01, 0x06, 0xFE, 0x01, 0xFE, - 0x01, 0x12, 0x01, 0x12, 0x01, 0xFE, 0x01, 0xEC, 0x00, 0x06, 0xFC, 0x00, - 0xFE, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x07, 0xFE, - 0x01, 0xFE, 0x01, 0x02, 0x01, 0x02, 0x01, 0x86, 0x01, 0xFC, 0x00, 0x78, - 0x00, 0x05, 0xFE, 0x01, 0xFE, 0x01, 0x12, 0x01, 0x12, 0x01, 0x12, 0x01, - 0x05, 0xFE, 0x01, 0xFE, 0x01, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x07, - 0xFC, 0x00, 0xFE, 0x01, 0x02, 0x01, 0x02, 0x01, 0x22, 0x01, 0xE2, 0x01, - 0xE2, 0x01, 0x07, 0xFE, 0x01, 0xFE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x10, - 0x00, 0xFE, 0x01, 0xFE, 0x01, 0x04, 0x02, 0x01, 0xFE, 0x01, 0xFE, 0x01, - 0x02, 0x01, 0x05, 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0xFE, 0x01, 0xFE, - 0x00, 0x06, 0xFE, 0x01, 0xFE, 0x01, 0x78, 0x00, 0xCC, 0x00, 0x86, 0x01, - 0x02, 0x01, 0x05, 0xFE, 0x01, 0xFE, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x01, 0x09, 0xFE, 0x01, 0x0E, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x30, 0x00, - 0x18, 0x00, 0x0C, 0x00, 0xFE, 0x01, 0xFE, 0x01, 0x06, 0xFE, 0x01, 0x0E, - 0x00, 0x1C, 0x00, 0x38, 0x00, 0x70, 0x00, 0xFE, 0x01, 0x07, 0xFC, 0x00, - 0xFE, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0xFE, 0x01, 0xFC, 0x00, - 0x06, 0xFE, 0x01, 0xFE, 0x01, 0x22, 0x00, 0x22, 0x00, 0x3E, 0x00, 0x1C, - 0x00, 0x07, 0xFC, 0x00, 0xFE, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x07, - 0xFE, 0x05, 0xFC, 0x04, 0x07, 0xFE, 0x01, 0xFE, 0x01, 0x22, 0x00, 0x62, - 0x00, 0xFE, 0x00, 0x9C, 0x01, 0x00, 0x01, 0x06, 0x1C, 0x01, 0x3E, 0x01, - 0x32, 0x01, 0x32, 0x01, 0xF2, 0x01, 0xE2, 0x00, 0x06, 0x02, 0x00, 0x02, - 0x00, 0xFE, 0x01, 0xFE, 0x01, 0x02, 0x00, 0x02, 0x00, 0x07, 0xFE, 0x00, - 0xFE, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xFE, 0x01, 0xFE, 0x00, - 0x06, 0x0E, 0x00, 0x7E, 0x00, 0xF0, 0x01, 0xF0, 0x01, 0x7E, 0x00, 0x0E, - 0x00, 0x0A, 0x0E, 0x00, 0x7E, 0x00, 0xF0, 0x01, 0xE0, 0x01, 0x3E, 0x00, - 0x3E, 0x00, 0xE0, 0x01, 0xF0, 0x01, 0x7E, 0x00, 0x0E, 0x00, 0x06, 0x86, - 0x01, 0xCE, 0x01, 0x78, 0x00, 0x78, 0x00, 0xCE, 0x01, 0x86, 0x01, 0x06, - 0x06, 0x00, 0x1E, 0x00, 0xF8, 0x01, 0xF8, 0x01, 0x1E, 0x00, 0x06, 0x00, - 0x06, 0xC2, 0x01, 0xE2, 0x01, 0x72, 0x01, 0x3A, 0x01, 0x1E, 0x01, 0x0E, - 0x01, 0x04, 0xFF, 0x07, 0xFF, 0x07, 0x01, 0x04, 0x01, 0x04, 0x05, 0x03, - 0x00, 0x0C, 0x00, 0x70, 0x00, 0x80, 0x01, 0x00, 0x06, 0x04, 0x01, 0x04, - 0x01, 0x04, 0xFF, 0x07, 0xFF, 0x07, 0x07, 0x10, 0x00, 0x08, 0x00, 0x04, - 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x07, 0x00, 0x04, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, - 0x04, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0x06, 0xC0, 0x00, - 0xE8, 0x01, 0x28, 0x01, 0x28, 0x01, 0xF8, 0x01, 0xF0, 0x01, 0x06, 0xFF, - 0x01, 0xFF, 0x01, 0x08, 0x01, 0x08, 0x01, 0xF8, 0x01, 0xF0, 0x00, 0x05, - 0xF0, 0x00, 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x06, 0xF0, - 0x00, 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0x06, - 0xF0, 0x00, 0xF8, 0x01, 0x28, 0x01, 0x28, 0x01, 0x38, 0x01, 0x30, 0x01, - 0x04, 0xFE, 0x01, 0xFF, 0x01, 0x09, 0x00, 0x01, 0x00, 0x06, 0xF0, 0x00, - 0xF8, 0x05, 0x08, 0x05, 0x08, 0x05, 0xF8, 0x07, 0xF8, 0x03, 0x06, 0xFF, - 0x01, 0xFF, 0x01, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x01, 0xF0, 0x01, 0x02, - 0xFA, 0x01, 0xFA, 0x01, 0x03, 0x08, 0x04, 0xFA, 0x07, 0xFA, 0x03, 0x06, - 0xFF, 0x01, 0xFF, 0x01, 0x60, 0x00, 0xF0, 0x00, 0x98, 0x01, 0x08, 0x01, - 0x02, 0xFF, 0x01, 0xFF, 0x01, 0x0A, 0xF8, 0x01, 0xF8, 0x01, 0x08, 0x00, - 0x08, 0x00, 0xF8, 0x01, 0xF0, 0x01, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x01, - 0xF0, 0x01, 0x06, 0xF8, 0x01, 0xF8, 0x01, 0x08, 0x00, 0x08, 0x00, 0xF8, - 0x01, 0xF0, 0x01, 0x06, 0xF0, 0x00, 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, - 0xF8, 0x01, 0xF0, 0x00, 0x06, 0xF8, 0x07, 0xF8, 0x07, 0x08, 0x01, 0x08, - 0x01, 0xF8, 0x01, 0xF0, 0x00, 0x06, 0xF0, 0x00, 0xF8, 0x01, 0x08, 0x01, - 0x08, 0x01, 0xF8, 0x07, 0xF8, 0x07, 0x04, 0xF8, 0x01, 0xF8, 0x01, 0x10, - 0x00, 0x18, 0x00, 0x05, 0x30, 0x01, 0x78, 0x01, 0x68, 0x01, 0xE8, 0x01, - 0xC8, 0x00, 0x04, 0xFE, 0x00, 0xFE, 0x01, 0x08, 0x01, 0x08, 0x01, 0x06, - 0xF8, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0xF8, 0x01, 0xF8, 0x01, - 0x06, 0x18, 0x00, 0x78, 0x00, 0xE0, 0x01, 0xE0, 0x01, 0x78, 0x00, 0x18, - 0x00, 0x08, 0x78, 0x00, 0xF8, 0x01, 0xC0, 0x01, 0x78, 0x00, 0x78, 0x00, - 0xC0, 0x01, 0xF8, 0x01, 0x78, 0x00, 0x06, 0x98, 0x01, 0xF8, 0x01, 0x60, - 0x00, 0x60, 0x00, 0xF8, 0x01, 0x98, 0x01, 0x06, 0x18, 0x00, 0x78, 0x06, - 0xE0, 0x07, 0xE0, 0x01, 0x78, 0x00, 0x18, 0x00, 0x05, 0x88, 0x01, 0xC8, - 0x01, 0x68, 0x01, 0x38, 0x01, 0x18, 0x01, 0x06, 0x20, 0x00, 0x20, 0x00, - 0xFE, 0x03, 0xDF, 0x07, 0x01, 0x04, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0xFF, 0x07, 0xFF, 0x07, 0x06, 0x01, 0x04, 0x01, 0x04, 0xDF, 0x07, - 0xFE, 0x03, 0x20, 0x00, 0x20, 0x00, 0x08, 0x60, 0x00, 0x10, 0x00, 0x10, - 0x00, 0x30, 0x00, 0x60, 0x00, 0x40, 0x00, 0x40, 0x00, 0x30, 0x00, 0x04, - 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01 -}; - - - - -#endif - -#if 1 // font_LargeNumbers -// -// Large numbers font, height = 16 (including the decenders) -// Characters include: 0 - 9, -, +, ., %, :, Space, Comma -// The font table contains 3 sections: Header, Table Of Character Indexes, Pixel data -// -// The Header contains two bytes: -// Byte0 = Font height (including decenders) -// Byte1 = Number of additional pixels that should be drawn right of char -// Byte2 = Recommended line spacing -// Byte3 = Height of decenders -// Byte4 = Unused byte -// -// The Table Of Character Indexes, is a table of 2 byte words that index to the pixel data within this table -// Word0 = Index into this table to the pixels for ASCII char 0x20 -// Word1 = Index into this table to the pixels for ASCII char 0x21 -// Word2 = Index into this table to the pixels for ASCII char 0x22 -// ... -// Word95 = Index into this table to the pixels for ASCII char 0x7F -// -// The Pixel data table contains the bitmap for each character -// Data is written in columns of pixels, each column is 16 bits (2 bytes) -// Byte0 = width of the ASCII 0x20 character in pixels -// Byte1 = pixel data for the 0x20 char's 1st top column, bit 0 is the top pixel, bit 7 is the 8th pixel down from the top -// Byte2 = pixel data for the 0x20 char's 1st bottom column, bit 0 is the 9th pixel -// Byte5 = pixel data for the 0x20 char's 2nd top column -// Byte6 = pixel data for the 0x20 char's 2nd bottom column -// ... = remaining pairs of bytes of the columns in the 0x20 char -// ... = width of the 0x21 char in pixels -// ... = pixel data for the 0x21 char -// ... -// -const uint8_t font_LargeNumbers[] = { - 0x10, 0x02, 0x15, 0x01, 0x00, - - 0xC5, 0x00, 0xC6, 0x00, 0xC7, 0x00, 0xC8, 0x00, 0xC9, 0x00, 0xCA, 0x00, - 0xE9, 0x00, 0xEA, 0x00, 0xEB, 0x00, 0xEC, 0x00, 0xED, 0x00, 0xEE, 0x00, - 0x05, 0x01, 0x0C, 0x01, 0x19, 0x01, 0x20, 0x01, 0x21, 0x01, 0x36, 0x01, - 0x4B, 0x01, 0x60, 0x01, 0x75, 0x01, 0x8A, 0x01, 0x9F, 0x01, 0xB4, 0x01, - 0xC9, 0x01, 0xDE, 0x01, - - 0xF3, 0x01, 0xFC, 0x01, 0xFD, 0x01, 0xFE, 0x01, - - 0xFF, 0x01, 0x00, 0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, 0x02, - 0x05, 0x02, 0x06, 0x02, 0x07, 0x02, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, - 0x0B, 0x02, 0x0C, 0x02, 0x0D, 0x02, 0x0E, 0x02, 0x0F, 0x02, 0x10, 0x02, - 0x11, 0x02, 0x12, 0x02, 0x13, 0x02, 0x14, 0x02, 0x15, 0x02, 0x16, 0x02, - 0x17, 0x02, 0x18, 0x02, 0x19, 0x02, 0x1A, 0x02, 0x1B, 0x02, 0x1C, 0x02, - 0x1D, 0x02, 0x1E, 0x02, 0x1F, 0x02, 0x20, 0x02, 0x21, 0x02, 0x22, 0x02, - 0x23, 0x02, 0x24, 0x02, 0x25, 0x02, 0x26, 0x02, 0x27, 0x02, 0x28, 0x02, - 0x29, 0x02, 0x2A, 0x02, 0x2B, 0x02, 0x2C, 0x02, 0x2D, 0x02, 0x2E, 0x02, - 0x2F, 0x02, 0x30, 0x02, 0x31, 0x02, 0x32, 0x02, 0x33, 0x02, 0x34, 0x02, - 0x35, 0x02, 0x36, 0x02, 0x37, 0x02, 0x38, 0x02, 0x39, 0x02, 0x3A, 0x02, - 0x3B, 0x02, 0x3C, 0x02, 0x3D, 0x02, 0x3E, 0x02, 0x3F, 0x02, 0x40, 0x02, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x7E, 0x00, 0xFF, 0x00, 0xC3, 0x00, - 0xC3, 0x80, 0xFF, 0xE0, 0x7E, 0x7C, 0x00, 0x1F, 0xC0, 0x07, 0xF0, 0x00, - 0x3E, 0x7E, 0x0F, 0xFF, 0x03, 0xC3, 0x00, 0xC3, 0x00, 0xFF, 0x00, 0x7E, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0xC0, 0x01, 0xC0, 0x01, 0xC0, 0x01, - 0xC0, 0x01, 0xFC, 0x1F, 0xFC, 0x1F, 0xFC, 0x1F, 0xC0, 0x01, 0xC0, 0x01, - 0xC0, 0x01, 0xC0, 0x01, 0x03, 0x00, 0x70, 0x00, 0x70, 0x00, 0xF0, 0x06, - 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, - 0x03, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x0A, 0xF8, 0x0F, 0xFE, - 0x3F, 0xFE, 0x3F, 0x07, 0x70, 0x03, 0x60, 0x03, 0x60, 0x07, 0x70, 0xFE, - 0x3F, 0xFE, 0x3F, 0xF8, 0x0F, 0x0A, 0x00, 0x00, 0x70, 0x00, 0x38, 0x00, - 0x38, 0x00, 0x1C, 0x00, 0xFF, 0x7F, 0xFF, 0x7F, 0xFF, 0x7F, 0x00, 0x00, - 0x00, 0x00, 0x0A, 0x0C, 0x60, 0x0E, 0x70, 0x0F, 0x7C, 0x07, 0x7E, 0x03, - 0x6F, 0x83, 0x67, 0xC7, 0x63, 0xFF, 0x61, 0xFE, 0x60, 0x3C, 0x60, 0x0A, - 0x0C, 0x18, 0x0E, 0x38, 0x0F, 0x78, 0xC3, 0x70, 0xC3, 0x60, 0xE3, 0x60, - 0xFF, 0x71, 0xFE, 0x3F, 0x3C, 0x3F, 0x00, 0x0E, 0x0A, 0x00, 0x0F, 0xC0, - 0x0D, 0xE0, 0x0C, 0x38, 0x0C, 0x1E, 0x0C, 0xFF, 0x7F, 0xFF, 0x7F, 0xFF, - 0x7F, 0x00, 0x0C, 0x00, 0x0C, 0x0A, 0xC0, 0x18, 0xFC, 0x38, 0xFF, 0x78, - 0x7F, 0x70, 0x63, 0x60, 0x63, 0x60, 0xE3, 0x70, 0xE3, 0x3F, 0xC3, 0x3F, - 0x80, 0x0F, 0x0A, 0xF8, 0x0F, 0xFE, 0x3F, 0xFE, 0x3F, 0xC7, 0x70, 0x63, - 0x60, 0x63, 0x60, 0xE7, 0x70, 0xEF, 0x3F, 0xC6, 0x3F, 0x04, 0x0F, 0x0A, - 0x03, 0x00, 0x03, 0x00, 0x03, 0x78, 0x03, 0x7F, 0xC3, 0x7F, 0xF3, 0x07, - 0xFB, 0x00, 0x3F, 0x00, 0x0F, 0x00, 0x07, 0x00, 0x0A, 0x1C, 0x1E, 0x3E, - 0x3F, 0xFF, 0x7F, 0xE7, 0x71, 0xC3, 0x60, 0xC3, 0x60, 0xE7, 0x71, 0xFF, - 0x7F, 0x3E, 0x3F, 0x1C, 0x1E, 0x0A, 0x78, 0x10, 0xFE, 0x39, 0xFE, 0x7B, - 0x87, 0x73, 0x03, 0x63, 0x03, 0x63, 0x87, 0x71, 0xFE, 0x3F, 0xFE, 0x3F, - 0xF8, 0x0F, 0x04, 0x00, 0x00, 0x38, 0x0E, 0x38, 0x0E, 0x38, 0x0E, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -#endif - diff --git a/glcd/fonts.h b/glcd/fonts.h deleted file mode 100644 index a94b5252..00000000 --- a/glcd/fonts.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -#ifndef _FONT_ -#define _FONT_ - -#define FONT_TABLE_HEIGHT_IDX 0 -#define FONT_TABLE_PAD_AFTER_CHAR_IDX 1 -#define FONT_TABLE_LINE_SPACING_IDX 2 -#define FONT_TABLE_DECENDERS_HEIGHT_IDX 3 -#define FONT_TABLE_UNUSED_IDX 4 -#define FONT_TABLE_CHAR_LOOKUP_IDX 5 - -extern const uint8_t font_Small[]; -extern const uint8_t font_Larger[]; -//extern const uint8_t font_Medium[]; -extern const uint8_t font_MediumBold[]; -extern const uint8_t font_LargeNumbers[]; - -#endif diff --git a/glcd/glcd.c b/glcd/glcd.c index 5ae7c097..9d4db9cf 100644 --- a/glcd/glcd.c +++ b/glcd/glcd.c @@ -1,614 +1,431 @@ -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "glcd.h" -#include "glcdWorker.h" - -#define EMSG(a) const struct a *emsg = (const struct a*)msg - -uint16_t lcd_width, lcd_height; -static Thread *workerThread = NULL; - -/* internal functions; don't include in header */ -inline glcd_result_t _lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); -inline glcd_result_t _lcdWriteArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t *buffer, size_t n); -glcd_result_t _lcdDrawChar(struct glcd_msg_draw_char *m); - -static WORKING_AREA(waGLCDWorkerThread, GLCD_WORKER_SIZE); -static msg_t ThreadGLCDWorker(void *arg) { - (void)arg; - Thread *p; - - chRegSetThreadName("GLCDWorker"); - - while(TRUE) { - /* Wait for msg with work to do. */ - p = chMsgWait(); - struct glcd_msg_base *msg = (struct glcd_msg_base*)chMsgGet(p); - glcd_result_t result = GLCD_PROGRESS; - - /* do work here */ - switch(msg->action) { - case GLCD_SET_POWERMODE: { - EMSG(glcd_msg_powermode); - lld_lcdSetPowerMode(emsg->powermode); - result = GLCD_DONE; - break; - } - - case GLCD_SET_ORIENTATION: { - EMSG(glcd_msg_orientation); - lld_lcdSetOrientation(emsg->newOrientation); - result = GLCD_DONE; - break; - } - - case GLCD_SET_WINDOW: { - EMSG(glcd_msg_set_window); - lld_lcdSetWindow(emsg->x0, emsg->y0, emsg->x1, emsg->y1); - result = GLCD_DONE; - break; - } - - case GLCD_FILL_AREA: { - EMSG(glcd_msg_fill_area); - result = _lcdFillArea(emsg->x0, emsg->y0, emsg->x1, emsg->y1, emsg->color); - break; - } - - case GLCD_WRITE_AREA: { - EMSG(glcd_msg_write_area); - result = _lcdWriteArea(emsg->x0, emsg->y0, emsg->x1, emsg->y1, emsg->buffer, emsg->size); - break; - } - - case GLCD_CLEAR: { - EMSG(glcd_msg_clear); - lld_lcdClear(emsg->color); - result = GLCD_DONE; - break; - } - - case GLCD_GET_PIXEL_COLOR: { - EMSG(glcd_msg_get_pixel_color); - ((struct glcd_msg_get_pixel_color *)emsg)->color = - lld_lcdGetPixelColor(emsg->x, emsg->y); - result = GLCD_DONE; - break; - } - - case GLCD_DRAW_PIXEL: { - EMSG(glcd_msg_draw_pixel); - lld_lcdDrawPixel(emsg->x, emsg->y, emsg->color); - result = GLCD_DONE; - break; - } - - case GLCD_WRITE_STREAM_START: { - lld_lcdWriteStreamStart(); - result = GLCD_DONE; - break; - } - - case GLCD_WRITE_STREAM_STOP: { - lld_lcdWriteStreamStop(); - result = GLCD_DONE; - break; - } - - case GLCD_WRITE_STREAM: { - EMSG(glcd_msg_write_stream); - lld_lcdWriteStream(emsg->buffer, emsg->size); - result = GLCD_DONE; - break; - } - - case GLCD_VERTICAL_SCROLL: { - EMSG(glcd_msg_vertical_scroll); - lld_lcdVerticalScroll(emsg->x0, emsg->y0, emsg->x1, emsg->y1, emsg->lines); - result = GLCD_DONE; - break; - } - - case GLCD_DRAW_CHAR: { - EMSG(glcd_msg_draw_char); - result = _lcdDrawChar(emsg); - break; - } - - default: { - result = GLCD_FAILED; - break; - } - } - - /* Done, release msg again. */ - chMsgRelease(p, (msg_t)result); - - } - - return 0; -} - -void lcdInit(GLCDDriver *glcdp) { - workerThread = chThdCreateStatic(waGLCDWorkerThread, sizeof(waGLCDWorkerThread), NORMALPRIO, ThreadGLCDWorker, NULL); - - lld_lcdInit(); - lcd_width = lcdGetWidth(); - lcd_height = lcdGetHeight(); - - lcdSetPowerMode(powerOn); - lcdSetOrientation(portrait); -} - -uint16_t lcdGetHeight(void) { - return lld_lcdGetHeight(); -} - -uint16_t lcdGetWidth(void) { - return lld_lcdGetWidth(); -} - -uint16_t lcdGetOrientation(void) { - return lld_lcdGetOrientation(); -} - -glcd_result_t lcdSetPowerMode(uint8_t powerMode) { - struct glcd_msg_powermode msg; - - msg.action = GLCD_SET_POWERMODE; - msg.powermode = powerMode; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdSetOrientation(uint8_t newOrientation) { - struct glcd_msg_orientation msg; - - msg.action = GLCD_SET_ORIENTATION; - msg.newOrientation = newOrientation; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdSetWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { - struct glcd_msg_set_window msg; - - msg.action = GLCD_SET_WINDOW; - msg.x0 = x0; - msg.y0 = y0; - msg.x1 = x1; - msg.y1 = y1; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { - struct glcd_msg_fill_area msg; - - msg.action = GLCD_FILL_AREA; - msg.x0 = x0; - msg.y0 = y0; - msg.x1 = x1; - msg.y1 = y1; - msg.color = color; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -inline glcd_result_t _lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { - lld_lcdFillArea(x0, y0, x1, y1, color); - - return GLCD_DONE; -} - -glcd_result_t lcdWriteArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t *buffer, size_t n) { - struct glcd_msg_write_area msg; - - msg.action = GLCD_WRITE_AREA; - msg.x0 = x0; - msg.y0 = y0; - msg.x1 = x1; - msg.y1 = y1; - msg.buffer = buffer; - msg.size = n; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -inline glcd_result_t _lcdWriteArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t *buffer, size_t n) { - lld_lcdSetWindow(x0, y0, x1, y1); - lld_lcdWriteStreamStart(); - lld_lcdWriteStream(buffer, n); - lld_lcdWriteStreamStop(); - - return GLCD_DONE; -} - -glcd_result_t lcdClear(uint16_t color) { - struct glcd_msg_clear msg; - - msg.action = GLCD_CLEAR; - msg.color = color; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -uint16_t lcdGetPixelColor(uint16_t x, uint16_t y) { - struct glcd_msg_get_pixel_color msg; - - msg.action = GLCD_GET_PIXEL_COLOR; - msg.x = x; - msg.y = y; - - chMsgSend(workerThread, (msg_t)&msg); - - return msg.color; -} - -glcd_result_t lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color) { - struct glcd_msg_draw_pixel msg; - - msg.action = GLCD_DRAW_PIXEL; - msg.x = x; - msg.y = y; - msg.color = color; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdWriteStreamStart(void) { - struct glcd_msg_write_stream_start msg; - - msg.action = GLCD_WRITE_STREAM_START; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdWriteStreamStop(void) { - struct glcd_msg_write_stream_stop msg; - - msg.action = GLCD_WRITE_STREAM_STOP; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdWriteStream(uint16_t *buffer, uint16_t size) { - struct glcd_msg_write_stream msg; - - msg.action = GLCD_WRITE_STREAM; - msg.buffer = buffer; - msg.size = size; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -glcd_result_t lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, int16_t lines) { - struct glcd_msg_vertical_scroll msg; - - msg.action = GLCD_VERTICAL_SCROLL; - msg.x0 = x0; - msg.y0 = y0; - msg.x1 = x1; - msg.y1 = y1; - msg.lines = lines; - - return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); -} - -void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { - // speed improvement if vertical or horizontal - if(x0 == x1) { - lcdFillArea(x0, y0, x0+1, y1, color); - } else if (y0 == y1) { - lcdFillArea(x0, y0, x1, y0+1, color); - - } else { - int16_t dy, dx; - int16_t addx = 1, addy = 1; - int16_t P, diff; - - int16_t i = 0; - dx = abs((int16_t)(x1 - x0)); - dy = abs((int16_t)(y1 - y0)); - - if(x0 > x1) - addx = -1; - if(y0 > y1) - addy = -1; - - if(dx >= dy) { - dy *= 2; - P = dy - dx; - diff = P - dx; - - for(; i<=dx; ++i) { - lcdDrawPixel(x0, y0, color); - if(P < 0) { - P += dy; - x0 += addx; - } else { - P += diff; - x0 += addx; - y0 += addy; - } - } - } else { - dx *= 2; - P = dx - dy; - diff = P - dy; - - for(; i<=dy; ++i) { - lcdDrawPixel(x0, y0, color); - if(P < 0) { - P += dx; - y0 += addy; - } else { - P += diff; - x0 += addx; - y0 += addy; - } - } - } - } -} - -uint16_t lcdDrawChar(uint16_t cx, uint16_t cy, char c, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText) { - struct glcd_msg_draw_char msg; - - msg.action = GLCD_DRAW_CHAR; - msg.cx = cx; - msg.cy = cy; - msg.c = c; - msg.font = font; - msg.color = color; - msg.bkcolor = bkcolor; - msg.tpText = tpText; - msg.ret_width = 0; - - chMsgSend(workerThread, (msg_t)&msg); - - return msg.ret_width; -} - -glcd_result_t _lcdDrawChar(struct glcd_msg_draw_char *m) { - /* Working pointer */ - const uint8_t* ptr; - uint8_t x, y; - - /* Variables to store character details */ - uint8_t charWidth; - uint8_t charHeight = lcdGetFontHeight(m->font); - uint8_t padAfterChar = m->font[FONT_TABLE_PAD_AFTER_CHAR_IDX]; - - /* Local var to hold offset in font table */ - uint16_t charStartOffset; - - /* Working buffer for fast non-transparent text rendering [patch by Badger] */ - static uint16_t buf[20*16]; - - /* No support for nongraphic characters, so just ignore them */ - if(m->c < 0x20 || m->c > 0x7F) { - return GLCD_DONE; - } - - /* Read the offset of the character data in the font table from the lookup table */ - charStartOffset = *(uint16_t*)(&m->font[FONT_TABLE_CHAR_LOOKUP_IDX + (m->c - 0x20) * 2]); - - /* After we're done, position the pointer at the offset. - * The first byte that is immediately read will be the font width - * After that, actual 16-bit font data follows, first column down */ - ptr = m->font + charStartOffset; - charWidth = *(ptr++); - - /* Loop through the data and display. The font data is LSB first, down the column */ - for(x = 0; x < charWidth; x++) { - /* Get the font bitmap data for the column */ - uint16_t charData = *(uint16_t*)ptr; - - for(y = 0; y < charHeight; y++) { - /* Draw the LSB on the screen accordingly. */ - if(!m->tpText) { - /* Store data into working buffer (patch by Badger), - * Then write it all onto the LCD in one stroke */ - buf[y*charWidth + x] = (charData & 0x01) ? m->color : m->bkcolor; - } else { - /* Just draw the needed pixels onto the LCD */ - if (charData & 0x01) - lcdDrawPixel(m->cx+x, m->cy+y, m->color); - } - - /* Shift the data down by one bit */ - charData >>= 1; - } - - /* Increment pointer by 2 bytes to the next column */ - ptr += 2; - } - - if(!m->tpText) { - /* [Patch by Badger] Write all in one stroke */ - _lcdWriteArea(m->cx, m->cy, m->cx+charWidth, m->cy+charHeight, buf, charWidth*charHeight); - - /* Do padding after character, if needed for solid text rendering - * TODO: To be optimised */ - if (padAfterChar != 0) { - _lcdFillArea(m->cx+charWidth, m->cy+charHeight, m->cx+charWidth+padAfterChar, m->cy+charHeight, m->bkcolor); - } - } - - /* Return the width of the character, we need it so that lcdDrawString may work - * We don't have a static address counter */ - m->ret_width = charWidth + padAfterChar; - - return GLCD_DONE; -} - -/* WARNING: No boundary checks! Unpredictable behaviour if text exceeds boundary */ -void lcdDrawString(uint16_t x, uint16_t y, const char *str, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText) { - uint16_t cx = x, cy = y; - - while (*str) { - cx += lcdDrawChar(cx, cy, *str++, font, color, bkcolor, tpText); - } -} - -uint16_t lcdMeasureChar(char c, font_t font) { - /* Variables to store character details */ - uint8_t charWidth; - uint8_t padAfterChar = font[FONT_TABLE_PAD_AFTER_CHAR_IDX]; - - /* Local var to hold offset in font table */ - uint16_t charStartOffset; - - /* No support for nongraphic characters, so just ignore them */ - if(c < 0x20 || c > 0x7F) { - return 0; - } - - /* Read the offset of the character data in the font table from the lookup table */ - charStartOffset = *(uint16_t*)(&font[FONT_TABLE_CHAR_LOOKUP_IDX + (c - 0x20) * 2]); - - /* Retrurn the byte at the offset, that's our charWidth */ - charWidth = *(font + charStartOffset); - - return charWidth+padAfterChar; -} - -uint16_t lcdMeasureString(const char *str, font_t font) { - uint16_t result = 0; - - /* Measure each char width, add it, return the result */ - while (*str) - result += lcdMeasureChar(*str++, font); - - return result; -} - -uint16_t lcdBGR2RGB(uint16_t color) { - uint16_t r, g, b, rgb; - - b = ( color>>0 ) & 0x1f; - g = ( color>>5 ) & 0x3f; - r = ( color>>11 ) & 0x1f; - - rgb = (b<<11) + (g<<5) + (r<<0); - - return( rgb ); -} - -void lcdDrawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t filled, uint16_t color) { - uint16_t i, TempX; - uint16_t j, TempY; - - if (x0 > x1) { - TempX = x1; - x1 = x0; - x0 = TempX; - } - if (y0 > y1) { - TempY = y1; - y1 = y0; - y0 = TempY; - } - if(filled) { - lcdFillArea(x0, y0, x1+1, y1+1, color); - } else { - lcdDrawLine(x0, y0, x1, y0, color); - lcdDrawLine(x0, y1, x1, y1, color); - lcdDrawLine(x0, y0, x0, y1, color); - lcdDrawLine(x1, y0, x1, y1+1, color); - } -} - -void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const char* str, font_t font, uint16_t fontColor, uint16_t bkColor) { - uint16_t off_left, off_up; - - off_left = ((x1-x0)-lcdMeasureString(str, font))/2; - off_up = ((y1-y0) - lcdGetFontHeight(font)) / 2; - - lcdDrawRect(x0, y0, x1, y1, filled, bkColor); - /* Abhishek: default to solid text for this? */ - lcdDrawString(x0+off_left, y0+off_up, str, font, fontColor, bkColor, solid); -} - -void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color) { - int16_t a, b, P; - a = 0; - b = radius; - P = 1 - radius; - - do { - if(filled) { - lcdDrawLine(x-a, y+b, x+a, y+b, color); - lcdDrawLine(x-a, y-b, x+a, y-b, color); - lcdDrawLine(x-b, y+a, x+b, y+a, color); - lcdDrawLine(x-b, y-a, x+b, y-a, color); - } else { - lcdDrawPixel(a+x, b+y, color); - lcdDrawPixel(b+x, a+y, color); - lcdDrawPixel(x-a, b+y, color); - lcdDrawPixel(x-b, a+y, color); - lcdDrawPixel(b+x, y-a, color); - lcdDrawPixel(a+x, y-b, color); - lcdDrawPixel(x-a, y-b, color); - lcdDrawPixel(x-b, y-a, color); - } - - if(P < 0) - P += 3 + 2*a++; - else - P += 5 + 2*(a++ - b--); - } while(a <= b); -} - -void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint8_t filled, uint16_t color) { - int dx = 0, dy = b; /* im I. Quadranten von links oben nach rechts unten */ - long a2 = a*a, b2 = b*b; - long err = b2-(2*b-1)*a2, e2; /* Fehler im 1. Schritt */ - - do { - if(filled){ - lcdDrawLine(x-dx,y+dy,x+dx,y+dy, color); - lcdDrawLine(x-dx,y-dy,x+dx,y-dy, color); - }else{ - lcdDrawPixel(x+dx, y+dy, color); /* I. Quadrant */ - lcdDrawPixel(x-dx, y+dy, color); /* II. Quadrant */ - lcdDrawPixel(x-dx, y-dy, color); /* III. Quadrant */ - lcdDrawPixel(x+dx, y-dy, color); /* IV. Quadrant */ - } - - e2 = 2*err; - if(e2 < (2*dx+1)*b2) { - dx++; - err += (2*dx+1)*b2; - } - if(e2 > -(2*dy-1)*a2) { - dy--; - err -= (2*dy-1)*a2; - } - } while(dy >= 0); - - while(dx++ < a) { /* fehlerhafter Abbruch bei flachen Ellipsen (b=1) */ - lcdDrawPixel(x+dx, y, color); /* -> Spitze der Ellipse vollenden */ - lcdDrawPixel(x-dx, y, color); - } -} - +/* + ChibiOS/RT - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "ch.h" +#include "hal.h" + +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + +/* Hack 1: Manually load the low level driver capabilities first so we can + * control what we implement with hardware scrolling and pixel read. + */ +#include "gdisp_lld_config.h" + +/* Hack 2: Force on the bits of functionality that glcd needs. */ +#define HAL_USE_GDISP TRUE +#define GDISP_NEED_VALIDATION FALSE /* The original glcd didn't so we don't here either */ +#define GDISP_NEED_CIRCLE TRUE +#define GDISP_NEED_ELLIPSE TRUE +#define GDISP_NEED_TEXT TRUE +#define GDISP_NEED_SCROLL GDISP_HARDWARE_SCROLL +#define GDISP_NEED_PIXELREAD GDISP_HARDWARE_PIXELREAD +#define GDISP_NEED_CONTROL TRUE +#define GDISP_NEED_MULTITHREAD FALSE /* We implement multi-thread here */ + +/* Now load the low level driver and font structure definitions */ +#include "gdisp_lld.h" +#include "gdisp_fonts.h" + +/* Hack 3: GLCD only supports RGB565. Anything else would require significant API changes. */ +#ifndef GDISP_PIXELFORMAT_RGB565 +#error "GLCD only support drivers with RGB565 pixel format" +#endif + +/* Now load the glcd headers */ +#include "glcd.h" +#include "glcdWorker.h" + +/* Hack 4: Include the emulation code and font tables. + * We have to include it here rather than compiling + * the files as we need to pass our control defines + * as they are not being defined by the application. + * We need to turn off the inclusion of gdisp.h due + * to conflicting type defines etc. + */ +#define _GDISP_H // Prevent gdisp.h from being included +#include "gdisp_emulation.c" +#include "gdisp_fonts.c" + +#define EMSG(a) struct a *emsg = (struct a*)msg + +static Thread *workerThread = NULL; + +static WORKING_AREA(waGLCDWorkerThread, GLCD_WORKER_SIZE); +static msg_t ThreadGLCDWorker(void *arg) { + (void)arg; + Thread *p; + + chRegSetThreadName("GLCDWorker"); + + while(TRUE) { + /* Wait for msg with work to do. */ + p = chMsgWait(); + struct glcd_msg_base *msg = (struct glcd_msg_base*)chMsgGet(p); + glcd_result_t result = GLCD_PROGRESS; + + /* do work here */ + switch(msg->action) { + case GLCD_SET_POWERMODE: { + EMSG(glcd_msg_powermode); + gdisp_lld_control(GDISP_CONTROL_POWER, (void *)(int)emsg->powermode); + result = GLCD_DONE; + break; + } + + case GLCD_SET_ORIENTATION: { + EMSG(glcd_msg_orientation); + gdisp_lld_control(GDISP_CONTROL_ORIENTATION, (void *)(int)emsg->newOrientation); + result = GLCD_DONE; + break; + } + case GLCD_FILL_AREA: { + EMSG(glcd_msg_fill_area); + gdisp_lld_fillarea(emsg->x0, emsg->y0, emsg->x1-emsg->x0+1,emsg->y1-emsg->y0+1,emsg->color); + result = GLCD_DONE; + break; + } + + case GLCD_WRITE_AREA: { + EMSG(glcd_msg_write_area); + gdisp_lld_blitarea(emsg->x0, emsg->y0, emsg->x1-emsg->x0+1, emsg->y1-emsg->y0+1, emsg->buffer); + result = GLCD_DONE; + break; + } + + case GLCD_CLEAR: { + EMSG(glcd_msg_clear); + gdisp_lld_clear(emsg->color); + result = GLCD_DONE; + break; + } + + case GLCD_GET_PIXEL_COLOR: { + /* Hack 5: This may now fail if the low level driver doesn't + * support it. Previously this support was required + * in the driver by GLCD + */ +#if GDISP_HARDWARE_READPIXEL + ((struct glcd_msg_get_pixel_color *)emsg)->color = + gdisp_lld_getpixelcolor(emsg->x, emsg->y); + result = GLCD_DONE; +#else + EMSG(glcd_msg_get_pixel_color); + ((struct glcd_msg_get_pixel_color *)emsg)->color = 0; + result = GLCD_FAILED; +#endif + break; + } + + case GLCD_DRAW_PIXEL: { + EMSG(glcd_msg_draw_pixel); + gdisp_lld_drawpixel(emsg->x, emsg->y, emsg->color); + result = GLCD_DONE; + break; + } + + case GLCD_VERTICAL_SCROLL: { + /* Hack 6: This may now fail if the low level driver doesn't + * support it. Previously this support was required + * in the driver by GLCD + */ +#if GDISP_HARDWARE_SCROLL + EMSG(glcd_msg_vertical_scroll); + gdisp_lld_verticalscroll(emsg->x0, emsg->y0, emsg->x1-emsg->x0+1, emsg->y1-emsg->y0+1, emsg->lines, 0); + result = GLCD_DONE; +#else + result = GLCD_FAILED; +#endif + break; + } + + case GLCD_DRAW_CHAR: { + EMSG(glcd_msg_draw_char); + if (emsg->tpText) + gdisp_lld_drawchar(emsg->cx, emsg->cy, emsg->c, emsg->font, emsg->color); + else + gdisp_lld_fillchar(emsg->cx, emsg->cy, emsg->c, emsg->font, emsg->color, emsg->bkcolor); + /* We can't normally access a high level function here but in this case it is safe + * because the routine only accesses const data members (multi-thread safe). + */ + emsg->ret_width = lcdMeasureChar(emsg->c, emsg->font); + result = GLCD_DONE; + break; + } + + default: { + result = GLCD_FAILED; + break; + } + } + + /* Done, release msg again. */ + chMsgRelease(p, (msg_t)result); + + } + + return 0; +} + +void lcdInit(GLCDDriver *UNUSED(glcdp)) { + workerThread = chThdCreateStatic(waGLCDWorkerThread, sizeof(waGLCDWorkerThread), NORMALPRIO, ThreadGLCDWorker, NULL); + + gdisp_lld_init(); +} + +uint16_t lcdGetHeight(void) { + return GDISP.Height; +} + +uint16_t lcdGetWidth(void) { + return GDISP.Width; +} + +uint16_t lcdGetOrientation(void) { + return GDISP.Orientation; +} + +glcd_result_t lcdSetPowerMode(uint8_t powerMode) { + struct glcd_msg_powermode msg; + + msg.action = GLCD_SET_POWERMODE; + msg.powermode = powerMode; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +glcd_result_t lcdSetOrientation(uint8_t newOrientation) { + struct glcd_msg_orientation msg; + + msg.action = GLCD_SET_ORIENTATION; + msg.newOrientation = newOrientation; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +glcd_result_t lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { + struct glcd_msg_fill_area msg; + + msg.action = GLCD_FILL_AREA; + msg.x0 = x0; + msg.y0 = y0; + msg.x1 = x1; + msg.y1 = y1; + msg.color = color; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +glcd_result_t lcdWriteArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t *buffer, size_t n) { + struct glcd_msg_write_area msg; + + msg.action = GLCD_WRITE_AREA; + msg.x0 = x0; + msg.y0 = y0; + msg.x1 = x1; + msg.y1 = y1; + msg.buffer = buffer; + msg.size = n; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +glcd_result_t lcdClear(uint16_t color) { + struct glcd_msg_clear msg; + + msg.action = GLCD_CLEAR; + msg.color = color; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +uint16_t lcdGetPixelColor(uint16_t x, uint16_t y) { + struct glcd_msg_get_pixel_color msg; + + msg.action = GLCD_GET_PIXEL_COLOR; + msg.x = x; + msg.y = y; + + chMsgSend(workerThread, (msg_t)&msg); + + return msg.color; +} + +glcd_result_t lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color) { + struct glcd_msg_draw_pixel msg; + + msg.action = GLCD_DRAW_PIXEL; + msg.x = x; + msg.y = y; + msg.color = color; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +glcd_result_t lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, int16_t lines) { + struct glcd_msg_vertical_scroll msg; + + msg.action = GLCD_VERTICAL_SCROLL; + msg.x0 = x0; + msg.y0 = y0; + msg.x1 = x1; + msg.y1 = y1; + msg.lines = lines; + + return (glcd_result_t)chMsgSend(workerThread, (msg_t)&msg); +} + +void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { + struct glcd_msg_draw_line msg; + + msg.action = GLCD_DRAW_LINE; + msg.x0 = x0; + msg.y0 = y0; + msg.x1 = x1; + msg.y1 = y1; + msg.color = color; + + chMsgSend(workerThread, (msg_t)&msg); +} + +uint16_t lcdDrawChar(uint16_t cx, uint16_t cy, char c, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText) { + struct glcd_msg_draw_char msg; + + msg.action = GLCD_DRAW_CHAR; + msg.cx = cx; + msg.cy = cy; + msg.c = c; + msg.font = font; + msg.color = color; + msg.bkcolor = bkcolor; + msg.tpText = tpText; + msg.ret_width = 0; + + chMsgSend(workerThread, (msg_t)&msg); + + return msg.ret_width; +} + +void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color) { + struct glcd_msg_draw_circle msg; + + msg.action = GLCD_DRAW_CIRCLE; + msg.x = x; + msg.y = y; + msg.radius = radius; + msg.filled = filled; + msg.color = color; + + chMsgSend(workerThread, (msg_t)&msg); +} + +void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint8_t filled, uint16_t color) { + struct glcd_msg_draw_ellipse msg; + + msg.action = GLCD_DRAW_ELLIPSE; + msg.x = x; + msg.y = y; + msg.a = a; + msg.b = b; + msg.filled = filled; + msg.color = color; + + chMsgSend(workerThread, (msg_t)&msg); +} + +/* WARNING: No boundary checks! Unpredictable behaviour if text exceeds boundary */ +void lcdDrawString(uint16_t x, uint16_t y, const char *str, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText) { + uint16_t cx = x, cy = y; + + while (*str) { + cx += lcdDrawChar(cx, cy, *str++, font, color, bkcolor, tpText); + } +} + +uint16_t lcdMeasureChar(char c, font_t font) { + return (_getCharWidth(font, c)+font->charPadding) * font->xscale; +} + +uint16_t lcdMeasureString(const char *str, font_t font) { + uint16_t result = 0; + + /* Measure each char width, add it, return the result */ + while (*str) + result += lcdMeasureChar(*str++, font); + + return result; +} + +uint16_t lcdGetFontHeight(font_t font) { + return font->height; +} + +uint16_t lcdBGR2RGB(uint16_t color) { + uint16_t r, g, b, rgb; + + b = ( color>>0 ) & 0x1f; + g = ( color>>5 ) & 0x3f; + r = ( color>>11 ) & 0x1f; + + rgb = (b<<11) + (g<<5) + (r<<0); + + return( rgb ); +} + +void lcdDrawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t filled, uint16_t color) { + uint16_t TempX; + uint16_t TempY; + + if (x0 > x1) { + TempX = x1; + x1 = x0; + x0 = TempX; + } + if (y0 > y1) { + TempY = y1; + y1 = y0; + y0 = TempY; + } + if(filled) { + lcdFillArea(x0, y0, x1+1, y1+1, color); + } else { + lcdDrawLine(x0, y0, x1, y0, color); + lcdDrawLine(x0, y1, x1, y1, color); + lcdDrawLine(x0, y0, x0, y1, color); + lcdDrawLine(x1, y0, x1, y1+1, color); + } +} + +void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const char* str, font_t font, uint16_t fontColor, uint16_t bkColor) { + uint16_t off_left, off_up; + + off_left = ((x1-x0)-lcdMeasureString(str, font))/2; + off_up = ((y1-y0) - lcdGetFontHeight(font)) / 2; + + lcdDrawRect(x0, y0, x1, y1, filled, bkColor); + /* Abhishek: default to solid text for this? */ + lcdDrawString(x0+off_left, y0+off_up, str, font, fontColor, bkColor, solid); +} diff --git a/glcd/glcd.h b/glcd/glcd.h index b16e1bb9..9fee528d 100644 --- a/glcd/glcd.h +++ b/glcd/glcd.h @@ -1,123 +1,148 @@ -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef GLCD_H -#define GLCD_H - -#include "ch.h" -#include "hal.h" -#include "fonts.h" - -#if !defined(LCD_USE_FSMC) && !defined(LCD_USE_GPIO) && !defined(LCD_USE_SPI) -#include "glcdconf.h" -#endif - -#include "ssd1289_lld.h" -#include "s6d1121_lld.h" - -#define PORTRAIT (lcdGetOrientation() == portrait || lcdGetOrientation() == portraitInv) -#define LANDSCAPE (lcdGetOrientation() == landscape || lcdGetOrientation() == landscapeInv) - -/* LCD color */ -#define White 0xFFFF -#define Black 0x0000 -#define Grey 0xF7DE -#define Blue 0x001F -#define Blue2 0x051F -#define Red 0xF800 -#define Magenta 0xF81F -#define Green 0x07E0 -#define Cyan 0x7FFF -#define Yellow 0xFFE0 - -#define RGB565CONVERT(red, green, blue) \ -(uint16_t)( (( red >> 3 ) << 11 ) | (( green >> 2 ) << 5 ) | ( blue >> 3 )) - -enum orientation {portrait, landscape, portraitInv, landscapeInv}; -enum filled {frame, filled}; -enum transparency {solid, transparent}; -enum powermode {powerOff, powerOn, sleepOn, sleepOff}; - -typedef const uint8_t* font_t; - -// A few macros -#define lcdGetFontHeight(font) (font[FONT_TABLE_HEIGHT_IDX]) - -/** - * @brief Structure representing a GLCD driver. - */ -typedef struct GLCDDriver GLCDDriver; - -struct GLCDDriver { -}; - -enum glcd_result { GLCD_DONE, - GLCD_FAILED, - GLCD_PROGRESS, - }; - -typedef enum glcd_result glcd_result_t; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Core functions */ -void lcdInit(GLCDDriver *GLCDD1); -glcd_result_t lcdClear(uint16_t color); -glcd_result_t lcdSetOrientation(uint8_t newOrientation); -glcd_result_t lcdSetWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); -glcd_result_t lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); -glcd_result_t lcdWriteArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t *buffer, size_t n); -glcd_result_t lcdSetPowerMode(uint8_t powerMode); - -/* Drawing functions */ -glcd_result_t lcdDrawPixel(uint16_t x, uint16_t y, uint16_t point); -void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); -void lcdDrawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t filled, uint16_t color); -void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const char* str, font_t font, uint16_t fontColor, uint16_t bkColor); -void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color); -void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint8_t filled, uint16_t color); - -/* Text Rendering Functions */ -uint16_t lcdDrawChar(uint16_t cx, uint16_t cy, char c, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText); -void lcdDrawString(uint16_t x, uint16_t y, const char *str, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText); - -/* Character measuring functions */ -uint16_t lcdMeasureChar(char c, font_t font); -uint16_t lcdMeasureString(const char* str, font_t font); - -/* Size and orientation related */ -uint16_t lcdGetHeight(void); -uint16_t lcdGetWidth(void); -uint16_t lcdGetOrientation(void); - -/* BGR->RGB and pixel readback */ -uint16_t lcdBGR2RGB(uint16_t color); -uint16_t lcdGetPixelColor(uint16_t x, uint16_t y); - -/* Scrolling function */ -glcd_result_t lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, int16_t lines); - -#ifdef __cplusplus -} -#endif - -#endif +/* + ChibiOS/RT - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GLCD_H +#define GLCD_H + +#include "ch.h" +#include "hal.h" + +#define PORTRAIT (lcdGetOrientation() == portrait || lcdGetOrientation() == portraitInv) +#define LANDSCAPE (lcdGetOrientation() == landscape || lcdGetOrientation() == landscapeInv) + +/* New fonts */ +extern const struct font fontSmall; +extern const struct font fontSmallDouble; +extern const struct font fontSmallNarrow; +extern const struct font fontLarger; +extern const struct font fontLargerDouble; +extern const struct font fontLargerNarrow; +extern const struct font fontUI1; +extern const struct font fontUI1Double; +extern const struct font fontUI1Narrow; +extern const struct font fontUI2; +extern const struct font fontUI2Double; +extern const struct font fontUI2Narrow; +extern const struct font fontLargeNumbers; +extern const struct font fontLargeNumbersDouble; +extern const struct font fontLargeNumbersNarrow; + +/* Old font names */ +#define font_Small (&fontSmall) +#define font_SmallDouble (&fontSmallDouble) +#define font_SmallNarrow (&fontSmall) +#define font_Larger (&fontLarger) +#define font_LargerDouble (&fontLargerDouble) +#define font_LargerNarrow (&fontLargerNarrow) +#define font_MediumBold (&fontUI1) +#define font_MediumBoldDouble (&fontUI1Double) +#define font_MediumBoldNarrow (&fontUI1Narrow) +#define font_LargeNumbers (&fontLargeNumbers) +#define font_LargeNumbersDouble (&fontLargeNumbersDouble) +#define font_LargeNumbersNarrow (&fontLargeNumbersNarrow) + +/* LCD color - Note that GLCD only supports 16 bit color in the API */ +#define White 0xFFFF +#define Black 0x0000 +#define Grey 0xF7DE +#define Blue 0x001F +#define Blue2 0x051F +#define Red 0xF800 +#define Magenta 0xF81F +#define Green 0x07E0 +#define Cyan 0x7FFF +#define Yellow 0xFFE0 + +#define RGB565CONVERT(red, green, blue) \ +(uint16_t)( (( red >> 3 ) << 11 ) | (( green >> 2 ) << 5 ) | ( blue >> 3 )) + +#ifndef _GDISP_LLD_H + /* Don't double define these at the low level driver */ + typedef const struct font *font_t; + enum orientation {portrait, landscape, portraitInv, landscapeInv}; + enum powermode {powerOff, powerSleep, powerOn}; + #define sleepOn powerSleep + #define sleepOff powerOn +#endif + +enum filled {frame, filled}; +enum transparency {solid, transparent}; + +/** + * @brief Structure representing a GLCD driver. + */ +typedef struct GLCDDriver GLCDDriver; + +struct GLCDDriver { +}; + +enum glcd_result { GLCD_DONE, + GLCD_FAILED, + GLCD_PROGRESS, + }; + +typedef enum glcd_result glcd_result_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Core functions */ +void lcdInit(GLCDDriver *GLCDD1); +glcd_result_t lcdClear(uint16_t color); +glcd_result_t lcdSetOrientation(uint8_t newOrientation); +glcd_result_t lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); +glcd_result_t lcdWriteArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t *buffer, size_t n); +glcd_result_t lcdSetPowerMode(uint8_t powerMode); + +/* Drawing functions */ +glcd_result_t lcdDrawPixel(uint16_t x, uint16_t y, uint16_t point); +void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); +void lcdDrawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t filled, uint16_t color); +void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const char* str, font_t font, uint16_t fontColor, uint16_t bkColor); +void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color); +void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint8_t filled, uint16_t color); + +/* Text Rendering Functions */ +uint16_t lcdDrawChar(uint16_t cx, uint16_t cy, char c, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText); +void lcdDrawString(uint16_t x, uint16_t y, const char *str, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText); + +/* Character measuring functions */ +uint16_t lcdMeasureChar(char c, font_t font); +uint16_t lcdMeasureString(const char* str, font_t font); +uint16_t lcdGetFontHeight(font_t font); + +/* Size and orientation related */ +uint16_t lcdGetHeight(void); +uint16_t lcdGetWidth(void); +uint16_t lcdGetOrientation(void); + +/* BGR->RGB and pixel readback */ +uint16_t lcdBGR2RGB(uint16_t color); +uint16_t lcdGetPixelColor(uint16_t x, uint16_t y); + +/* Scrolling function */ +glcd_result_t lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, int16_t lines); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/glcd/glcd.mk b/glcd/glcd.mk index 2b968472..22ed8922 100644 --- a/glcd/glcd.mk +++ b/glcd/glcd.mk @@ -1,5 +1,5 @@ -LCD_GLCD_SRC = $(LCDLIB)/glcd/glcd.c \ - $(LCDLIB)/glcd/fonts.c \ - $(LCDLIB)/glcd/console.c - -LCD_GLCD_INC = $(LCDLIB)/glcd +LCD_GLCD_SRC = $(LCDLIB)/glcd/glcd.c \ + $(LCDLIB)/glcd/console.c + +LCD_GLCD_INC = $(LCDLIB)/glcd \ + ${CHIBIOS}/os/halext/include ${CHIBIOS}/os/halext/src diff --git a/glcd/glcdWorker.h b/glcd/glcdWorker.h index 5c8bdd56..0d29d2da 100644 --- a/glcd/glcdWorker.h +++ b/glcd/glcdWorker.h @@ -1,153 +1,170 @@ -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef GLCD_WORKER_H -#define GLCD_WORKER_H - -#include "glcd.h" - -#define GLCD_WORKER_SIZE 512 - -enum glcd_action { GLCD_SET_POWERMODE, - GLCD_SET_ORIENTATION, - GLCD_SET_WINDOW, - GLCD_FILL_AREA, - GLCD_WRITE_AREA, - GLCD_CLEAR, - GLCD_GET_PIXEL_COLOR, - GLCD_DRAW_PIXEL, - GLCD_WRITE_STREAM_START, - GLCD_WRITE_STREAM_STOP, - GLCD_WRITE_STREAM, - GLCD_VERTICAL_SCROLL, - GLCD_DRAW_CHAR, - }; - -#define _glcd_msg_base \ - enum glcd_action action; - -struct glcd_msg_base { - _glcd_msg_base -}; - -struct glcd_msg_powermode { - _glcd_msg_base - - uint8_t powermode; -}; - -struct glcd_msg_orientation { - _glcd_msg_base - - uint8_t newOrientation; -}; - -struct glcd_msg_set_window { - _glcd_msg_base - - uint16_t x0; - uint16_t y0; - uint16_t x1; - uint16_t y1; -}; - -struct glcd_msg_fill_area { - _glcd_msg_base - - uint16_t x0; - uint16_t y0; - uint16_t x1; - uint16_t y1; - uint16_t color; -}; - -struct glcd_msg_write_area { - _glcd_msg_base - - uint16_t x0; - uint16_t y0; - uint16_t x1; - uint16_t y1; - uint16_t *buffer; - size_t size; -}; - -struct glcd_msg_clear { - _glcd_msg_base - - uint16_t color; -}; - -struct glcd_msg_get_pixel_color { - _glcd_msg_base - - uint16_t x; - uint16_t y; - uint16_t color; -}; - -struct glcd_msg_draw_pixel { - _glcd_msg_base - - uint16_t x; - uint16_t y; - uint16_t color; -}; - -struct glcd_msg_write_stream_start { - _glcd_msg_base -}; - -struct glcd_msg_write_stream_stop { - _glcd_msg_base -}; - -struct glcd_msg_write_stream { - _glcd_msg_base - - uint16_t *buffer; - uint16_t size; -}; - -struct glcd_msg_vertical_scroll { - _glcd_msg_base - - uint16_t x0; - uint16_t y0; - uint16_t x1; - uint16_t y1; - int16_t lines; -}; - -struct glcd_msg_draw_char { - _glcd_msg_base; - - uint16_t cx; - uint16_t cy; - uint16_t color; - uint16_t bkcolor; - uint16_t ret_width; - char c; - font_t font; - bool_t tpText; -}; - -#endif - +/* + ChibiOS/RT - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GLCD_WORKER_H +#define GLCD_WORKER_H + +#include "glcd.h" + +#define GLCD_WORKER_SIZE 512 + +enum glcd_action { GLCD_SET_POWERMODE, + GLCD_SET_ORIENTATION, + GLCD_FILL_AREA, + GLCD_WRITE_AREA, + GLCD_CLEAR, + GLCD_GET_PIXEL_COLOR, + GLCD_DRAW_PIXEL, + GLCD_VERTICAL_SCROLL, + GLCD_DRAW_CHAR, + GLCD_DRAW_LINE, + GLCD_DRAW_CIRCLE, + GLCD_DRAW_ELLIPSE, + }; + +#define _glcd_msg_base \ + enum glcd_action action; + +struct glcd_msg_base { + _glcd_msg_base +}; + +struct glcd_msg_powermode { + _glcd_msg_base + + uint8_t powermode; +}; + +struct glcd_msg_orientation { + _glcd_msg_base + + uint8_t newOrientation; +}; + +struct glcd_msg_set_window { + _glcd_msg_base + + uint16_t x0; + uint16_t y0; + uint16_t x1; + uint16_t y1; +}; + +struct glcd_msg_fill_area { + _glcd_msg_base + + uint16_t x0; + uint16_t y0; + uint16_t x1; + uint16_t y1; + uint16_t color; +}; + +struct glcd_msg_write_area { + _glcd_msg_base + + uint16_t x0; + uint16_t y0; + uint16_t x1; + uint16_t y1; + uint16_t *buffer; + size_t size; +}; + +struct glcd_msg_clear { + _glcd_msg_base + + uint16_t color; +}; + +struct glcd_msg_get_pixel_color { + _glcd_msg_base + + uint16_t x; + uint16_t y; + uint16_t color; +}; + +struct glcd_msg_draw_pixel { + _glcd_msg_base + + uint16_t x; + uint16_t y; + uint16_t color; +}; + +struct glcd_msg_vertical_scroll { + _glcd_msg_base + + uint16_t x0; + uint16_t y0; + uint16_t x1; + uint16_t y1; + int16_t lines; +}; + +struct glcd_msg_draw_line { + _glcd_msg_base + + uint16_t x0; + uint16_t y0; + uint16_t x1; + uint16_t y1; + int16_t color; +}; + +struct glcd_msg_draw_circle { + _glcd_msg_base + + uint16_t x; + uint16_t y; + uint16_t radius; + uint16_t y1; + uint8_t filled; + int16_t color; +}; + +struct glcd_msg_draw_ellipse { + _glcd_msg_base + + uint16_t x; + uint16_t y; + uint16_t a; + uint16_t b; + uint16_t y1; + uint8_t filled; + int16_t color; +}; + +struct glcd_msg_draw_char { + _glcd_msg_base; + + uint16_t cx; + uint16_t cy; + uint16_t color; + uint16_t bkcolor; + uint16_t ret_width; + char c; + font_t font; + bool_t tpText; +}; + +#endif + diff --git a/glcd/readme.txt b/glcd/readme.txt new file mode 100644 index 00000000..985e87c3 --- /dev/null +++ b/glcd/readme.txt @@ -0,0 +1,25 @@ +GLCD now uses the GDISP low level drivers and fonts. + +To update your make to use this new version: + Add the low level driver yo want to use to your make file. eg. + include $(CHIBIOS)/os/halext/drivers/gdispTestStub/gdisp_lld.mk + +There some restrictions that GLCD places on your use of new features and on the capabilities +of the low level driver. + +They are: + 1/ GLCD requires a driver that supports RGB565 pixel format. This is a + limitation of the GLCD API. To update the API would create compatability + issues with existing applications. + 2/ If you want to use the GLCD scroll or the GLCD read-pixel calls then your + low level driver must support them. If it doesn't these calls will + fail. + 3/ You cannot reduce the code size like in GDISP by defining macros to + compile out code that you are not using. + 4/ Some of the new features of GDISP like right or center justified text are not + supported as there is no equivelant API in GDISP. + 5/ There is no mechanism to send hardware specific commands to the low level driver + such as commands to control the back-light. + +What it does do that GDISP currently doesn't: + 1/ Asynchronous multi-thread support. \ No newline at end of file diff --git a/halext/drivers/gdispS6d1121/s6d1121_lld.c.h b/halext/drivers/gdispS6d1121/s6d1121_lld.c.h index bc929660..c1539fe7 100644 --- a/halext/drivers/gdispS6d1121/s6d1121_lld.c.h +++ b/halext/drivers/gdispS6d1121/s6d1121_lld.c.h @@ -1,491 +1,244 @@ -<<<<<<< HEAD -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef S6D1121_H -#define S6D1121_H - -// I/O assignments -#define LCD_BL_GPIO GPIOB -#define LCD_BL_PIN 8 - -#define LCD_CS_GPIO GPIOD -#define LCD_CS_PIN 7 - -#define LCD_RS_GPIO GPIOD -#define LCD_RS_PIN 11 - -#define LCD_RST_GPIO GPIOD -#define LCD_RST_PIN 10 - -#define LCD_RD_GPIO GPIOD -#define LCD_RD_PIN 9 - -#define LCD_WR_GPIO GPIOD -#define LCD_WR_PIN 8 - -#define LCD_D0_GPIO GPIOD -#define LCD_D4_GPIO GPIOE - -/* all interfaces use RST via GPIO */ -/* TODO: option to disable RST; assumes RST is tied high */ -#define LCD_RST_LOW palClearPad(LCD_RST_GPIO, LCD_RST_PIN) -#define LCD_RST_HIGH palSetPad(LCD_RST_GPIO, LCD_RST_PIN) - -#define s6d1121_delay(n) halPolledDelay(MS2RTT(n)); - -#if defined(LCD_USE_GPIO) - - #define LCD_CS_LOW palClearPad(LCD_CS_GPIO, LCD_CS_PIN) - #define LCD_CS_HIGH palSetPad(LCD_CS_GPIO, LCD_CS_PIN) - - #define LCD_RS_LOW palClearPad(LCD_RS_GPIO, LCD_RS_PIN) - #define LCD_RS_HIGH palSetPad(LCD_RS_GPIO, LCD_RS_PIN) - - #define LCD_RD_LOW palClearPad(LCD_RD_GPIO, LCD_RD_PIN) - #define LCD_RD_HIGH palSetPad(LCD_RD_GPIO, LCD_RD_PIN) - - #define LCD_WR_LOW palClearPad(LCD_WR_GPIO, LCD_WR_PIN) - #define LCD_WR_HIGH palSetPad(LCD_WR_GPIO, LCD_WR_PIN) - - #define LCD_BL_LOW palClearPad(LCD_BL_GPIO, LCD_BL_PIN) - #define LCD_BL_HIGH palSetPad(LCD_BL_GPIO, LCD_BL_PIN) - - - static inline void lld_lcddelay(void) { asm volatile ("nop"); asm volatile ("nop"); } - static inline void lld_lcdwrite(uint16_t db) { - LCD_D4_GPIO->BSRR.W=((~db&0xFFF0)<<16)|(db&0xFFF0); - LCD_D0_GPIO->BSRR.W=((~db&0x000F)<<16)|(db&0x000F); - LCD_WR_LOW; - lld_lcddelay(); - LCD_WR_HIGH; - } - static __inline uint16_t lld_lcdReadData(void) { - uint16_t value=0; - - LCD_RS_HIGH; LCD_WR_HIGH; LCD_RD_LOW; - #ifndef STM32F4XX - // change pin mode to digital input - LCD_DATA_PORT->CRH = 0x47444444; - LCD_DATA_PORT->CRL = 0x47444444; - #endif - #ifndef STM32F4XX - // change pin mode back to digital output - LCD_DATA_PORT->CRH = 0x33333333; - LCD_DATA_PORT->CRL = 0x33333333; - #endif - LCD_RD_HIGH; - return value; - } - static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) { - uint16_t lcdRAM; - - LCD_CS_LOW; LCD_RS_LOW; - lld_lcdwrite(lcdReg); - LCD_RS_HIGH; - lcdRAM = lld_lcdReadData(); - LCD_CS_HIGH; - return lcdRAM; - } - static void lld_lcdWriteIndex(uint16_t lcdReg) { - LCD_RS_LOW; - lld_lcdwrite(lcdReg); - LCD_RS_HIGH; - } - static void lld_lcdWriteData(uint16_t lcdData) { - lld_lcdwrite(lcdData); - } - static void lld_lcdWriteReg(uint16_t lcdReg, uint16_t lcdRegValue) { - LCD_CS_LOW; - lld_lcdWriteIndex(lcdReg); - lld_lcdWriteData(lcdRegValue); - LCD_CS_HIGH; - } - static __inline void lld_lcdWriteStreamStart(void) { - LCD_CS_LOW; - lld_lcdWriteIndex(0x0022); - } - static __inline void lld_lcdWriteStreamStop(void) { - LCD_CS_HIGH; - } - static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { - uint16_t i; - - for(i = 0; i < size; i++) { lld_lcdwrite(buffer[i]); } - } - static __inline void lld_lcdReadStreamStart(void) { /* TODO */ } - static __inline void lld_lcdReadStreamStop(void) { /* TODO */ } - static __inline void lld_lcdReadStream(uint16_t *UNUSED(buffer), size_t UNUSED(size)) { /* TODO */ } - -#elif defined(LCD_USE_FSMC) - #define LCD_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ - #define LCD_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */ - - static __inline void lld_lcdWriteIndex(uint16_t index) { LCD_REG = index; } - static __inline void lld_lcdWriteData(uint16_t data) { LCD_RAM = data; } - static __inline void lld_lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) { - LCD_REG = lcdReg; - LCD_RAM = lcdRegValue; - } - static __inline uint16_t lld_lcdReadData(void) { return (LCD_RAM); } - static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) { - LCD_REG = lcdReg; - return LCD_RAM; - } - static __inline void lld_lcdWriteStreamStart(void) { LCD_REG = 0x0022; } - static __inline void lld_lcdWriteStreamStop(void) {} - static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { - uint16_t i; - for(i = 0; i < size; i++) LCD_RAM = buffer[i]; - } - static __inline void lld_lcdReadStreamStart(void) { LCD_REG = 0x0022; } - static __inline void lld_lcdReadStreamStop(void) {} - static __inline void lld_lcdReadStream(uint16_t *buffer, size_t size) { - uint16_t i; - volatile uint16_t dummy; - - /* throw away first value read */ - dummy = LCD_RAM; - for(i = 0; i < size; i++) buffer[i] = LCD_RAM; - } - -#elif defined(LCD_USE_SPI) - #error "gdispS6d1121: LCD_USE_SPI not implemented yet" - -#else - #error "gdispS6d1121: No known LCD_USE_XXX has been defined" -#endif - -static void lld_lcdSetCursor(coord_t x, coord_t y) { - /* R20h - 8 bit - * R21h - 9 bit - */ - switch(GDISP.Orientation) { - case portraitInv: - lld_lcdWriteReg(0x0020, (SCREEN_WIDTH-1-x) & 0x00FF); - lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT-1-y) & 0x01FF); - break; - case portrait: - lld_lcdWriteReg(0x0020, x & 0x00FF); - lld_lcdWriteReg(0x0021, y & 0x01FF); - break; - case landscape: - lld_lcdWriteReg(0x0020, y & 0x00FF); - lld_lcdWriteReg(0x0021, x & 0x01FF); - break; - case landscapeInv: - lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - y - 1) & 0x00FF); - lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - x - 1) & 0x01FF); - break; - } -} - -static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) { - /* HSA / HEA are 8 bit - * VSA / VEA are 9 bit - * use masks 0x00FF and 0x01FF to enforce this - */ - - switch(GDISP.Orientation) { - case portrait: - lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF)); - lld_lcdWriteReg(0x48, y & 0x01FF); - lld_lcdWriteReg(0x47, (y+cy-1) & 0x01FF); - break; - case landscape: - lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF)); - lld_lcdWriteReg(0x48, x & 0x01FF); - lld_lcdWriteReg(0x47, (x+cx-1) & 0x01FF); - break; - case portraitInv: - lld_lcdWriteReg(0x46, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF)); - lld_lcdWriteReg(0x48, (SCREEN_HEIGHT-(y+cy)) & 0x01FF); - lld_lcdWriteReg(0x47, (SCREEN_HEIGHT-y-1) & 0x01FF); - break; - case landscapeInv: - lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF)); - lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (x+cx)) & 0x01FF); - lld_lcdWriteReg(0x47, (SCREEN_HEIGHT - x - 1) & 0x01FF); - break; - } - - lld_lcdSetCursor(x, y); -} - -static void lld_lcdResetViewPort(void) { - switch(GDISP.Orientation) { - case portrait: - case portraitInv: - lld_lcdSetViewPort(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - break; - case landscape: - case landscapeInv: - lld_lcdSetViewPort(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH); - break; - } -} - -#endif /* S6D1121_H */ -======= -/* - ChibiOS/RT - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef S6D1121_H -#define S6D1121_H - -// I/O assignments -#define LCD_BL_GPIO GPIOB -#define LCD_BL_PIN 8 - -#define LCD_CS_GPIO GPIOD -#define LCD_CS_PIN 7 - -#define LCD_RS_GPIO GPIOD -#define LCD_RS_PIN 11 - -#define LCD_RST_GPIO GPIOD -#define LCD_RST_PIN 10 - -#define LCD_RD_GPIO GPIOD -#define LCD_RD_PIN 9 - -#define LCD_WR_GPIO GPIOD -#define LCD_WR_PIN 8 - -#define LCD_D0_GPIO GPIOD -#define LCD_D4_GPIO GPIOE - -/* all interfaces use RST via GPIO */ -/* TODO: option to disable RST; assumes RST is tied high */ -#define LCD_RST_LOW palClearPad(LCD_RST_GPIO, LCD_RST_PIN) -#define LCD_RST_HIGH palSetPad(LCD_RST_GPIO, LCD_RST_PIN) - -#define s6d1121_delay(n) halPolledDelay(MS2RTT(n)); - -#if defined(LCD_USE_GPIO) - - #define LCD_CS_LOW palClearPad(LCD_CS_GPIO, LCD_CS_PIN) - #define LCD_CS_HIGH palSetPad(LCD_CS_GPIO, LCD_CS_PIN) - - #define LCD_RS_LOW palClearPad(LCD_RS_GPIO, LCD_RS_PIN) - #define LCD_RS_HIGH palSetPad(LCD_RS_GPIO, LCD_RS_PIN) - - #define LCD_RD_LOW palClearPad(LCD_RD_GPIO, LCD_RD_PIN) - #define LCD_RD_HIGH palSetPad(LCD_RD_GPIO, LCD_RD_PIN) - - #define LCD_WR_LOW palClearPad(LCD_WR_GPIO, LCD_WR_PIN) - #define LCD_WR_HIGH palSetPad(LCD_WR_GPIO, LCD_WR_PIN) - - #define LCD_BL_LOW palClearPad(LCD_BL_GPIO, LCD_BL_PIN) - #define LCD_BL_HIGH palSetPad(LCD_BL_GPIO, LCD_BL_PIN) - - - static inline void lld_lcddelay(void) { asm volatile ("nop"); asm volatile ("nop"); } - static inline void lld_lcdwrite(uint16_t db) { - LCD_D4_GPIO->BSRR.W=((~db&0xFFF0)<<16)|(db&0xFFF0); - LCD_D0_GPIO->BSRR.W=((~db&0x000F)<<16)|(db&0x000F); - LCD_WR_LOW; - lld_lcddelay(); - LCD_WR_HIGH; - } - static __inline uint16_t lld_lcdReadData(void) { - uint16_t value=0; - - LCD_RS_HIGH; LCD_WR_HIGH; LCD_RD_LOW; - #ifndef STM32F4XX - // change pin mode to digital input - LCD_DATA_PORT->CRH = 0x47444444; - LCD_DATA_PORT->CRL = 0x47444444; - #endif - #ifndef STM32F4XX - // change pin mode back to digital output - LCD_DATA_PORT->CRH = 0x33333333; - LCD_DATA_PORT->CRL = 0x33333333; - #endif - LCD_RD_HIGH; - return value; - } - static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) { - uint16_t lcdRAM; - - LCD_CS_LOW; LCD_RS_LOW; - lld_lcdwrite(lcdReg); - LCD_RS_HIGH; - lcdRAM = lld_lcdReadData(); - LCD_CS_HIGH; - return lcdRAM; - } - static void lld_lcdWriteIndex(uint16_t lcdReg) { - LCD_RS_LOW; - lld_lcdwrite(lcdReg); - LCD_RS_HIGH; - } - static void lld_lcdWriteData(uint16_t lcdData) { - lld_lcdwrite(lcdData); - } - static void lld_lcdWriteReg(uint16_t lcdReg, uint16_t lcdRegValue) { - LCD_CS_LOW; - lld_lcdWriteIndex(lcdReg); - lld_lcdWriteData(lcdRegValue); - LCD_CS_HIGH; - } - static __inline void lld_lcdWriteStreamStart(void) { - LCD_CS_LOW; - lld_lcdWriteIndex(0x0022); - } - static __inline void lld_lcdWriteStreamStop(void) { - LCD_CS_HIGH; - } - static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { - uint16_t i; - - for(i = 0; i < size; i++) { lld_lcdwrite(buffer[i]); } - } - static __inline void lld_lcdReadStreamStart(void) { /* TODO */ } - static __inline void lld_lcdReadStreamStop(void) { /* TODO */ } - static __inline void lld_lcdReadStream(uint16_t *UNUSED(buffer), size_t UNUSED(size)) { /* TODO */ } - -#elif defined(LCD_USE_FSMC) - #define LCD_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ - #define LCD_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */ - - static __inline void lld_lcdWriteIndex(uint16_t index) { LCD_REG = index; } - static __inline void lld_lcdWriteData(uint16_t data) { LCD_RAM = data; } - static __inline void lld_lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) { - LCD_REG = lcdReg; - LCD_RAM = lcdRegValue; - } - static __inline uint16_t lld_lcdReadData(void) { return (LCD_RAM); } - static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) { - LCD_REG = lcdReg; - return LCD_RAM; - } - static __inline void lld_lcdWriteStreamStart(void) { LCD_REG = 0x0022; } - static __inline void lld_lcdWriteStreamStop(void) {} - static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { - uint16_t i; - for(i = 0; i < size; i++) LCD_RAM = buffer[i]; - } - static __inline void lld_lcdReadStreamStart(void) { LCD_REG = 0x0022; } - static __inline void lld_lcdReadStreamStop(void) {} - static __inline void lld_lcdReadStream(uint16_t *buffer, size_t size) { - uint16_t i; - volatile uint16_t dummy; - - /* throw away first value read */ - dummy = LCD_RAM; - for(i = 0; i < size; i++) buffer[i] = LCD_RAM; - } - -#elif defined(LCD_USE_SPI) - #error "gdispS6d1121: LCD_USE_SPI not implemented yet" - -#else - #error "gdispS6d1121: No known LCD_USE_XXX has been defined" -#endif - -static void lld_lcdSetCursor(coord_t x, coord_t y) { - /* R20h - 8 bit - * R21h - 9 bit - */ - switch(GDISP.Orientation) { - case portraitInv: - lld_lcdWriteReg(0x0020, (SCREEN_WIDTH-1-x) & 0x00FF); - lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT-1-y) & 0x01FF); - break; - case portrait: - lld_lcdWriteReg(0x0020, x & 0x00FF); - lld_lcdWriteReg(0x0021, y & 0x01FF); - break; - case landscape: - lld_lcdWriteReg(0x0020, y & 0x00FF); - lld_lcdWriteReg(0x0021, x & 0x01FF); - break; - case landscapeInv: - lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - y - 1) & 0x00FF); - lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - x - 1) & 0x01FF); - break; - } -} - -static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) { - /* HSA / HEA are 8 bit - * VSA / VEA are 9 bit - * use masks 0x00FF and 0x01FF to enforce this - */ - - switch(GDISP.Orientation) { - case portrait: - lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF)); - lld_lcdWriteReg(0x48, y & 0x01FF); - lld_lcdWriteReg(0x47, (y+cy-1) & 0x01FF); - break; - case landscape: - lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF)); - lld_lcdWriteReg(0x48, x & 0x01FF); - lld_lcdWriteReg(0x47, (x+cx-1) & 0x01FF); - break; - case portraitInv: - lld_lcdWriteReg(0x46, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF)); - lld_lcdWriteReg(0x48, (SCREEN_HEIGHT-(y+cy)) & 0x01FF); - lld_lcdWriteReg(0x47, (SCREEN_HEIGHT-y-1) & 0x01FF); - break; - case landscapeInv: - lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF)); - lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (x+cx)) & 0x01FF); - lld_lcdWriteReg(0x47, (SCREEN_HEIGHT - x - 1) & 0x01FF); - break; - } - - lld_lcdSetCursor(x, y); -} - -static void lld_lcdResetViewPort(void) { - switch(GDISP.Orientation) { - case portrait: - case portraitInv: - lld_lcdSetViewPort(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - break; - case landscape: - case landscapeInv: - lld_lcdSetViewPort(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH); - break; - } -} - -#endif /* S6D1121_H */ ->>>>>>> d61cff7a7976cd9097e5c3634ae4b1be64f736c3 +/* + ChibiOS/RT - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef S6D1121_H +#define S6D1121_H + +// I/O assignments +#define LCD_BL_GPIO GPIOB +#define LCD_BL_PIN 8 + +#define LCD_CS_GPIO GPIOD +#define LCD_CS_PIN 7 + +#define LCD_RS_GPIO GPIOD +#define LCD_RS_PIN 11 + +#define LCD_RST_GPIO GPIOD +#define LCD_RST_PIN 10 + +#define LCD_RD_GPIO GPIOD +#define LCD_RD_PIN 9 + +#define LCD_WR_GPIO GPIOD +#define LCD_WR_PIN 8 + +#define LCD_D0_GPIO GPIOD +#define LCD_D4_GPIO GPIOE + +/* all interfaces use RST via GPIO */ +/* TODO: option to disable RST; assumes RST is tied high */ +#define LCD_RST_LOW palClearPad(LCD_RST_GPIO, LCD_RST_PIN) +#define LCD_RST_HIGH palSetPad(LCD_RST_GPIO, LCD_RST_PIN) + +#define s6d1121_delay(n) halPolledDelay(MS2RTT(n)); + +#if defined(LCD_USE_GPIO) + + #define LCD_CS_LOW palClearPad(LCD_CS_GPIO, LCD_CS_PIN) + #define LCD_CS_HIGH palSetPad(LCD_CS_GPIO, LCD_CS_PIN) + + #define LCD_RS_LOW palClearPad(LCD_RS_GPIO, LCD_RS_PIN) + #define LCD_RS_HIGH palSetPad(LCD_RS_GPIO, LCD_RS_PIN) + + #define LCD_RD_LOW palClearPad(LCD_RD_GPIO, LCD_RD_PIN) + #define LCD_RD_HIGH palSetPad(LCD_RD_GPIO, LCD_RD_PIN) + + #define LCD_WR_LOW palClearPad(LCD_WR_GPIO, LCD_WR_PIN) + #define LCD_WR_HIGH palSetPad(LCD_WR_GPIO, LCD_WR_PIN) + + #define LCD_BL_LOW palClearPad(LCD_BL_GPIO, LCD_BL_PIN) + #define LCD_BL_HIGH palSetPad(LCD_BL_GPIO, LCD_BL_PIN) + + + static inline void lld_lcddelay(void) { asm volatile ("nop"); asm volatile ("nop"); } + static inline void lld_lcdwrite(uint16_t db) { + LCD_D4_GPIO->BSRR.W=((~db&0xFFF0)<<16)|(db&0xFFF0); + LCD_D0_GPIO->BSRR.W=((~db&0x000F)<<16)|(db&0x000F); + LCD_WR_LOW; + lld_lcddelay(); + LCD_WR_HIGH; + } + static __inline uint16_t lld_lcdReadData(void) { + uint16_t value=0; + + LCD_RS_HIGH; LCD_WR_HIGH; LCD_RD_LOW; + #ifndef STM32F4XX + // change pin mode to digital input + LCD_DATA_PORT->CRH = 0x47444444; + LCD_DATA_PORT->CRL = 0x47444444; + #endif + #ifndef STM32F4XX + // change pin mode back to digital output + LCD_DATA_PORT->CRH = 0x33333333; + LCD_DATA_PORT->CRL = 0x33333333; + #endif + LCD_RD_HIGH; + return value; + } + static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) { + uint16_t lcdRAM; + + LCD_CS_LOW; LCD_RS_LOW; + lld_lcdwrite(lcdReg); + LCD_RS_HIGH; + lcdRAM = lld_lcdReadData(); + LCD_CS_HIGH; + return lcdRAM; + } + static void lld_lcdWriteIndex(uint16_t lcdReg) { + LCD_RS_LOW; + lld_lcdwrite(lcdReg); + LCD_RS_HIGH; + } + static void lld_lcdWriteData(uint16_t lcdData) { + lld_lcdwrite(lcdData); + } + static void lld_lcdWriteReg(uint16_t lcdReg, uint16_t lcdRegValue) { + LCD_CS_LOW; + lld_lcdWriteIndex(lcdReg); + lld_lcdWriteData(lcdRegValue); + LCD_CS_HIGH; + } + static __inline void lld_lcdWriteStreamStart(void) { + LCD_CS_LOW; + lld_lcdWriteIndex(0x0022); + } + static __inline void lld_lcdWriteStreamStop(void) { + LCD_CS_HIGH; + } + static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { + uint16_t i; + + for(i = 0; i < size; i++) { lld_lcdwrite(buffer[i]); } + } + static __inline void lld_lcdReadStreamStart(void) { /* TODO */ } + static __inline void lld_lcdReadStreamStop(void) { /* TODO */ } + static __inline void lld_lcdReadStream(uint16_t *UNUSED(buffer), size_t UNUSED(size)) { /* TODO */ } + +#elif defined(LCD_USE_FSMC) + #define LCD_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ + #define LCD_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */ + + static __inline void lld_lcdWriteIndex(uint16_t index) { LCD_REG = index; } + static __inline void lld_lcdWriteData(uint16_t data) { LCD_RAM = data; } + static __inline void lld_lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) { + LCD_REG = lcdReg; + LCD_RAM = lcdRegValue; + } + static __inline uint16_t lld_lcdReadData(void) { return (LCD_RAM); } + static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) { + LCD_REG = lcdReg; + return LCD_RAM; + } + static __inline void lld_lcdWriteStreamStart(void) { LCD_REG = 0x0022; } + static __inline void lld_lcdWriteStreamStop(void) {} + static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { + uint16_t i; + for(i = 0; i < size; i++) LCD_RAM = buffer[i]; + } + static __inline void lld_lcdReadStreamStart(void) { LCD_REG = 0x0022; } + static __inline void lld_lcdReadStreamStop(void) {} + static __inline void lld_lcdReadStream(uint16_t *buffer, size_t size) { + uint16_t i; + volatile uint16_t dummy; + + /* throw away first value read */ + dummy = LCD_RAM; + for(i = 0; i < size; i++) buffer[i] = LCD_RAM; + } + +#elif defined(LCD_USE_SPI) + #error "gdispS6d1121: LCD_USE_SPI not implemented yet" + +#else + #error "gdispS6d1121: No known LCD_USE_XXX has been defined" +#endif + +static void lld_lcdSetCursor(coord_t x, coord_t y) { + /* R20h - 8 bit + * R21h - 9 bit + */ + switch(GDISP.Orientation) { + case portraitInv: + lld_lcdWriteReg(0x0020, (SCREEN_WIDTH-1-x) & 0x00FF); + lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT-1-y) & 0x01FF); + break; + case portrait: + lld_lcdWriteReg(0x0020, x & 0x00FF); + lld_lcdWriteReg(0x0021, y & 0x01FF); + break; + case landscape: + lld_lcdWriteReg(0x0020, y & 0x00FF); + lld_lcdWriteReg(0x0021, x & 0x01FF); + break; + case landscapeInv: + lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - y - 1) & 0x00FF); + lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - x - 1) & 0x01FF); + break; + } +} + +static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) { + /* HSA / HEA are 8 bit + * VSA / VEA are 9 bit + * use masks 0x00FF and 0x01FF to enforce this + */ + + switch(GDISP.Orientation) { + case portrait: + lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF)); + lld_lcdWriteReg(0x48, y & 0x01FF); + lld_lcdWriteReg(0x47, (y+cy-1) & 0x01FF); + break; + case landscape: + lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF)); + lld_lcdWriteReg(0x48, x & 0x01FF); + lld_lcdWriteReg(0x47, (x+cx-1) & 0x01FF); + break; + case portraitInv: + lld_lcdWriteReg(0x46, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF)); + lld_lcdWriteReg(0x48, (SCREEN_HEIGHT-(y+cy)) & 0x01FF); + lld_lcdWriteReg(0x47, (SCREEN_HEIGHT-y-1) & 0x01FF); + break; + case landscapeInv: + lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF)); + lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (x+cx)) & 0x01FF); + lld_lcdWriteReg(0x47, (SCREEN_HEIGHT - x - 1) & 0x01FF); + break; + } + + lld_lcdSetCursor(x, y); +} + +static void lld_lcdResetViewPort(void) { + switch(GDISP.Orientation) { + case portrait: + case portraitInv: + lld_lcdSetViewPort(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + break; + case landscape: + case landscapeInv: + lld_lcdSetViewPort(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH); + break; + } +} + +#endif /* S6D1121_H */ diff --git a/halext/drivers/gdispTestStub/gdisp_lld.c b/halext/drivers/gdispTestStub/gdisp_lld.c index 2b80f997..44431e30 100644 --- a/halext/drivers/gdispTestStub/gdisp_lld.c +++ b/halext/drivers/gdispTestStub/gdisp_lld.c @@ -308,7 +308,7 @@ void gdisp_lld_drawpixel(coord_t UNUSED(x), coord_t UNUSED(y), color_t UNUSED(co } #endif -#if GDISP_HARDWARE_CONTROL || defined(__DOXYGEN__) +#if (GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL) || defined(__DOXYGEN__) /** * @brief Driver Control * @detail Unsupported control codes are ignored. diff --git a/halext/include/gdisp.h b/halext/include/gdisp.h index 24a8b1b4..d284c125 100644 --- a/halext/include/gdisp.h +++ b/halext/include/gdisp.h @@ -59,26 +59,6 @@ #define Pink HTML2COLOR(0xFFC0CB) #define SkyBlue HTML2COLOR(0x87CEEB) -/** - * @brief Driver Control Constants - * @detail Unsupported control codes are ignored. - * @note The value parameter should always be typecast to (void *). - * @note There are some predefined and some specific to the low level driver. - * @note GDISP_CONTROL_POWER - Takes a gdisp_powermode_t - * GDISP_CONTROL_ORIENTATION - Takes a gdisp_orientation_t - * GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver - * that only supports off/on anything other - * than zero is on. - * GDISP_CONTROL_CONTRAST - Takes an int from 0 to 100. - * GDISP_CONTROL_LLD - Low level driver control constants start at - * this value. - */ -#define GDISP_CONTROL_POWER 0 -#define GDISP_CONTROL_ORIENTATION 1 -#define GDISP_CONTROL_BACKLIGHT 2 -#define GDISP_CONTROL_CONTRAST 3 -#define GDISP_CONTROL_LLD 1000 - /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ diff --git a/halext/include/gdisp_lld.h b/halext/include/gdisp_lld.h index bef4f96a..970fd712 100644 --- a/halext/include/gdisp_lld.h +++ b/halext/include/gdisp_lld.h @@ -36,6 +36,30 @@ #include "gdisp_lld_config.h" +/*===========================================================================*/ +/* Constants. */ +/*===========================================================================*/ + +/** + * @brief Driver Control Constants + * @detail Unsupported control codes are ignored. + * @note The value parameter should always be typecast to (void *). + * @note There are some predefined and some specific to the low level driver. + * @note GDISP_CONTROL_POWER - Takes a gdisp_powermode_t + * GDISP_CONTROL_ORIENTATION - Takes a gdisp_orientation_t + * GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver + * that only supports off/on anything other + * than zero is on. + * GDISP_CONTROL_CONTRAST - Takes an int from 0 to 100. + * GDISP_CONTROL_LLD - Low level driver control constants start at + * this value. + */ +#define GDISP_CONTROL_POWER 0 +#define GDISP_CONTROL_ORIENTATION 1 +#define GDISP_CONTROL_BACKLIGHT 2 +#define GDISP_CONTROL_CONTRAST 3 +#define GDISP_CONTROL_LLD 1000 + /*===========================================================================*/ /* Error checks. */ /*===========================================================================*/ diff --git a/halext/include/glcd.h b/halext/include/glcd.h index 0712ed02..54c5158d 100644 --- a/halext/include/glcd.h +++ b/halext/include/glcd.h @@ -45,13 +45,21 @@ enum powermode {powerOff, powerOn, sleepOn, sleepOff}; #define sleepOn powerSleep #define sleepOff powerOn -#define font_Small (&fontSmall) -#define font_Larger (&fontLarger) -#define font_MediumBold (&fontUI1) -#define font_LargeNumbers (&fontLargeNumbers) +#define font_Small (&fontSmall) +#define font_SmallDouble (&fontSmallDouble) +#define font_SmallNarrow (&fontSmall) +#define font_Larger (&fontLarger) +#define font_LargerDouble (&fontLargerDouble) +#define font_LargerNarrow (&fontLargerNarrow) +#define font_MediumBold (&fontUI1) +#define font_MediumBoldDouble (&fontUI1Double) +#define font_MediumBoldNarrow (&fontUI1Narrow) +#define font_LargeNumbers (&fontLargeNumbers) +#define font_LargeNumbersDouble (&fontLargeNumbersDouble) +#define font_LargeNumbersNarrow (&fontLargeNumbersNarrow) #define GLCDDriver GDISPDriver -#define GLCDD1 GDISP1 +#define GLCDD GDISP enum glcd_result { GLCD_DONE, GLCD_FAILED, @@ -63,10 +71,10 @@ typedef enum glcd_result glcd_result_t; /* Core functions */ #define lcdInit(dvr) gdispInit(dvr) #define lcdClear(color) (gdispClear(color), GLCD_DONE) -#define lcdSetOrientation(newO) (gdispSetOrientation(newO), (GDISP1.Orientation == (newO) ? GLCD_DONE : GLCD_FAILED)) +#define lcdSetOrientation(newO) (gdispControl(GDISP_CONTROL_ORIENTATION, (void *)(int)newO), (GDISP1.Orientation == (newO) ? GLCD_DONE : GLCD_FAILED)) #define lcdFillArea(x0,y0,x1,y1,c) (gdispFillArea((x0),(y0),(x1)-(x0)+1,(y1)-(y0)+1,(c)), GLCD_DONE) #define lcdWriteArea(x0,y0,x1,y1,b,n) (gdispBlitArea((x0),(y0),(x1)-(x0)+1,(y1)-(y0)+1,(b)), GLCD_DONE) -#define lcdSetPowerMode(pm) (gdispSetPowerMode(pm), (GDISP1.Powermode == (pm) ? GLCD_DONE : GLCD_FAILED)) +#define lcdSetPowerMode(pm) (gdispControl(GDISP_CONTROL_POWER, (void *)(int)pm), (GDISP1.Powermode == (pm) ? GLCD_DONE : GLCD_FAILED)) /* Drawing functions */ #define lcdDrawPixel(x,y,c) (gdispDrawPixel((x),(y),(c)), GLCD_DONE) @@ -83,12 +91,12 @@ typedef enum glcd_result glcd_result_t; /* Character measuring functions */ #define lcdMeasureChar(h,f) (gdispGetCharWidth((h),(f))+(f)->charPadding) #define lcdMeasureString(s,f) (gdispGetStringWidth((s),(f))+(f)->charPadding) -#define lcdGetFontHeight(font) gdispGetFontMetric(font, fontHeight) +#define lcdGetFontHeight(f) gdispGetFontMetric((f), fontHeight) /* Size and orientation related */ -#define lcdGetHeight() (GDISP1.Height) -#define lcdGetWidth() (GDISP1.Width) -#define lcdGetOrientation() (GDISP1.Orientation) +#define lcdGetHeight() (GDISP.Height) +#define lcdGetWidth() (GDISP.Width) +#define lcdGetOrientation() (GDISP.Orientation) /* BGR->RGB and pixel readback */ #define lcdBGR2RGB(c) RGB2COLOR(BLUE_OF(c),GREEN_OF(c),RED_OF(c))