From 233cb53f8c86f7968ad3ff9686f121111902d305 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 15 Jun 2021 23:17:01 +0200 Subject: [PATCH] Add custom bootlogo_template.h --- .gitignore | 1 + lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp | 2 +- src/custom/bootlogo_template.h | 38 ++++++++++++++++++++++++ src/drv/tft/tft_driver_sdl2.cpp | 4 +-- src/drv/tft/tft_driver_tftespi.cpp | 3 -- src/drv/tft/tft_driver_tftespi.h | 2 +- 6 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 src/custom/bootlogo_template.h diff --git a/.gitignore b/.gitignore index d4040dca..ec12ef67 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ build_output/firmware/*.bin build_output/firmware/*.exe src/custom/* !src/custom/README.md +!src/custom/bootlogo_template.h ## Test result files *.xml diff --git a/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp b/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp index 6b485257..a093aefe 100644 --- a/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp +++ b/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp @@ -54,7 +54,7 @@ TFT_Class tft(io, controller, TFT_WIDTH, TFT_HEIGHT); #include // 240x320 #include "GxReadRegisters.h" - #include "bootscreen.h" // Sketch tab header for xbm images + #include "custom/bootlogo_template.h" // Sketch tab header for xbm images /********************* * DEFINES diff --git a/src/custom/bootlogo_template.h b/src/custom/bootlogo_template.h new file mode 100644 index 00000000..0beb2adc --- /dev/null +++ b/src/custom/bootlogo_template.h @@ -0,0 +1,38 @@ +// Images can be converted to XBM format by using the online converter here: +// https://www.online-utility.org/image/convert/to/XBM + +// The output must be pasted in a header file, renamed and adjusted to appear +// as as a const unsigned char array in PROGMEM (FLASH program memory). + +// The xbm format adds padding to pixel rows so they are a whole number of bytes +// In this example 93 pixel width means 96 bits = 12 bytes +// the 16 height then means array uses 12 x 16 = 192 bytes of FLASH +// The library ignores the padding bits when drawing the image on the display. + +// The openHASP logo uses the MaterialDesign icons font, released under the OFL license + +// Usage: +// - Copy this file to src/custom/bootlogo.h +// - Add #define HASP_CUSTOMIZE_BOOTLOGO to include/user_config_override.h + +// RGB array +#define logoBgColor {0,128,128} +#define logoFgColor {255,255,255} + +#define logoWidth 93 +#define logoHeight 16 + +// Image is stored in the array below, also update the width and height accordingly +PROGMEM const unsigned char logoImage[] = { + 0x7C, 0xF0, 0x07, 0xFF, 0x71, 0x1C, 0xC7, 0xC1, 0x07, 0xFC, 0xF1, 0x07, 0xFE, 0xF0, 0x0F, 0xFF, 0xF1, 0x1C, + 0xC7, 0xE1, 0x0F, 0xFE, 0xF1, 0x0F, 0xFF, 0xF1, 0x1F, 0xFF, 0xF1, 0x1C, 0xC7, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, + 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1C, 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1D, + 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1D, 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, + 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1F, 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, 0xC7, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, + 0xFF, 0xF1, 0x1F, 0xFF, 0xF0, 0x1F, 0xC7, 0xF1, 0x0F, 0xFF, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, 0xFE, 0xF1, 0x0F, + 0xC7, 0xF1, 0x07, 0xFF, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, 0xFC, 0xF1, 0x07, 0xC7, 0x71, 0x00, 0x07, 0x70, 0x1F, + 0xC7, 0x71, 0x1C, 0xC0, 0x71, 0x00, 0xC7, 0x71, 0x00, 0x07, 0x70, 0x1F, 0xC7, 0x71, 0x1C, 0xC0, 0x71, 0x00, + 0xC7, 0x71, 0x00, 0x07, 0x70, 0x1E, 0xC7, 0x71, 0x1C, 0xC0, 0x71, 0x00, 0xFF, 0x71, 0x00, 0xFF, 0x71, 0x1E, + 0xC7, 0x71, 0x1C, 0xFF, 0x71, 0x00, 0xFE, 0x70, 0x00, 0xFF, 0x71, 0x1E, 0xC7, 0x71, 0x1C, 0xFF, 0x71, 0x00, + 0x7C, 0x70, 0x00, 0xFF, 0x71, 0x1C, 0xC7, 0x71, 0x1C, 0xFF, 0x70, 0x00, +}; diff --git a/src/drv/tft/tft_driver_sdl2.cpp b/src/drv/tft/tft_driver_sdl2.cpp index 5863818f..63b47644 100644 --- a/src/drv/tft/tft_driver_sdl2.cpp +++ b/src/drv/tft/tft_driver_sdl2.cpp @@ -19,7 +19,7 @@ #ifdef HASP_CUSTOMIZE_BOOTLOGO #include "custom/bootlogo.h" // Sketch tab header for xbm images #else -#include "bootscreen.h" // Sketch tab header for xbm images +#include "custom/bootlogo_template.h" // Sketch tab header for xbm images #endif namespace dev { @@ -67,7 +67,7 @@ void TftSdl::init(int w, int h) void TftSdl::show_info() { splashscreen(); - + SDL_version linked; SDL_GetVersion(&linked); LOG_VERBOSE(TAG_TFT, F("Driver : SDL2")); diff --git a/src/drv/tft/tft_driver_tftespi.cpp b/src/drv/tft/tft_driver_tftespi.cpp index d4e91394..fd4d597d 100644 --- a/src/drv/tft/tft_driver_tftespi.cpp +++ b/src/drv/tft/tft_driver_tftespi.cpp @@ -133,18 +133,15 @@ void IRAM_ATTR TftEspi::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, { uint32_t w = (area->x2 - area->x1 + 1); uint32_t h = (area->y2 - area->y1 + 1); - // size_t len = lv_area_get_size(area); uint32_t len = w * h; #ifdef USE_DMA_TO_TFT tft.startWrite(); /* Start new TFT transaction */ - // tft.setWindow(area->x1, area->y1, area->x2, area->y2); tft.setAddrWindow(area->x1, area->y1, w, h); /* set the working window */ tft.pushPixelsDMA((uint16_t*)color_p, len); /* Write words at once */ tft.endWrite(); /* terminate TFT transaction */ #else tft.startWrite(); /* Start new TFT transaction */ - // tft.setWindow(area->x1, area->y1, area->x2, area->y2); tft.setAddrWindow(area->x1, area->y1, w, h); /* set the working window */ tft.pushPixels((uint16_t*)color_p, len); /* Write words at once */ tft.endWrite(); /* terminate TFT transaction */ diff --git a/src/drv/tft/tft_driver_tftespi.h b/src/drv/tft/tft_driver_tftespi.h index e3c8906b..20f4a76d 100644 --- a/src/drv/tft/tft_driver_tftespi.h +++ b/src/drv/tft/tft_driver_tftespi.h @@ -18,7 +18,7 @@ #ifdef HASP_CUSTOMIZE_BOOTLOGO #include "custom/bootlogo.h" // Sketch tab header for xbm images #else -#include "bootscreen.h" // Sketch tab header for xbm images +#include "custom/bootlogo_template.h" // Sketch tab header for xbm images #endif namespace dev {