From 2da41e3ff8c4711e5af4a2dda9ed061bdba3cd9e Mon Sep 17 00:00:00 2001 From: meh <meh@schizofreni.co> Date: Fri, 23 Aug 2019 19:44:07 +0200 Subject: [PATCH] feat: add GohuFont as supported font --- epicardium/epicardium.h | 13 +- epicardium/main.c | 4 +- epicardium/modules/display.c | 36 +- epicardium/modules/pmic.c | 6 +- lib/gfx/Fonts/fonts.h | 2 + lib/gfx/Fonts/gohufont.c | 1241 +++++++++++++++++++++++++++++++ lib/gfx/meson.build | 1 + pycardium/modules/py/display.py | 1 + pycardium/modules/sys_display.c | 6 +- tools/code-style.sh | 1 + 10 files changed, 1297 insertions(+), 14 deletions(-) create mode 100644 lib/gfx/Fonts/gohufont.c diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 29476b02..b1977c57 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -1233,12 +1233,12 @@ API(API_DISP_UPDATE, int epic_disp_update()); */ API(API_DISP_PRINT, int epic_disp_print( - uint16_t posx, - uint16_t posy, - const char *pString, - uint16_t fg, - uint16_t bg) - ); + uint16_t posx, + uint16_t posy, + const char *pString, + uint16_t fg, + uint16_t bg, + uint8_t font)); /* * Font Selection @@ -1249,6 +1249,7 @@ enum disp_font_name { DISP_FONT16 = 2, DISP_FONT20 = 3, DISP_FONT24 = 4, + DISP_GOHUFONT = 99, }; /** diff --git a/epicardium/main.c b/epicardium/main.c index 56639ea5..d57ed00f 100644 --- a/epicardium/main.c +++ b/epicardium/main.c @@ -26,8 +26,8 @@ int main(void) const char *version_buf = CARD10_VERSION; const int off = (160 - (int)strlen(version_buf) * 14) / 2; epic_disp_clear(0x9dc0); - epic_disp_print(10, 20, "Epicardium", 0x6c20, 0x9dc0); - epic_disp_print(off > 0 ? off : 0, 40, version_buf, 0x6c20, 0x9dc0); + epic_disp_print(10, 20, "Epicardium", 0x6c20, 0x9dc0, 0); + epic_disp_print(off > 0 ? off : 0, 40, version_buf, 0x6c20, 0x9dc0, 0); epic_disp_update(); mxc_delay(2000000); diff --git a/epicardium/modules/display.c b/epicardium/modules/display.c index fe89fc32..95bc0de6 100644 --- a/epicardium/modules/display.c +++ b/epicardium/modules/display.c @@ -26,7 +26,8 @@ int epic_disp_print( uint16_t posy, const char *pString, uint16_t fg, - uint16_t bg + uint16_t bg, + uint8_t font ) { return epic_disp_print_adv(DISP_FONT20, posx, posy, pString, fg, bg); } @@ -35,6 +36,7 @@ static const sFONT *font_map[] = { [DISP_FONT8] = &Font8, [DISP_FONT12] = &Font12, [DISP_FONT16] = &Font16, [DISP_FONT20] = &Font20, [DISP_FONT24] = &Font24, + [DISP_GOHUFONT] = &GohuFont }; int epic_disp_print_adv( @@ -63,6 +65,38 @@ int epic_disp_print_adv( ); return 0; } + + sFONT *pick = &Font20; + + switch (font) { + case 8: + pick = &Font8; + break; + + case 12: + pick = &Font12; + break; + + case 16: + pick = &Font16; + break; + + case 20: + pick = &Font20; + break; + + case 24: + pick = &Font24; + break; + + case 99: + pick = &GohuFont; + break; + } + + gfx_puts(pick, &display_screen, posx, posy, pString, fg, bg); + + return 0; } int epic_disp_clear(uint16_t color) diff --git a/epicardium/modules/pmic.c b/epicardium/modules/pmic.c index 4df12ea9..3988b053 100644 --- a/epicardium/modules/pmic.c +++ b/epicardium/modules/pmic.c @@ -180,9 +180,9 @@ __attribute__((noreturn)) static void pmic_die(float u_batt) /* Draw an error screen */ epic_disp_clear(0x0000); - epic_disp_print(0, 0, " Battery", 0xffff, 0x0000); - epic_disp_print(0, 20, " critical", 0xffff, 0x0000); - epic_disp_print(0, 40, " !!!!", 0xffff, 0x0000); + epic_disp_print(0, 0, " Battery", 0xffff, 0x0000, 0); + epic_disp_print(0, 20, " critical", 0xffff, 0x0000, 0); + epic_disp_print(0, 40, " !!!!", 0xffff, 0x0000, 0); epic_disp_update(); /* Vibrate violently */ diff --git a/lib/gfx/Fonts/fonts.h b/lib/gfx/Fonts/fonts.h index 04117b2a..8ee5375e 100644 --- a/lib/gfx/Fonts/fonts.h +++ b/lib/gfx/Fonts/fonts.h @@ -61,6 +61,8 @@ typedef struct _tFont } sFONT; +extern sFONT GohuFont; + extern sFONT Font24; extern sFONT Font20; extern sFONT Font16; diff --git a/lib/gfx/Fonts/gohufont.c b/lib/gfx/Fonts/gohufont.c new file mode 100644 index 00000000..de34c997 --- /dev/null +++ b/lib/gfx/Fonts/gohufont.c @@ -0,0 +1,1241 @@ +#include "fonts.h" +const uint8_t GohuFont_Table[] = +{ + + // @32 ' ' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @33 '!' (6 pixels wide) + 0x00, // + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + 0x20, //# + 0x00, // + 0x00, // + + // @34 '\"' (6 pixels wide) + 0x00, // + 0x50, //# # + 0x50, //# # + 0x50, //# # + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @35 '#' (6 pixels wide) + 0x00, // + 0x50, //# # + 0x50, //# # + 0xF8, //##### + 0x50, //# # + 0xF8, //##### + 0x50, //# # + 0x50, //# # + 0x00, // + 0x00, // + 0x00, // + + // @36 '$' (6 pixels wide) + 0x00, // + 0x20, //# + 0x70, //### + 0xA8, //# # # + 0xA0, //# # + 0x70, //### + 0x28, //# # + 0xA8, //# # # + 0x70, //### + 0x20, //# + 0x00, // + + // @37 '%' (6 pixels wide) + 0x00, // + 0x00, // + 0x48, //# # + 0xA8, //# # # + 0x50, //# # + 0x20, //# + 0x50, //# # + 0xA8, //# # # + 0x90, //# # + 0x00, // + 0x00, // + + // @38 '&' (6 pixels wide) + 0x00, // + 0x00, // + 0x60, //## + 0x90, //# # + 0xA0, //# # + 0x40, //# + 0xA8, //# # # + 0x90, //# # + 0x68, //## # + 0x00, // + 0x00, // + + // @39 '\'' (6 pixels wide) + 0x00, // + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @40 '(' (6 pixels wide) + 0x00, // + 0x10, // # + 0x20, //# + 0x20, //# + 0x40, //# + 0x40, //# + 0x40, //# + 0x20, //# + 0x20, //# + 0x10, // # + 0x00, // + + // @41 ')' (6 pixels wide) + 0x00, // + 0x40, //# + 0x20, //# + 0x20, //# + 0x10, // # + 0x10, // # + 0x10, // # + 0x20, //# + 0x20, //# + 0x40, //# + 0x00, // + + // @42 '*' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x20, //# + 0xA8, //# # # + 0x70, //### + 0xA8, //# # # + 0x20, //# + 0x00, // + 0x00, // + 0x00, // + + // @43 '+' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x20, //# + 0x20, //# + 0xF8, //##### + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + 0x00, // + + // @44 ',' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x60, //## + 0x60, //## + 0x20, //# + 0x40, //# + + // @45 '-' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xF8, //##### + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @46 '.' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x60, //## + 0x60, //## + 0x00, // + 0x00, // + + // @47 '/' (6 pixels wide) + 0x00, // + 0x08, // # + 0x08, // # + 0x10, // # + 0x10, // # + 0x20, //# + 0x20, //# + 0x40, //# + 0x40, //# + 0x80, //# + 0x80, //# + + // @48 '0' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x98, //# ## + 0xA8, //# # # + 0xC8, //## # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @49 '1' (6 pixels wide) + 0x00, // + 0x00, // + 0x20, //# + 0x60, //## + 0xA0, //# # + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + + // @50 '2' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x08, // # + 0x10, // # + 0x20, //# + 0x40, //# + 0xF8, //##### + 0x00, // + 0x00, // + + // @51 '3' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x08, // # + 0x30, //## + 0x08, // # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @52 '4' (6 pixels wide) + 0x00, // + 0x00, // + 0x10, // # + 0x30, //## + 0x50, //# # + 0x90, //# # + 0xF8, //##### + 0x10, // # + 0x10, // # + 0x00, // + 0x00, // + + // @53 '5' (6 pixels wide) + 0x00, // + 0x00, // + 0xF8, //##### + 0x80, //# + 0xF0, //#### + 0x08, // # + 0x08, // # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @54 '6' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x80, //# + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @55 '7' (6 pixels wide) + 0x00, // + 0x00, // + 0xF8, //##### + 0x08, // # + 0x10, // # + 0x10, // # + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + + // @56 '8' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @57 '9' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x88, //# # + 0x78, //#### + 0x08, // # + 0x08, // # + 0x70, //### + 0x00, // + 0x00, // + + // @58 ':' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x30, //## + 0x30, //## + 0x00, // + 0x30, //## + 0x30, //## + 0x00, // + 0x00, // + + // @59 ';' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x60, //## + 0x60, //## + 0x00, // + 0x60, //## + 0x60, //## + 0x20, //# + 0x40, //# + + // @60 '<' (6 pixels wide) + 0x00, // + 0x00, // + 0x08, // # + 0x10, // # + 0x20, //# + 0x40, //# + 0x20, //# + 0x10, // # + 0x08, // # + 0x00, // + 0x00, // + + // @61 '=' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xF8, //##### + 0x00, // + 0xF8, //##### + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @62 '>' (6 pixels wide) + 0x00, // + 0x00, // + 0x40, //# + 0x20, //# + 0x10, // # + 0x08, // # + 0x10, // # + 0x20, //# + 0x40, //# + 0x00, // + 0x00, // + + // @63 '?' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x08, // # + 0x10, // # + 0x20, //# + 0x00, // + 0x20, //# + 0x00, // + 0x00, // + + // @64 '@' (6 pixels wide) + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0xB8, //# ### + 0xA8, //# # # + 0xB8, //# ### + 0x80, //# + 0x78, //#### + 0x00, // + 0x00, // + + // @65 'A' (6 pixels wide) + 0x00, // + 0x70, //### + 0x88, //# # + 0x88, //# # + 0xF8, //##### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @66 'B' (6 pixels wide) + 0x00, // + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x00, // + 0x00, // + + // @67 'C' (6 pixels wide) + 0x00, // + 0x70, //### + 0x88, //# # + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @68 'D' (6 pixels wide) + 0x00, // + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x00, // + 0x00, // + + // @69 'E' (6 pixels wide) + 0x00, // + 0xF8, //##### + 0x80, //# + 0x80, //# + 0xF0, //#### + 0x80, //# + 0x80, //# + 0x80, //# + 0xF8, //##### + 0x00, // + 0x00, // + + // @70 'F' (6 pixels wide) + 0x00, // + 0xF8, //##### + 0x80, //# + 0x80, //# + 0xF0, //#### + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0x00, // + 0x00, // + + // @71 'G' (6 pixels wide) + 0x00, // + 0x70, //### + 0x88, //# # + 0x80, //# + 0xB8, //# ### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @72 'H' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0xF8, //##### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @73 'I' (6 pixels wide) + 0x00, // + 0x70, //### + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x70, //### + 0x00, // + 0x00, // + + // @74 'J' (6 pixels wide) + 0x00, // + 0x08, // # + 0x08, // # + 0x08, // # + 0x08, // # + 0x08, // # + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @75 'K' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x90, //# # + 0xA0, //# # + 0xC0, //## + 0xA0, //# # + 0x90, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @76 'L' (6 pixels wide) + 0x00, // + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0xF8, //##### + 0x00, // + 0x00, // + + // @77 'M' (6 pixels wide) + 0x00, // + 0x88, //# # + 0xD8, //## ## + 0xA8, //# # # + 0xA8, //# # # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @78 'N' (6 pixels wide) + 0x00, // + 0x88, //# # + 0xC8, //## # + 0xC8, //## # + 0xA8, //# # # + 0xA8, //# # # + 0x98, //# ## + 0x98, //# ## + 0x88, //# # + 0x00, // + 0x00, // + + // @79 'O' (6 pixels wide) + 0x00, // + 0x70, //### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @80 'P' (6 pixels wide) + 0x00, // + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x80, //# + 0x80, //# + 0x80, //# + 0x80, //# + 0x00, // + 0x00, // + + // @81 'Q' (6 pixels wide) + 0x00, // + 0x70, //### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0xA8, //# # # + 0x90, //# # + 0x68, //## # + 0x08, // # + 0x00, // + + // @82 'R' (6 pixels wide) + 0x00, // + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x90, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @83 'S' (6 pixels wide) + 0x00, // + 0x70, //### + 0x88, //# # + 0x80, //# + 0x70, //### + 0x08, // # + 0x08, // # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @84 'T' (6 pixels wide) + 0x00, // + 0xF8, //##### + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + + // @85 'U' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @86 'V' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x50, //# # + 0x50, //# # + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + + // @87 'W' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0xA8, //# # # + 0xA8, //# # # + 0xA8, //# # # + 0x50, //# # + 0x50, //# # + 0x00, // + 0x00, // + + // @88 'X' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x88, //# # + 0x50, //# # + 0x20, //# + 0x50, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @89 'Y' (6 pixels wide) + 0x00, // + 0x88, //# # + 0x88, //# # + 0x50, //# # + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + 0x00, // + + // @90 'Z' (6 pixels wide) + 0x00, // + 0xF8, //##### + 0x08, // # + 0x10, // # + 0x20, //# + 0x40, //# + 0x80, //# + 0x80, //# + 0xF8, //##### + 0x00, // + 0x00, // + + // @91 '[' (6 pixels wide) + 0x00, // + 0x38, //### + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x38, //### + 0x00, // + + // @92 '\\' (6 pixels wide) + 0x00, // + 0x40, //# + 0x40, //# + 0x20, //# + 0x20, //# + 0x10, // # + 0x10, // # + 0x08, // # + 0x08, // # + 0x04, // # + 0x04, // # + + // @93 ']' (6 pixels wide) + 0x00, // + 0xE0, //### + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0xE0, //### + 0x00, // + + // @94 '^' (6 pixels wide) + 0x00, // + 0x00, // + 0x20, //# + 0x50, //# # + 0x88, //# # + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @95 '_' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xFC, //###### + 0x00, // + + // @96 '`' (6 pixels wide) + 0x00, // + 0x40, //# + 0x20, //# + 0x10, // # + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x00, // + + // @97 'a' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x70, //### + 0x08, // # + 0x78, //#### + 0x88, //# # + 0x78, //#### + 0x00, // + 0x00, // + + // @98 'b' (6 pixels wide) + 0x00, // + 0x80, //# + 0x80, //# + 0x80, //# + 0xB0, //# ## + 0xC8, //## # + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x00, // + 0x00, // + + // @99 'c' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x78, //#### + 0x80, //# + 0x80, //# + 0x80, //# + 0x78, //#### + 0x00, // + 0x00, // + + // @100 'd' (6 pixels wide) + 0x00, // + 0x08, // # + 0x08, // # + 0x08, // # + 0x78, //#### + 0x88, //# # + 0x88, //# # + 0x98, //# ## + 0x68, //## # + 0x00, // + 0x00, // + + // @101 'e' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0xF8, //##### + 0x80, //# + 0x78, //#### + 0x00, // + 0x00, // + + // @102 'f' (6 pixels wide) + 0x00, // + 0x30, //## + 0x40, //# + 0x40, //# + 0x70, //### + 0x40, //# + 0x40, //# + 0x40, //# + 0x40, //# + 0x00, // + 0x00, // + + // @103 'g' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x78, //#### + 0x88, //# # + 0x88, //# # + 0x98, //# ## + 0x68, //## # + 0x08, // # + 0x70, //### + + // @104 'h' (6 pixels wide) + 0x00, // + 0x80, //# + 0x80, //# + 0x80, //# + 0xB0, //# ## + 0xC8, //## # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @105 'i' (6 pixels wide) + 0x00, // + 0x00, // + 0x20, //# + 0x00, // + 0x60, //## + 0x20, //# + 0x20, //# + 0x20, //# + 0x30, //## + 0x00, // + 0x00, // + + // @106 'j' (6 pixels wide) + 0x00, // + 0x00, // + 0x20, //# + 0x00, // + 0x60, //## + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0xC0, //## + + // @107 'k' (6 pixels wide) + 0x00, // + 0x80, //# + 0x80, //# + 0x80, //# + 0x90, //# # + 0xA0, //# # + 0xE0, //### + 0x90, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @108 'l' (6 pixels wide) + 0x00, // + 0x60, //## + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x18, // ## + 0x00, // + 0x00, // + + // @109 'm' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xF0, //#### + 0xA8, //# # # + 0xA8, //# # # + 0xA8, //# # # + 0xA8, //# # # + 0x00, // + 0x00, // + + // @110 'n' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xF0, //#### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @111 'o' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x70, //### + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x70, //### + 0x00, // + 0x00, // + + // @112 'p' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xB0, //# ## + 0xC8, //## # + 0x88, //# # + 0x88, //# # + 0xF0, //#### + 0x80, //# + 0x80, //# + + // @113 'q' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x78, //#### + 0x88, //# # + 0x88, //# # + 0x98, //# ## + 0x68, //## # + 0x08, // # + 0x08, // # + + // @114 'r' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xB0, //# ## + 0xC8, //## # + 0x80, //# + 0x80, //# + 0x80, //# + 0x00, // + 0x00, // + + // @115 's' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x70, //### + 0x80, //# + 0x70, //### + 0x08, // # + 0xF0, //#### + 0x00, // + 0x00, // + + // @116 't' (6 pixels wide) + 0x00, // + 0x40, //# + 0x40, //# + 0x40, //# + 0xF0, //#### + 0x40, //# + 0x40, //# + 0x40, //# + 0x30, //## + 0x00, // + 0x00, // + + // @117 'u' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x98, //# ## + 0x68, //## # + 0x00, // + 0x00, // + + // @118 'v' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x88, //# # + 0x88, //# # + 0x50, //# # + 0x50, //# # + 0x20, //# + 0x00, // + 0x00, // + + // @119 'w' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x88, //# # + 0xA8, //# # # + 0xA8, //# # # + 0xA8, //# # # + 0x50, //# # + 0x00, // + 0x00, // + + // @120 'x' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x88, //# # + 0x50, //# # + 0x20, //# + 0x50, //# # + 0x88, //# # + 0x00, // + 0x00, // + + // @121 'y' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x88, //# # + 0x88, //# # + 0x88, //# # + 0x98, //# ## + 0x68, //## # + 0x08, // # + 0x70, //### + + // @122 'z' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0xF8, //##### + 0x10, // # + 0x20, //# + 0x40, //# + 0xF8, //##### + 0x00, // + 0x00, // + + // @123 '{' (6 pixels wide) + 0x18, // ## + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0xC0, //## + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x18, // ## + + // @124 '|' (6 pixels wide) + 0x00, // + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x00, // + + // @125 '}' (6 pixels wide) + 0xC0, //## + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0x18, // ## + 0x20, //# + 0x20, //# + 0x20, //# + 0x20, //# + 0xC0, //## + + // @126 '~' (6 pixels wide) + 0x00, // + 0x00, // + 0x00, // + 0x00, // + 0x40, //# + 0xA8, //# # # + 0x10, // # + 0x00, // + 0x00, // + 0x00, // + 0x00, // +}; + +sFONT GohuFont = { GohuFont_Table, 6, 11 }; diff --git a/lib/gfx/meson.build b/lib/gfx/meson.build index 4df9f3c1..50743ff4 100644 --- a/lib/gfx/meson.build +++ b/lib/gfx/meson.build @@ -8,6 +8,7 @@ includes = include_directories( sources = files( './GUI_DEV/DEV_Config.c', './LCD/LCD_Driver.c', + './Fonts/gohufont.c', './Fonts/font8.c', './Fonts/font12.c', './Fonts/font16.c', diff --git a/pycardium/modules/py/display.py b/pycardium/modules/py/display.py index 7b51cef3..953b80ab 100644 --- a/pycardium/modules/py/display.py +++ b/pycardium/modules/py/display.py @@ -7,6 +7,7 @@ FONT12 = 1 FONT16 = 2 FONT20 = 3 FONT24 = 4 +GOHUFONT = 99 class Display: diff --git a/pycardium/modules/sys_display.c b/pycardium/modules/sys_display.c index 4f92ab92..c4a9459a 100644 --- a/pycardium/modules/sys_display.c +++ b/pycardium/modules/sys_display.c @@ -43,14 +43,16 @@ static mp_obj_t mp_display_print(size_t n_args, const mp_obj_t *args) uint32_t posy = mp_obj_get_int(args[2]); uint32_t fg = get_color(args[3]); uint32_t bg = get_color(args[4]); - int res = epic_disp_print(posx, posy, (const char *)print, fg, bg); + uint8_t font = mp_obj_get_int(args[5]); + int res = + epic_disp_print(posx, posy, (const char *)print, fg, bg, font); if (res < 0) { mp_raise_OSError(-res); } return mp_const_none; } static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( - display_print_obj, 5, 5, mp_display_print + display_print_obj, 6, 6, mp_display_print ); /* print something on the display */ diff --git a/tools/code-style.sh b/tools/code-style.sh index 3256654a..92e9a31d 100755 --- a/tools/code-style.sh +++ b/tools/code-style.sh @@ -45,6 +45,7 @@ formatter_blacklist=( lib/mx25lba/ lib/sdk/ lib/vendor/ + lib/gfx/ openocd/ docker/ ) -- GitLab