sprawdzone na sprzecie. wszystko ok

This commit is contained in:
2021-05-31 21:23:25 +02:00
parent b6a0de5529
commit 765f57b4b3
5 changed files with 28 additions and 190 deletions

View File

@@ -9,7 +9,7 @@
#include "fonts.h"
#include "SSD1306_oled.h"
uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, uint8_t pos_y)
uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, uint8_t pos_y, uint8_t mode)
{
uint8_t height = font->heightPixels;
@@ -17,7 +17,14 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
uint8_t width = font_string_lenght_px(font, text);
SSD1306_clear_buffer(width+2, height+2, pos_x-1, pos_y-1, BLACK);
switch (mode) {
case INVERSE:
SSD1306_clear_buffer(width+2, height+2, pos_x-1, pos_y-1, WHITE);
break;
default:
SSD1306_clear_buffer(width+2, height+2, pos_x-1, pos_y-1, BLACK);
break;
}
while(*text)
{
@@ -30,7 +37,7 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
uint8_t char_nr = actual_char - font->startChar;
const FONT_CHAR_INFO *charinfo = &font->charInfo[char_nr];
SSD1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, WHITE);
SSD1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, mode);
x += charinfo->widthBits + font->interspacePixels;
}