From 53e3b1d57f3e20319239c246fea6902e7e1a316f Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Mon, 19 Aug 2019 18:19:50 +0200 Subject: [PATCH] feat(epicardium): Only perform fast display init The bootloader will have initialized the display in all cases so we don't need to repeat the same init code all over again. Signed-off-by: Rahix <rahix@rahix.de> --- epicardium/modules/hardware.c | 6 +++++- lib/card10/display.c | 15 +++++++++++++++ lib/card10/display.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/epicardium/modules/hardware.c b/epicardium/modules/hardware.c index 64581269..f753d85a 100644 --- a/epicardium/modules/hardware.c +++ b/epicardium/modules/hardware.c @@ -80,7 +80,11 @@ int hardware_early_init(void) ; } - display_init(); + /* + * The bootloader has already initialized the display, so we only need + * to do the bare minimum here (mostly the gfx datastructures). + */ + display_init_slim(); /* * RGB LEDs diff --git a/lib/card10/display.c b/lib/card10/display.c index 2756ccb7..52bca138 100644 --- a/lib/card10/display.c +++ b/lib/card10/display.c @@ -103,3 +103,18 @@ void display_init(void) txt_init(&display_textb, &display_screen, &Font12); gfx_clear(&display_screen); } + +void display_init_slim(void) +{ + if (!portexpander_detected()) { + // Open-drain + MAX77650_setDRV(false); + // Output + MAX77650_setDIR(false); + } + + GPIO_Config(&DEV_DC_PIN); + + display_screen = gfx_screen(LCD_framebuffer()); + txt_init(&display_textb, &display_screen, &Font12); +} diff --git a/lib/card10/display.h b/lib/card10/display.h index 47f82a37..5d9508be 100644 --- a/lib/card10/display.h +++ b/lib/card10/display.h @@ -6,5 +6,6 @@ extern struct gfx_region display_screen; extern struct txt_buffer display_textb; void display_init(void); +void display_init_slim(void); #endif -- GitLab