From 408d99783ae494a04b1735c33c3eef580ac91da1 Mon Sep 17 00:00:00 2001 From: bartool Date: Sun, 26 Mar 2023 09:46:44 +0200 Subject: [PATCH] [fix] feature: font_gfx small fixes for include files --- firmware/func_gen_stm32f303re_nucleo/Makefile | 1 + firmware/shared_libs/display/font_gfx.c | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/firmware/func_gen_stm32f303re_nucleo/Makefile b/firmware/func_gen_stm32f303re_nucleo/Makefile index 23ef676..f848428 100644 --- a/firmware/func_gen_stm32f303re_nucleo/Makefile +++ b/firmware/func_gen_stm32f303re_nucleo/Makefile @@ -79,6 +79,7 @@ C_SOURCES += ../shared_libs/drivers/st7565/st7565.c C_SOURCES += ../shared_libs/drivers/hw_button/hw_button.c # display C_SOURCES += ../shared_libs/display/display_gfx.c +C_SOURCES += ../shared_libs/display/font_gfx.c # ASM sources ASM_SOURCES = \ diff --git a/firmware/shared_libs/display/font_gfx.c b/firmware/shared_libs/display/font_gfx.c index 3792145..9c04b79 100644 --- a/firmware/shared_libs/display/font_gfx.c +++ b/firmware/shared_libs/display/font_gfx.c @@ -6,9 +6,9 @@ */ // #include "main.h" -#include "fonts.h" +#include "font_gfx.h" -static uint8_t font_string_lenght_px(const FONT_INFO *font, uint8_t *text); +static uint8_t font_string_lenght_px(const GFX_font_t *font, uint8_t *text); /** * @brief Write string at at the specified (x,y) position. @@ -20,11 +20,11 @@ static uint8_t font_string_lenght_px(const FONT_INFO *font, uint8_t *text); * @param color Color of pixel BM_NORMAL or BM_INVERSE for bitmap. * @return uint8_t */ -uint8_t DISP_writeString(GFX_display_t *disp, const FONT_INFO *font, uint8_t *text, uint8_t pos_x, uint8_t pos_y, GFX_BitmapColor_t color) +uint8_t DISP_writeString(GFX_display_t *disp, const GFX_font_t *font, uint8_t *text, uint8_t pos_x, uint8_t pos_y, GFX_BitmapColor_t color) { uint8_t actual_char, char_nr; GFX_bitmap_t char_bitmap; - const FONT_CHAR_INFO *charinfo; + const GFX_fontChar_t *charinfo; uint8_t height = font->heightPixels; uint8_t x = pos_x; @@ -32,14 +32,10 @@ uint8_t DISP_writeString(GFX_display_t *disp, const FONT_INFO *font, uint8_t *te switch (color) { - case BM_INVERSE: - // SSD1306_clear_buffer(width + 2, height + 2, pos_x - 1, pos_y - 1, WHITE); - // ST7565_writeBitmap(st7565_buffor, NULL, width + 2, height + 2, pos_x - 1, pos_y - 1, WHITE); + case BM_INVERSE:; DISP_drawFillRect(disp, pos_x - 1, pos_y - 1, width + 2, height + 2); break; default: - // SSD1306_clear_buffer(width + 2, height + 2, pos_x - 1, pos_y - 1, BLACK); - // ST7565_writeBitmap(st7565_buffor, NULL, width + 2, height + 2, pos_x - 1, pos_y - 1, BLACK); DISP_clearRegion(disp, pos_x - 1, pos_y - 1, width + 2, height + 2); break; } @@ -71,7 +67,7 @@ uint8_t DISP_writeString(GFX_display_t *disp, const FONT_INFO *font, uint8_t *te return x; } -static uint8_t font_string_lenght_px(const FONT_INFO *font, uint8_t *text) +static uint8_t font_string_lenght_px(const GFX_font_t *font, uint8_t *text) { uint8_t width = 0; while (*text)