Unverified Commit 2da41e3f authored by meh's avatar meh
Browse files

feat: add GohuFont as supported font

parent 622d2145
Pipeline #3617 failed with stages
in 1 minute and 1 second
...@@ -1233,12 +1233,12 @@ API(API_DISP_UPDATE, int epic_disp_update()); ...@@ -1233,12 +1233,12 @@ API(API_DISP_UPDATE, int epic_disp_update());
*/ */
API(API_DISP_PRINT, API(API_DISP_PRINT,
int epic_disp_print( int epic_disp_print(
uint16_t posx, uint16_t posx,
uint16_t posy, uint16_t posy,
const char *pString, const char *pString,
uint16_t fg, uint16_t fg,
uint16_t bg) uint16_t bg,
); uint8_t font));
/* /*
* Font Selection * Font Selection
...@@ -1249,6 +1249,7 @@ enum disp_font_name { ...@@ -1249,6 +1249,7 @@ enum disp_font_name {
DISP_FONT16 = 2, DISP_FONT16 = 2,
DISP_FONT20 = 3, DISP_FONT20 = 3,
DISP_FONT24 = 4, DISP_FONT24 = 4,
DISP_GOHUFONT = 99,
}; };
/** /**
......
...@@ -26,8 +26,8 @@ int main(void) ...@@ -26,8 +26,8 @@ int main(void)
const char *version_buf = CARD10_VERSION; const char *version_buf = CARD10_VERSION;
const int off = (160 - (int)strlen(version_buf) * 14) / 2; const int off = (160 - (int)strlen(version_buf) * 14) / 2;
epic_disp_clear(0x9dc0); epic_disp_clear(0x9dc0);
epic_disp_print(10, 20, "Epicardium", 0x6c20, 0x9dc0); epic_disp_print(10, 20, "Epicardium", 0x6c20, 0x9dc0, 0);
epic_disp_print(off > 0 ? off : 0, 40, version_buf, 0x6c20, 0x9dc0); epic_disp_print(off > 0 ? off : 0, 40, version_buf, 0x6c20, 0x9dc0, 0);
epic_disp_update(); epic_disp_update();
mxc_delay(2000000); mxc_delay(2000000);
......
...@@ -26,7 +26,8 @@ int epic_disp_print( ...@@ -26,7 +26,8 @@ int epic_disp_print(
uint16_t posy, uint16_t posy,
const char *pString, const char *pString,
uint16_t fg, uint16_t fg,
uint16_t bg uint16_t bg,
uint8_t font
) { ) {
return epic_disp_print_adv(DISP_FONT20, posx, posy, pString, fg, bg); return epic_disp_print_adv(DISP_FONT20, posx, posy, pString, fg, bg);
} }
...@@ -35,6 +36,7 @@ static const sFONT *font_map[] = { ...@@ -35,6 +36,7 @@ static const sFONT *font_map[] = {
[DISP_FONT8] = &Font8, [DISP_FONT12] = &Font12, [DISP_FONT8] = &Font8, [DISP_FONT12] = &Font12,
[DISP_FONT16] = &Font16, [DISP_FONT20] = &Font20, [DISP_FONT16] = &Font16, [DISP_FONT20] = &Font20,
[DISP_FONT24] = &Font24, [DISP_FONT24] = &Font24,
[DISP_GOHUFONT] = &GohuFont
}; };
int epic_disp_print_adv( int epic_disp_print_adv(
...@@ -63,6 +65,38 @@ int epic_disp_print_adv( ...@@ -63,6 +65,38 @@ int epic_disp_print_adv(
); );
return 0; 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) int epic_disp_clear(uint16_t color)
......
...@@ -180,9 +180,9 @@ __attribute__((noreturn)) static void pmic_die(float u_batt) ...@@ -180,9 +180,9 @@ __attribute__((noreturn)) static void pmic_die(float u_batt)
/* Draw an error screen */ /* Draw an error screen */
epic_disp_clear(0x0000); epic_disp_clear(0x0000);
epic_disp_print(0, 0, " Battery", 0xffff, 0x0000); epic_disp_print(0, 0, " Battery", 0xffff, 0x0000, 0);
epic_disp_print(0, 20, " critical", 0xffff, 0x0000); epic_disp_print(0, 20, " critical", 0xffff, 0x0000, 0);
epic_disp_print(0, 40, " !!!!", 0xffff, 0x0000); epic_disp_print(0, 40, " !!!!", 0xffff, 0x0000, 0);
epic_disp_update(); epic_disp_update();
/* Vibrate violently */ /* Vibrate violently */
......
...@@ -61,6 +61,8 @@ typedef struct _tFont ...@@ -61,6 +61,8 @@ typedef struct _tFont
} sFONT; } sFONT;
extern sFONT GohuFont;
extern sFONT Font24; extern sFONT Font24;
extern sFONT Font20; extern sFONT Font20;
extern sFONT Font16; extern sFONT Font16;
......
This diff is collapsed.
...@@ -8,6 +8,7 @@ includes = include_directories( ...@@ -8,6 +8,7 @@ includes = include_directories(
sources = files( sources = files(
'./GUI_DEV/DEV_Config.c', './GUI_DEV/DEV_Config.c',
'./LCD/LCD_Driver.c', './LCD/LCD_Driver.c',
'./Fonts/gohufont.c',
'./Fonts/font8.c', './Fonts/font8.c',
'./Fonts/font12.c', './Fonts/font12.c',
'./Fonts/font16.c', './Fonts/font16.c',
......
...@@ -7,6 +7,7 @@ FONT12 = 1 ...@@ -7,6 +7,7 @@ FONT12 = 1
FONT16 = 2 FONT16 = 2
FONT20 = 3 FONT20 = 3
FONT24 = 4 FONT24 = 4
GOHUFONT = 99
class Display: class Display:
......
...@@ -43,14 +43,16 @@ static mp_obj_t mp_display_print(size_t n_args, const mp_obj_t *args) ...@@ -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 posy = mp_obj_get_int(args[2]);
uint32_t fg = get_color(args[3]); uint32_t fg = get_color(args[3]);
uint32_t bg = get_color(args[4]); 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) { if (res < 0) {
mp_raise_OSError(-res); mp_raise_OSError(-res);
} }
return mp_const_none; return mp_const_none;
} }
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( 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 */ /* print something on the display */
......
...@@ -45,6 +45,7 @@ formatter_blacklist=( ...@@ -45,6 +45,7 @@ formatter_blacklist=(
lib/mx25lba/ lib/mx25lba/
lib/sdk/ lib/sdk/
lib/vendor/ lib/vendor/
lib/gfx/
openocd/ openocd/
docker/ docker/
) )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment