Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for large (8x16) fonts on small (128x32) SSD1306 displays #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions disp_oled_ssd1306.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "i2c_master.h"

#ifdef LCD_SSD1306_BIG_FONTS
#include "font8x16.h"
#else
#include "font8x8.h"
#endif

#define NUM_COLS 16
#define NUM_ROWS 2
Expand Down Expand Up @@ -119,29 +124,34 @@ void lcd_noBacklight() {

}


void write_raw(uint8_t value, uint8_t cursor) {
uint8_t i, v, col;
uint8_t c = value - 32;

col = _col << 3; // convert to pixel: character column * 8
void write_raw_part(const uint8_t *data, uint8_t cursor_mask, int col, int row) {
ssd1306_send_command_start();
i2c_write(SSD1306_SETSTARTPAGE + _row);
i2c_write(SSD1306_SETSTARTPAGE + row);
i2c_write((col & 0x0f) | SSD1306_LOWCOLUMNADDR);
i2c_write(((col & 0xf0) >> 4) | SSD1306_HIGHCOLUMNADDR);

ssd1306_send_data_start();
// write 1 column of the character per iteration
for (i = 0; i < 8; i++)
for (int i = 0; i < 8; i++)
{
v = pgm_read_byte(&font8x8[c * 8 + i]);
// add underline for cursor: last pixel in the column
if (cursor) v |= 0x80;
uint8_t v = pgm_read_byte(&data[i]) | cursor_mask;
i2c_write(v);
}
i2c_stop();
}

void write_raw(uint8_t value, uint8_t cursor) {
uint8_t col = _col << 3; // convert to pixel: character column * 3
uint8_t c = value - 32;

#ifdef LCD_SSD1306_BIG_FONTS
write_raw_part(&font8x16_top[c * 8], 0, col, 2*_row);
write_raw_part(&font8x16_bottom[c * 8], cursor ? 0x80 : 0, col, 2*_row+1);
#else
write_raw_part(&font8x8[c * 8], 0, col, _row);
#endif
}

void lcd_setCursor(uint8_t col, uint8_t row)
{
if ((row < NUM_ROWS) && (col < NUM_COLS)) {
Expand Down
196 changes: 196 additions & 0 deletions font8x16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
#include <avr/pgmspace.h>

const uint8_t font8x16_bottom [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x20] ' '
0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, // [0x21] '!'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x22] '"'
0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02, 0x00, // [0x23] '#'
0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07, 0x00, // [0x24] '$'
0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C, 0x00, // [0x25] '%'
0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08, 0x00, // [0x26] '&'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x27] '''
0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00, 0x00, // [0x28] '('
0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00, 0x00, // [0x29] ')'
0x00, 0x02, 0x03, 0x01, 0x01, 0x03, 0x02, 0x00, // [0x2A] '*'
0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, // [0x2B] '+'
0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00, 0x00, // [0x2C] ','
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x2D] '-'
0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x00, // [0x2E] '.'
0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, // [0x2F] '/'
0x03, 0x07, 0x0C, 0x08, 0x0C, 0x07, 0x03, 0x00, // [0x30] '0'
0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08, 0x00, // [0x31] '1'
0x0E, 0x0F, 0x09, 0x08, 0x08, 0x0C, 0x0C, 0x00, // [0x32] '2'
0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x33] '3'
0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00, // [0x34] '4'
0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x35] '5'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x36] '6'
0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, // [0x37] '7'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x38] '8'
0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03, 0x00, // [0x39] '9'
0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, // [0x3A] ':'
0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00, 0x00, // [0x3B] ';'
0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08, 0x00, // [0x3C] '<'
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, // [0x3D] '='
0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, // [0x3E] '>'
0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, // [0x3F] '?'
0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01, 0x00, // [0x40] '@'
0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x41] 'A'
0x08, 0x0F, 0x0F, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x42] 'B'
0x03, 0x07, 0x0C, 0x08, 0x08, 0x0C, 0x06, 0x00, // [0x43] 'C'
0x08, 0x0F, 0x0F, 0x08, 0x0C, 0x07, 0x03, 0x00, // [0x44] 'D'
0x08, 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x0E, 0x00, // [0x45] 'E'
0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, // [0x46] 'F'
0x03, 0x07, 0x0C, 0x08, 0x08, 0x07, 0x0F, 0x00, // [0x47] 'G'
0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x48] 'H'
0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, // [0x49] 'I'
0x07, 0x0F, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00, // [0x4A] 'J'
0x08, 0x0F, 0x0F, 0x00, 0x01, 0x0F, 0x0E, 0x00, // [0x4B] 'K'
0x08, 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x0E, 0x00, // [0x4C] 'L'
0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x4D] 'M'
0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x4E] 'N'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x4F] 'O'
0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, // [0x50] 'P'
0x07, 0x0F, 0x08, 0x0E, 0x3C, 0x3F, 0x27, 0x00, // [0x51] 'Q'
0x08, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x52] 'R'
0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x53] 'S'
0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, // [0x54] 'T'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x55] 'U'
0x01, 0x03, 0x06, 0x0C, 0x06, 0x03, 0x01, 0x00, // [0x56] 'V'
0x07, 0x0F, 0x0E, 0x03, 0x0E, 0x0F, 0x07, 0x00, // [0x57] 'W'
0x0C, 0x0F, 0x03, 0x01, 0x03, 0x0F, 0x0C, 0x00, // [0x58] 'X'
0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, // [0x59] 'Y'
0x0E, 0x0F, 0x09, 0x08, 0x08, 0x0C, 0x0E, 0x00, // [0x5A] 'Z'
0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00, 0x00, // [0x5B] '['
0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x00, // [0x5C] '\'
0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00, 0x00, // [0x5D] ']'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x5E] '^'
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // [0x5F] '_'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x60] '`'
0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08, 0x00, // [0x61] 'a'
0x00, 0x0F, 0x0F, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x62] 'b'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04, 0x00, // [0x63] 'c'
0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08, 0x00, // [0x64] 'd'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04, 0x00, // [0x65] 'e'
0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, // [0x66] 'f'
0x27, 0x6F, 0x48, 0x48, 0x7F, 0x3F, 0x00, 0x00, // [0x67] 'g'
0x08, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x68] 'h'
0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, // [0x69] 'i'
0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F, 0x00, // [0x6A] 'j'
0x08, 0x0F, 0x0F, 0x01, 0x03, 0x0E, 0x0C, 0x00, // [0x6B] 'k'
0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, // [0x6C] 'l'
0x0F, 0x0F, 0x00, 0x07, 0x00, 0x0F, 0x0F, 0x00, // [0x6D] 'm'
0x00, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x00, // [0x6E] 'n'
0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07, 0x00, // [0x6F] 'o'
0x40, 0x7F, 0x7F, 0x48, 0x08, 0x0F, 0x07, 0x00, // [0x70] 'p'
0x07, 0x0F, 0x08, 0x48, 0x7F, 0x7F, 0x40, 0x00, // [0x71] 'q'
0x08, 0x0F, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, // [0x72] 'r'
0x04, 0x0C, 0x09, 0x09, 0x0B, 0x0E, 0x04, 0x00, // [0x73] 's'
0x00, 0x00, 0x07, 0x0F, 0x08, 0x0C, 0x04, 0x00, // [0x74] 't'
0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08, 0x00, // [0x75] 'u'
0x00, 0x03, 0x07, 0x0C, 0x0C, 0x07, 0x03, 0x00, // [0x76] 'v'
0x07, 0x0F, 0x0C, 0x07, 0x0C, 0x0F, 0x07, 0x00, // [0x77] 'w'
0x08, 0x0C, 0x07, 0x03, 0x07, 0x0C, 0x08, 0x00, // [0x78] 'x'
0x47, 0x4F, 0x48, 0x48, 0x68, 0x3F, 0x1F, 0x00, // [0x79] 'y'
0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x0C, 0x0C, 0x00, // [0x7A] 'z'
0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x00, // [0x7B] '{'
0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, // [0x7C] '|'
0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00, 0x00, // [0x7D] '}'
0x00, 0x00, 0x00, 0x02, 0x03, 0x01, 0x00, 0x00, // [0x7E] '->'
};
const uint8_t font8x16_top [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x20] ' '
0x00, 0x00, 0x38, 0xFC, 0xFC, 0x38, 0x00, 0x00, // [0x21] '!'
0x00, 0x0E, 0x1E, 0x00, 0x00, 0x1E, 0x0E, 0x00, // [0x22] '"'
0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, 0x00, // [0x23] '#'
0x38, 0x7C, 0x44, 0x47, 0x47, 0xCC, 0x98, 0x00, // [0x24] '$'
0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x00, // [0x25] '%'
0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, 0x00, // [0x26] '&'
0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00, 0x00, 0x00, // [0x27] '''
0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, 0x00, // [0x28] '('
0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, 0x00, // [0x29] ')'
0x80, 0xA0, 0xE0, 0xC0, 0xC0, 0xE0, 0xA0, 0x80, // [0x2A] '*'
0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, 0x00, // [0x2B] '+'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x2C] ','
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, // [0x2D] '-'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x2E] '.'
0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x00, // [0x2F] '/'
0xF0, 0xF8, 0x0C, 0xC4, 0x0C, 0xF8, 0xF0, 0x00, // [0x30] '0'
0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, 0x00, // [0x31] '1'
0x08, 0x0C, 0x84, 0xC4, 0x64, 0x3C, 0x18, 0x00, // [0x32] '2'
0x08, 0x0C, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, // [0x33] '3'
0xC0, 0xE0, 0xB0, 0x98, 0xFC, 0xFC, 0x80, 0x00, // [0x34] '4'
0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, 0x00, // [0x35] '5'
0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC0, 0x80, 0x00, // [0x36] '6'
0x0C, 0x0C, 0x04, 0x84, 0xC4, 0x7C, 0x3C, 0x00, // [0x37] '7'
0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, // [0x38] '8'
0x38, 0x7C, 0x44, 0x44, 0x44, 0xFC, 0xF8, 0x00, // [0x39] '9'
0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, // [0x3A] ':'
0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, // [0x3B] ';'
0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, 0x00, // [0x3C] '<'
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, // [0x3D] '='
0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, // [0x3E] '>'
0x18, 0x1C, 0x04, 0xC4, 0xE4, 0x3C, 0x18, 0x00, // [0x3F] '?'
0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, 0x00, // [0x40] '@'
0xE0, 0xF0, 0x98, 0x8C, 0x98, 0xF0, 0xE0, 0x00, // [0x41] 'A'
0x04, 0xFC, 0xFC, 0x44, 0x44, 0xFC, 0xB8, 0x00, // [0x42] 'B'
0xF0, 0xF8, 0x0C, 0x04, 0x04, 0x0C, 0x18, 0x00, // [0x43] 'C'
0x04, 0xFC, 0xFC, 0x04, 0x0C, 0xF8, 0xF0, 0x00, // [0x44] 'D'
0x04, 0xFC, 0xFC, 0x44, 0xE4, 0x0C, 0x1C, 0x00, // [0x45] 'E'
0x04, 0xFC, 0xFC, 0x44, 0xE4, 0x0C, 0x1C, 0x00, // [0x46] 'F'
0xF0, 0xF8, 0x0C, 0x84, 0x84, 0x8C, 0x98, 0x00, // [0x47] 'G'
0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, 0x00, // [0x48] 'H'
0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, 0x00, // [0x49] 'I'
0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, // [0x4A] 'J'
0x04, 0xFC, 0xFC, 0xC0, 0xE0, 0x3C, 0x1C, 0x00, // [0x4B] 'K'
0x04, 0xFC, 0xFC, 0x04, 0x00, 0x00, 0x00, 0x00, // [0x4C] 'L'
0xFC, 0xFC, 0x38, 0x70, 0x38, 0xFC, 0xFC, 0x00, // [0x4D] 'M'
0xFC, 0xFC, 0x38, 0x70, 0xE0, 0xFC, 0xFC, 0x00, // [0x4E] 'N'
0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, 0x00, // [0x4F] 'O'
0x04, 0xFC, 0xFC, 0x44, 0x44, 0x7C, 0x38, 0x00, // [0x50] 'P'
0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, 0x00, // [0x51] 'Q'
0x04, 0xFC, 0xFC, 0x44, 0xC4, 0xFC, 0x38, 0x00, // [0x52] 'R'
0x18, 0x3C, 0x64, 0x44, 0xC4, 0x9C, 0x18, 0x00, // [0x53] 'S'
0x00, 0x1C, 0x0C, 0xFC, 0xFC, 0x0C, 0x1C, 0x00, // [0x54] 'T'
0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, // [0x55] 'U'
0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, // [0x56] 'V'
0xFC, 0xFC, 0x00, 0xC0, 0x00, 0xFC, 0xFC, 0x00, // [0x57] 'W'
0x0C, 0x3C, 0xF0, 0xE0, 0xF0, 0x3C, 0x0C, 0x00, // [0x58] 'X'
0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, 0x00, // [0x59] 'Y'
0x1C, 0x0C, 0x84, 0xC4, 0x64, 0x3C, 0x1C, 0x00, // [0x5A] 'Z'
0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, 0x00, // [0x5B] '['
0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, // [0x5C] '\'
0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, 0x00, // [0x5D] ']'
0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, 0x00, // [0x5E] '^'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x5F] '_'
0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, 0x00, // [0x60] '`'
0x00, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, 0x00, 0x00, // [0x61] 'a'
0x04, 0xFC, 0xFC, 0x20, 0x60, 0xC0, 0x80, 0x00, // [0x62] 'b'
0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, 0x00, // [0x63] 'c'
0x80, 0xC0, 0x60, 0x24, 0xFC, 0xFC, 0x00, 0x00, // [0x64] 'd'
0xC0, 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, 0x00, // [0x65] 'e'
0x40, 0xF8, 0xFC, 0x44, 0x0C, 0x18, 0x00, 0x00, // [0x66] 'f'
0xC0, 0xE0, 0x20, 0x20, 0xC0, 0xE0, 0x20, 0x00, // [0x67] 'g'
0x04, 0xFC, 0xFC, 0x40, 0x20, 0xE0, 0xC0, 0x00, // [0x68] 'h'
0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, 0x00, // [0x69] 'i'
0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, // [0x6A] 'j'
0x04, 0xFC, 0xFC, 0x80, 0xC0, 0x60, 0x20, 0x00, // [0x6B] 'k'
0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, 0x00, // [0x6C] 'l'
0xE0, 0xE0, 0x60, 0xC0, 0x60, 0xE0, 0xC0, 0x00, // [0x6D] 'm'
0x20, 0xE0, 0xC0, 0x20, 0x20, 0xE0, 0xC0, 0x00, // [0x6E] 'n'
0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, // [0x6F] 'o'
0x20, 0xE0, 0xC0, 0x20, 0x20, 0xE0, 0xC0, 0x00, // [0x70] 'p'
0xC0, 0xE0, 0x20, 0x20, 0xC0, 0xE0, 0x20, 0x00, // [0x71] 'q'
0x20, 0xE0, 0xC0, 0x60, 0x20, 0xE0, 0xC0, 0x00, // [0x72] 'r'
0x40, 0xE0, 0xA0, 0x20, 0x20, 0x60, 0x40, 0x00, // [0x73] 's'
0x20, 0x20, 0xF8, 0xFC, 0x20, 0x20, 0x00, 0x00, // [0x74] 't'
0xE0, 0xE0, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, // [0x75] 'u'
0x00, 0xE0, 0xE0, 0x00, 0x00, 0xE0, 0xE0, 0x00, // [0x76] 'v'
0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, 0x00, // [0x77] 'w'
0x20, 0x60, 0xC0, 0x80, 0xC0, 0x60, 0x20, 0x00, // [0x78] 'x'
0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, // [0x79] 'y'
0x60, 0x60, 0x20, 0xA0, 0xE0, 0x60, 0x20, 0x00, // [0x7A] 'z'
0x00, 0x40, 0x40, 0xF8, 0xBC, 0x04, 0x04, 0x00, // [0x7B] '{'
0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, 0x00, // [0x7C] '|'
0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x40, 0x00, // [0x7D] '}'
0x80, 0x80, 0x80, 0xA0, 0xE0, 0xC0, 0x80, 0x00, // [0x7E] '->'
};
1 change: 1 addition & 0 deletions tools/font/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fontconverter
Binary file added tools/font/IBM_VGA_8x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions tools/font/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# README

This directory contains a small tool to generate the 8x16 font used as big font
for small (128x32) SSD1306 displays.

## Prerequisites
To build the tool, you need Go 1.13 or later.

## Building and running to the converter
To create the header file, just execute
```
go run fontconverter.go
```

This will read the image `IBM_VGA_8x16.png` and convert it to the header file
`font8x16.h` in Tapuino's source directory.

If you want to convert a different image, or to a different target, just add
source and target to the command line:
```
go run fontconverter.go <image> <headerfile>
```

## Credits
The font image was taken from https://github.com/spacerace/romfont/blob/master/font-images/IBM_VGA_8x16.png

Loading