first commit

This commit is contained in:
tiijay
2025-11-03 15:05:22 +01:00
commit 941c168de8
24 changed files with 728 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
#include "font_5x7.h"
// Function to get font data for a character
const uint8_t *getFontChar(char c)
{
for (int i = 0; i < sizeof(font_chars) - 1; i++)
{
if (font_chars[i] == c)
{
return font_5x7[i];
}
}
return font_5x7[52]; // Return space if not found (index of ' ')
}
// Function to get character width
uint8_t getCharWidth(char c)
{
switch (c)
{
case 'I':
case '!':
case '.':
case ':':
case ';':
case '\'':
case '|':
return 1;
case 'i':
case ' ':
return 2;
case 'J':
case 'j':
case 'l':
case '(':
case ')':
case '[':
case ']':
case '{':
case '}':
// Nachher (Korrektur):
case 176: // '°' als ASCII Code
case 149: // '•' als ASCII Code
return 3;
case 'a':
case 'c':
case 'e':
case 'f':
case 'k':
case 's':
case 't':
case '<':
case '>':
case '`':
return 4;
default:
return 5;
}
}