Start text

This commit is contained in:
Miloslav Ciz 2024-12-17 00:56:51 +01:00
parent 30c9a55cb5
commit 6d31c3c492
4 changed files with 125 additions and 0 deletions

View file

@ -67,6 +67,73 @@ struct
const uint8_t *image;
} LCR_currentImage;
/*
Font characters are kind of "segmented display" characters, encoded with 16
bits (each for one segment) like this (numbered from LSB):
__0__ __2__
|\12 |\13 |
1| \ 5| \ 9|
| \ | \ |
|__4\_|__6\_|
|\14 |\15 |
3| \ 7| \ 11|
| \ | \ |
|__8\_|_10\_|
*/
uint16_t LCR_getFontChar(char c)
{
#define _F(a,b,c,d,e,f,g,h,i,j) return (1 << a) | (1 << b) | (1 << c) | (1 <<\
d) | (1 << e) | (1 << f) | (1 << g) | (1 << h) | (1 << i) | (1 << j); break;
switch (c)
{
case 'O': case 'o':
case '0': _F( 0, 2, 1, 9, 3,11, 8,10,10,10)
case '1': _F( 0, 5, 7, 8,10,10,10,10,10,10)
case 'Z': case 'z':
case '2': _F( 0, 2, 9, 4, 6, 3, 8,10,10,10)
case '3': _F( 0, 2, 9, 6,11, 8,10,10,10,10)
case '4': _F( 1, 4, 6, 9,11,11,11,11,11,11)
case 'S': case 's':
case '5': _F( 0, 2, 1, 4, 6,11, 8,10,10,10)
case '6': _F( 0, 2, 1, 3, 8,10,11, 6, 4, 4)
case '7': _F( 0, 2, 9,11,11,11,11,11,11,11)
case '8': _F( 0, 2, 1, 9, 4, 6, 3,11, 8,10)
case '9': _F( 0, 2, 1, 9, 4, 6,11, 8,10,10)
case 'A': case 'a': _F( 0, 1,13, 4, 6, 3,11,11,11,11)
case 'B': case 'b': _F( 0, 1,13, 4, 6, 3,11, 8,10,10)
case 'C': case 'c': _F( 0, 2, 1, 3, 8,10,10,10,10,10)
case 'D': case 'd': _F( 0, 1, 3, 8,10,13,11,11,11,11)
case 'E': case 'e': _F( 0, 2, 1, 3, 4, 8,10,10,10,10)
case 'F': case 'f': _F( 0, 2, 1, 3, 4, 4, 4, 4, 4, 4)
case 'G': case 'g': _F( 0, 2, 1, 3, 8,10,11, 6, 6, 6)
case 'H': case 'h': _F( 1, 3, 4, 6, 9,11,11,11,11,11)
case 'I': case 'i': _F( 0, 2, 5, 7, 8,10,10,10,10,10)
case 'J': case 'j': _F( 9,11,10,14,14,14,14,14,14,14)
case 'K': case 'k': _F( 1, 3, 4,15, 5, 2, 2, 2, 2, 2)
case 'L': case 'l': _F( 1, 3, 8,10,10,10,10,10,10,10)
case 'M': case 'm': _F( 1, 3,12, 5, 2, 9,11,11,11,11)
case 'N': case 'n': _F( 1, 3,12,15, 9,11,11,11,11,11)
case 'P': case 'p': _F( 0, 2, 1, 9, 4, 6, 3, 3, 3, 3)
case 'Q': case 'q': _F( 0, 2, 1, 9, 3,11, 8,10,15,15)
case 'R': case 'r': _F( 0, 2, 1, 9, 4, 6, 3,15,15,15)
case 'T': case 't': _F( 0, 2, 5, 7, 7, 7, 7, 7, 7, 7)
case 'U': case 'u': _F( 1, 3, 8,10,11, 9, 9, 9, 9, 9)
case 'V': case 'v': _F( 1,14,10,11, 9, 9, 9, 9, 9, 9)
case 'W': case 'w': _F( 1,14,10,11, 7, 9, 9, 9, 9, 9)
case 'X': case 'x': _F(12,15, 3, 4, 6, 9, 9, 9, 9, 9)
case 'Y': case 'y': _F(12, 6, 9, 7, 8, 8, 8, 8, 8, 8)
case ':': _F( 4, 8, 8, 8, 8, 8, 8, 8, 8, 8)
case '.': _F( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8)
case ',': _F( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7)
default: return 0; break;
}
#undef _F
}
#define LCR_IMAGE_WALL_CONCRETE 0
#define LCR_IMAGE_WALL_WOOD 1
#define LCR_IMAGE_GROUND_CONCRETE 2