40 SSD1306_OLD_FIXED_FORMAT = 0x00,
41 SSD1306_NEW_FIXED_FORMAT = 0x01,
42 SSD1306_NEW_FORMAT = 0x02,
43 SSD1306_SQUIX_FORMAT = 0x03,
46 uint16_t ssd1306_color = 0xFFFF;
47 lcduint_t ssd1306_cursorX = 0;
48 lcduint_t ssd1306_cursorY = 0;
50 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 51 uint8_t g_ssd1306_unicode = 1;
53 static void (*s_ssd1306_getCharBitmap)(uint16_t unicode,
SCharInfo *info) = NULL;
55 static const uint8_t *ssd1306_getCharGlyph(
char ch);
56 static const uint8_t *ssd1306_getU16CharGlyph(uint16_t unicode);
76 r->
start_code =( pgm_read_byte(&p[0]) << 8) | (pgm_read_byte(&p[1]));
77 r->
count = pgm_read_byte(&p[2]);
78 return (r->
count > 0) ? (&p[3]): NULL;
84 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 95 return s_ssd1306_getCharBitmap( unicode, info );
98 uint16_t ssd1306_unicode16FromUtf8(uint8_t ch)
100 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 101 static uint16_t unicode = 0;
112 uint16_t code = ((unicode & 0x1f) << 6) | (ch & 0x3f);
122 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 123 g_ssd1306_unicode = 1;
129 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 130 g_ssd1306_unicode = 0;
142 static const uint8_t *ssd1306_getCharGlyph(
char ch)
149 static const uint8_t *ssd1306_searchCharGlyph(
const uint8_t * unicode_table, uint16_t unicode)
152 const uint8_t *data = unicode_table;
156 ssd1306_readUnicodeRecord( &r, data );
171 return unicode_table;
176 static const uint8_t *ssd1306_getU16CharGlyph(uint16_t unicode)
178 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 179 const uint8_t * glyph = NULL;
180 if (g_ssd1306_unicode)
184 return ssd1306_getCharGlyph(unicode);
203 return ssd1306_getCharGlyph(unicode);
207 static void __ssd1306_oldFormatGetBitmap(uint16_t unicode,
SCharInfo *info)
214 info->
glyph = ssd1306_getU16CharGlyph( unicode );
225 s_ssd1306_getCharBitmap = __ssd1306_oldFormatGetBitmap;
228 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 237 static void __ssd1306_newFormatGetBitmap(uint16_t unicode,
SCharInfo *info)
241 uint8_t table_index = 0;
246 data = ssd1306_readUnicodeRecord( &r, data );
249 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 250 if ( table_index == 0 )
265 data += ((pgm_read_byte(&data[0]) << 8) | (pgm_read_byte(&data[1]))) + 2;
271 uint16_t offset = (pgm_read_byte(&data[0]) << 8) | (pgm_read_byte(&data[1]));
272 uint8_t glyph_width = pgm_read_byte(&data[2]);
273 uint8_t glyph_height = pgm_read_byte(&data[3]);
274 info->
width = glyph_width;
275 info->
height = glyph_height;
277 info->
glyph = data + (r.
count - unicode) * 4 + 2 + offset;
297 s_ssd1306_getCharBitmap = __ssd1306_newFormatGetBitmap;
299 #ifdef CONFIG_SSD1306_UNICODE_ENABLE 308 static void __ssd1306_squixFormatGetBitmap(uint16_t unicode,
SCharInfo *info)
325 data += (unicode * 4);
326 uint16_t offset = (pgm_read_byte(&data[0]) << 8) | pgm_read_byte(&data[1]);
327 uint8_t glyph_bytes = pgm_read_byte(&data[2]);
329 info->
width = glyph_bytes;
333 info->
glyph = bitmap_data;
334 if ( offset != 0xFFFF )
336 info->
glyph += offset;
341 void ssd1306_setSquixFont(
const uint8_t * progmemFont)
349 s_ssd1306_getCharBitmap = __ssd1306_squixFormatGetBitmap;
352 #ifdef CONFIG_SSD1306_UNICODE_ENABLE void ssd1306_setCursor(lcdint_t x, lcdint_t y)
Sets cursor position for text mode print functions.
uint8_t height
char height in pixels
const uint8_t * primary_table
font chars bits
uint16_t start_code
unicode start code
void ssd1306_enableAsciiMode(void)
void ssd1306_getCharBitmap(uint16_t unicode, SCharInfo *info)
returns char data for currently set (active) font.
uint8_t ssd1306_displayWidth()
ssd1306_lcd_t ssd1306_lcd
void ssd1306_setFixedFont(const uint8_t *progmemFont)
void ssd1306_setFreeFont(const uint8_t *progmemFont)
uint8_t count
count of unicode chars in block
void ssd1306_enableUtf8Mode(void)
uint8_t width
char width in pixels
const uint8_t * secondary_table
font chars bits
SFixedFontInfo s_fixedFont
SFontHeaderRecord h
record, containing information on font
void ssd1306_setSecondaryFont(const uint8_t *progmemUnicode)
const uint8_t * glyph
char data, located in progmem.
#define SSD1306_MORE_CHARS_REQUIRED
uint8_t spacing
additional spaces after char in pixels
uint8_t ssd1306_displayHeight()
uint8_t glyph_size
glyph size in bytes
uint8_t pages
height in pages (each page height is 8-pixels)
uint8_t count
count of characters