Added LCD7920 library ported by Matthias (@madias on the Arduino forum)

This commit is contained in:
Roger Clark 2015-03-07 00:28:59 +11:00
parent 33e332b0a6
commit ef6adc6534
8 changed files with 1230 additions and 0 deletions

View File

@ -0,0 +1,60 @@
// ST7920-based 128x64 pixel graphic LCD demo program
// Written by D. Crocker, Escher Technologies Ltd.
// adapted for STM32-arduino by Matthias Diro and added some fonts and new commands (box, fillbox, fastVline, fastHline)
// library doesn't use SPI or some low level pin toggles --> too fast for the display
// setup Display:
// PSB must be set to ground for serial mode: maybe you must unsolder a resistor!
// only two lines are needed: R/W = Mosi, E=SCK, just solder RS (Slave select) to +5V, it isn't needed!
// maple mini user: you must set VCC to +5V, but you don't have it onboard!
#include "lcd7920_STM.h"
// some fonts
//extern const PROGMEM LcdFont font10x10_STM; // in glcd10x10.cpp
extern const PROGMEM LcdFont font5x7_STM; // in glcd10x10.cpp
//extern const PROGMEM LcdFont font16x16_STM; // in glcs16x16.cpp
// Define the following as true to use SPI to drive the LCD, false to drive it slowly instead
#define LCD_USE_SPI (false) // no SPI yet for STM32
const int MOSIpin = 6;
const int SCLKpin = 7;
// LCD
static Lcd7920 lcd(SCLKpin, MOSIpin, LCD_USE_SPI);
// Initialization
void setup()
{
lcd.begin(true); // init lcd in graphics mode
lcd.setFont(&font5x7_STM);
lcd.setCursor(35, 0);
lcd.textInvert(1);
lcd.print("Counter: ");
lcd.textInvert(0);
}
void loop()
{
static byte counter = 0;
//
counter++;
if (counter > 128)
{
counter = 0;
delay(1000);
lcd.clear();
lcd.setCursor(35, 0);
lcd.print("Counter: ");
}
lcd.box(0, 0, counter - 1, 5, PixelClear);
lcd.box(0, 0, counter, 5, PixelSet);
lcd.fillbox(0, 55, counter, 10, PixelSet);
lcd.circle(100, 31, counter / 8, PixelSet);
lcd.flush();
lcd.setCursor(35, 55);
lcd.print(counter);
lcd.print(" ");
}

View File

@ -0,0 +1,137 @@
#include "lcd7920_STM.h"
//Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
//MikroElektronika 2011
//http://www.mikroe.com
//GLCD FontName : glcd10x10
//GLCD FontSize : 10 x 10
// Note that we replace the fullstop character by decimal point so that the Arduino print functions display a decimla point when printing numbers.
PROGMEM const uint8_t glcd10x10_STM[] = {
0x04, 0x06, 0x00, 0x09, 0x00, 0x09, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for degree symbol 
0x09, 0x38, 0x00, 0x45, 0x00, 0x83, 0x00, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x82, 0x01, 0x44, 0x01, 0x38, 0x00, 0x00, 0x00, // Code for rotating arrows 1 
0x09, 0xE0, 0x00, 0x64, 0x00, 0xA2, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x8A, 0x00, 0x4C, 0x00, 0x0E, 0x00, 0x00, 0x00, // Code for rotating arrows 2
0x0A, 0x10, 0x00, 0x10, 0x00, 0xFF, 0x01, 0xFE, 0x00, 0x7C, 0x00, 0x38, 0x00, 0x10, 0x00, 0xFF, 0x01, 0x10, 0x00, 0x10, 0x00, // Code for diode 
0x08, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xFF, 0x01, 0x28, 0x00, 0x44, 0x01, 0x82, 0x01, 0xC1, 0x01, 0x00, 0x00, 0x00, 0x00, // Code for transistor 
0x07, 0x30, 0x00, 0x60, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for tick 
0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for full stop 
0x03, 0xFF, 0x00, 0x81, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x03, 0xFF, 0x00, 0x81, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x03, 0xFF, 0x00, 0x81, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x03, 0xFF, 0x00, 0x81, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x03, 0xFF, 0x00, 0x81, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x01, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char !
0x03, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char "
0x05, 0x24, 0x00, 0xFF, 0x00, 0x24, 0x00, 0xFF, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char #
0x05, 0x46, 0x00, 0x89, 0x00, 0xFF, 0x01, 0x89, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char $
0x09, 0x06, 0x00, 0x09, 0x00, 0x89, 0x00, 0x66, 0x00, 0x18, 0x00, 0x66, 0x00, 0x91, 0x00, 0x90, 0x00, 0x60, 0x00, 0x00, 0x00, // Code for char %
0x06, 0x60, 0x00, 0x96, 0x00, 0x89, 0x00, 0x99, 0x00, 0x66, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char &
0x01, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char '
0x03, 0xFC, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char (
0x03, 0x01, 0x02, 0x02, 0x01, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char )
0x05, 0x15, 0x00, 0x0E, 0x00, 0x1F, 0x00, 0x0E, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char *
0x05, 0x10, 0x00, 0x10, 0x00, 0x7C, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char +
0x02, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ,
0x03, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char -
0x03, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char . (extra space left and right)
0x03, 0xC0, 0x00, 0x3C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char /
0x05, 0x7E, 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 0
0x03, 0x04, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 1
0x05, 0x82, 0x00, 0xC1, 0x00, 0xA1, 0x00, 0x91, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 2
0x05, 0x42, 0x00, 0x81, 0x00, 0x89, 0x00, 0x89, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 3
0x06, 0x30, 0x00, 0x28, 0x00, 0x24, 0x00, 0x22, 0x00, 0xFF, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 4
0x05, 0x4F, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 5
0x05, 0x7E, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 6
0x05, 0x01, 0x00, 0xE1, 0x00, 0x19, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 7
0x05, 0x76, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 8
0x05, 0x4E, 0x00, 0x91, 0x00, 0x91, 0x00, 0x91, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 9
0x01, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char :
0x01, 0x84, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ;
0x05, 0x10, 0x00, 0x10, 0x00, 0x28, 0x00, 0x28, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char <
0x05, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char =
0x05, 0x44, 0x00, 0x28, 0x00, 0x28, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char >
0x05, 0x02, 0x00, 0x01, 0x00, 0xB1, 0x00, 0x09, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ?
0x0A, 0xF8, 0x00, 0x04, 0x01, 0x72, 0x02, 0x89, 0x02, 0x85, 0x02, 0x45, 0x02, 0xF9, 0x02, 0x8D, 0x02, 0x42, 0x02, 0x3C, 0x01, // Code for char @
0x07, 0xC0, 0x00, 0x30, 0x00, 0x2C, 0x00, 0x23, 0x00, 0x2C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char A
0x06, 0xFF, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char B
0x06, 0x3C, 0x00, 0x42, 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char C
0x06, 0xFF, 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char D
0x05, 0xFF, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char E
0x05, 0xFF, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char F
0x07, 0x3C, 0x00, 0x42, 0x00, 0x81, 0x00, 0x81, 0x00, 0x91, 0x00, 0x52, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char G
0x06, 0xFF, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char H
0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char I
0x04, 0x60, 0x00, 0x80, 0x00, 0x80, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char J
0x06, 0xFF, 0x00, 0x10, 0x00, 0x08, 0x00, 0x1C, 0x00, 0x62, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char K
0x05, 0xFF, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char L
0x07, 0xFF, 0x00, 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char M
0x06, 0xFF, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char N
0x07, 0x3C, 0x00, 0x42, 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char O
0x05, 0xFF, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char P
0x07, 0x3C, 0x00, 0x42, 0x00, 0x81, 0x00, 0xA1, 0x00, 0xA1, 0x00, 0x42, 0x00, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Q
0x06, 0xFF, 0x00, 0x09, 0x00, 0x09, 0x00, 0x19, 0x00, 0x69, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char R
0x06, 0x46, 0x00, 0x89, 0x00, 0x89, 0x00, 0x91, 0x00, 0x91, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char S
0x05, 0x01, 0x00, 0x01, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char T
0x06, 0x7F, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char U
0x07, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char V
0x0A, 0x03, 0x00, 0x3C, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x3C, 0x00, 0x03, 0x00, // Code for char W
0x06, 0x81, 0x00, 0x66, 0x00, 0x18, 0x00, 0x18, 0x00, 0x66, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char X
0x07, 0x01, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF0, 0x00, 0x08, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Y
0x06, 0x81, 0x00, 0xC1, 0x00, 0xB1, 0x00, 0x8D, 0x00, 0x83, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Z
0x02, 0xFF, 0x03, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char [
0x03, 0x03, 0x00, 0x3C, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char BackSlash
0x02, 0x01, 0x02, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ]
0x05, 0x08, 0x00, 0x06, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ^
0x06, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char _
0x02, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char `
0x05, 0x68, 0x00, 0x94, 0x00, 0x94, 0x00, 0x54, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char a
0x05, 0xFF, 0x00, 0x48, 0x00, 0x84, 0x00, 0x84, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char b
0x05, 0x78, 0x00, 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char c
0x05, 0x78, 0x00, 0x84, 0x00, 0x84, 0x00, 0x48, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char d
0x05, 0x78, 0x00, 0x94, 0x00, 0x94, 0x00, 0x94, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char e
0x03, 0x04, 0x00, 0xFE, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char f
0x05, 0x78, 0x02, 0x84, 0x02, 0x84, 0x02, 0x48, 0x02, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char g
0x05, 0xFF, 0x00, 0x08, 0x00, 0x04, 0x00, 0x04, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char h
0x01, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char i
0x02, 0x00, 0x02, 0xFD, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char j
0x04, 0xFF, 0x00, 0x10, 0x00, 0x68, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char k
0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char l
0x07, 0xFC, 0x00, 0x08, 0x00, 0x04, 0x00, 0xFC, 0x00, 0x04, 0x00, 0x04, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char m
0x05, 0xFC, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char n
0x05, 0x78, 0x00, 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char o
0x05, 0xFC, 0x03, 0x48, 0x00, 0x84, 0x00, 0x84, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char p
0x05, 0x78, 0x00, 0x84, 0x00, 0x84, 0x00, 0x48, 0x00, 0xFC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char q
0x03, 0xFC, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char r
0x05, 0x48, 0x00, 0x94, 0x00, 0x94, 0x00, 0xA4, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char s
0x02, 0xFF, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char t
0x05, 0x7C, 0x00, 0x80, 0x00, 0x80, 0x00, 0x40, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char u
0x05, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char v
0x09, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x00, // Code for char w
0x05, 0x84, 0x00, 0x48, 0x00, 0x30, 0x00, 0x48, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char x
0x05, 0x0C, 0x00, 0x30, 0x02, 0xC0, 0x01, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char y
0x05, 0x84, 0x00, 0xC4, 0x00, 0xB4, 0x00, 0x8C, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char z
0x03, 0x10, 0x00, 0xEE, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char {
0x01, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char |
0x04, 0x00, 0x00, 0x01, 0x02, 0xEE, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char }
0x05, 0x10, 0x00, 0x08, 0x00, 0x18, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ~
0x03, 0xFF, 0x00, 0x81, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Code for char 
};
extern const PROGMEM LcdFont font10x10_STM =
{
glcd10x10_STM, // font data
0x10, // first character code
0x7F, // last character code
10, // row height in pixels
10 // character width in pixels
};
// End

View File

@ -0,0 +1,119 @@
#include "lcd7920_STM.h"
//Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
//MikroElektronika 2011
//http://www.mikroe.com
//GLCD FontName : glcd16x16
//GLCD FontSize : 16 x 16
static const uint8_t glcd16x16_STM[] PROGMEM = {
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x03, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char !
0x05, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char "
0x09, 0x20, 0x02, 0x20, 0x1E, 0xF0, 0x03, 0x2E, 0x02, 0x20, 0x02, 0x20, 0x1E, 0xF0, 0x03, 0x2E, 0x02, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char #
0x08, 0x00, 0x00, 0x38, 0x04, 0x44, 0x08, 0x42, 0x10, 0xFF, 0x3F, 0x82, 0x10, 0x82, 0x08, 0x0C, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char $
0x0D, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x18, 0x3C, 0x06, 0x80, 0x01, 0x70, 0x00, 0x0C, 0x0F, 0x82, 0x10, 0x80, 0x10, 0x80, 0x10, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char %
0x0A, 0x00, 0x00, 0x00, 0x07, 0x9C, 0x08, 0x62, 0x10, 0xC2, 0x10, 0x22, 0x11, 0x1C, 0x0A, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char &
0x02, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char '
0x04, 0x00, 0x00, 0xE0, 0x0F, 0x1C, 0x70, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char (
0x04, 0x00, 0x00, 0x02, 0x80, 0x1C, 0x70, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char )
0x05, 0x04, 0x00, 0x34, 0x00, 0x0E, 0x00, 0x34, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char *
0x08, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xF0, 0x07, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char +
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ,
0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char -
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char .
0x04, 0x00, 0x18, 0x80, 0x07, 0x78, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char /
0x08, 0x00, 0x00, 0xF8, 0x07, 0x04, 0x08, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x04, 0x08, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 0
0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 1
0x08, 0x00, 0x00, 0x08, 0x10, 0x04, 0x18, 0x02, 0x14, 0x02, 0x12, 0x02, 0x11, 0xC6, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 2
0x08, 0x00, 0x00, 0x08, 0x0C, 0x04, 0x08, 0x42, 0x10, 0x42, 0x10, 0x62, 0x10, 0xBC, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 3
0x08, 0x00, 0x03, 0x80, 0x02, 0x40, 0x02, 0x30, 0x02, 0x08, 0x02, 0x04, 0x02, 0xFE, 0x1F, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 4
0x08, 0x00, 0x00, 0x70, 0x04, 0x2E, 0x08, 0x22, 0x10, 0x22, 0x10, 0x22, 0x10, 0x42, 0x08, 0x82, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 5
0x08, 0x00, 0x00, 0xF8, 0x07, 0x44, 0x08, 0x22, 0x10, 0x22, 0x10, 0x22, 0x10, 0x44, 0x08, 0x88, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 6
0x08, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x1C, 0xC2, 0x03, 0x32, 0x00, 0x0E, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 7
0x08, 0x00, 0x00, 0x18, 0x07, 0xA4, 0x08, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0xA4, 0x08, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 8
0x08, 0x00, 0x00, 0x78, 0x04, 0x84, 0x08, 0x02, 0x11, 0x02, 0x11, 0x02, 0x11, 0x84, 0x08, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 9
0x02, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char :
0x02, 0x00, 0x00, 0x10, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ;
0x08, 0x00, 0x00, 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char <
0x08, 0x00, 0x00, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char =
0x08, 0x00, 0x00, 0x10, 0x04, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x40, 0x01, 0x40, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char >
0x08, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x17, 0x82, 0x00, 0x44, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ?
0x10, 0x00, 0x00, 0xC0, 0x0F, 0x30, 0x10, 0x08, 0x20, 0x84, 0x47, 0x44, 0x48, 0x22, 0x90, 0x12, 0x90, 0x12, 0x90, 0x12, 0x88, 0x22, 0x9F, 0xF2, 0x90, 0x04, 0x90, 0x04, 0x48, 0x18, 0x44, 0xE0, 0x23, // Code for char @
0x0A, 0x00, 0x00, 0x00, 0x18, 0x00, 0x07, 0xE0, 0x01, 0x1C, 0x01, 0x02, 0x01, 0x1C, 0x01, 0xE0, 0x01, 0x00, 0x07, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char A
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0xA6, 0x08, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char B
0x0B, 0x00, 0x00, 0xF0, 0x03, 0x08, 0x04, 0x04, 0x08, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x04, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char C
0x0B, 0x00, 0x00, 0xFE, 0x1F, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x04, 0x08, 0x08, 0x04, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char D
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char E
0x09, 0x00, 0x00, 0xFE, 0x1F, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char F
0x0B, 0x00, 0x00, 0xF0, 0x03, 0x08, 0x04, 0x04, 0x08, 0x02, 0x10, 0x02, 0x10, 0x82, 0x10, 0x82, 0x10, 0x84, 0x08, 0x88, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char G
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char H
0x02, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char I
0x07, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0xFE, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char J
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x01, 0x80, 0x00, 0x40, 0x00, 0xE0, 0x00, 0x10, 0x01, 0x08, 0x06, 0x04, 0x08, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char K
0x08, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char L
0x0C, 0x00, 0x00, 0xFE, 0x1F, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x00, 0x07, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x30, 0x00, 0x0C, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char M
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x04, 0x00, 0x18, 0x00, 0x20, 0x00, 0xC0, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char N
0x0B, 0x00, 0x00, 0xF0, 0x03, 0x08, 0x04, 0x04, 0x08, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x04, 0x08, 0x08, 0x04, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char O
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x44, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char P
0x0B, 0x00, 0x00, 0xF0, 0x03, 0x08, 0x04, 0x04, 0x08, 0x02, 0x10, 0x02, 0x10, 0x02, 0x14, 0x02, 0x14, 0x04, 0x08, 0x08, 0x1C, 0xF0, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Q
0x0A, 0x00, 0x00, 0xFE, 0x1F, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x01, 0x82, 0x06, 0x44, 0x08, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char R
0x0A, 0x00, 0x00, 0x18, 0x04, 0x24, 0x08, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x82, 0x10, 0x82, 0x10, 0x84, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char S
0x09, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0xFE, 0x1F, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char T
0x0A, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x08, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char U
0x0A, 0x00, 0x00, 0x06, 0x00, 0x38, 0x00, 0xC0, 0x01, 0x00, 0x06, 0x00, 0x18, 0x00, 0x06, 0xC0, 0x01, 0x38, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char V
0x0F, 0x06, 0x00, 0x78, 0x00, 0x80, 0x07, 0x00, 0x18, 0x00, 0x07, 0xE0, 0x00, 0x1C, 0x00, 0x02, 0x00, 0x1C, 0x00, 0xE0, 0x00, 0x00, 0x07, 0x00, 0x18, 0x80, 0x07, 0x78, 0x00, 0x06, 0x00, 0x00, 0x00, // Code for char W
0x0B, 0x00, 0x10, 0x02, 0x08, 0x04, 0x04, 0x18, 0x03, 0xA0, 0x00, 0x40, 0x00, 0xA0, 0x00, 0x18, 0x03, 0x04, 0x04, 0x02, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char X
0x09, 0x02, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x60, 0x00, 0x80, 0x1F, 0x60, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Y
0x09, 0x00, 0x10, 0x02, 0x18, 0x02, 0x16, 0x02, 0x11, 0xC2, 0x10, 0x22, 0x10, 0x1A, 0x10, 0x06, 0x10, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Z
0x04, 0x00, 0x00, 0xFE, 0xFF, 0x02, 0x80, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char [
0x04, 0x06, 0x00, 0x78, 0x00, 0x80, 0x07, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char BackSlash
0x03, 0x02, 0x80, 0x02, 0x80, 0xFE, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ]
0x07, 0x40, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ^
0x09, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char _
0x03, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char `
0x08, 0x00, 0x00, 0x40, 0x0E, 0x20, 0x11, 0x10, 0x11, 0x10, 0x11, 0x90, 0x10, 0x90, 0x08, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char a
0x08, 0x00, 0x00, 0xFE, 0x1F, 0x20, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x08, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char b
0x07, 0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char c
0x08, 0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x08, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char d
0x08, 0x00, 0x00, 0xC0, 0x07, 0x20, 0x09, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x20, 0x09, 0xC0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char e
0x04, 0x10, 0x00, 0xFC, 0x1F, 0x12, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char f
0x08, 0x00, 0x00, 0xC0, 0x47, 0x20, 0x88, 0x10, 0x90, 0x10, 0x90, 0x10, 0x90, 0x20, 0x48, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char g
0x07, 0x00, 0x00, 0xFE, 0x1F, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char h
0x02, 0x00, 0x00, 0xF2, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char i
0x02, 0x00, 0x80, 0xF2, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char j
0x08, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x02, 0x00, 0x01, 0x80, 0x01, 0x40, 0x06, 0x20, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char k
0x02, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char l
0x0C, 0x00, 0x00, 0xF0, 0x1F, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xE0, 0x1F, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char m
0x07, 0x00, 0x00, 0xF0, 0x1F, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char n
0x08, 0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x08, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char o
0x08, 0x00, 0x00, 0xF0, 0xFF, 0x20, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x08, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char p
0x08, 0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x08, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char q
0x05, 0x00, 0x00, 0xF0, 0x1F, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char r
0x07, 0x00, 0x00, 0xE0, 0x08, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x20, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char s
0x04, 0x10, 0x00, 0xFC, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char t
0x07, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x08, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char u
0x07, 0x30, 0x00, 0xC0, 0x00, 0x00, 0x07, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char v
0x0B, 0x30, 0x00, 0xC0, 0x07, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x00, 0x07, 0x00, 0x18, 0xC0, 0x07, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char w
0x07, 0x10, 0x10, 0x20, 0x08, 0xC0, 0x06, 0x00, 0x01, 0xC0, 0x06, 0x20, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char x
0x07, 0x70, 0x00, 0x80, 0x81, 0x00, 0x8E, 0x00, 0x70, 0x00, 0x0E, 0xC0, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char y
0x07, 0x10, 0x10, 0x10, 0x18, 0x10, 0x16, 0x10, 0x11, 0xD0, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char z
0x05, 0x00, 0x01, 0x00, 0x01, 0xFC, 0x7E, 0x02, 0x80, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char {
0x02, 0x00, 0x00, 0xFE, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char |
0x05, 0x02, 0x80, 0x02, 0x80, 0xFC, 0x7E, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char }
0x08, 0x80, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ~
0x04, 0xFE, 0x0F, 0x02, 0x08, 0x02, 0x08, 0xFE, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Code for char 
};
extern const PROGMEM LcdFont font16x16_STM =
{
glcd16x16_STM, // font data
0x20, // first character code
0x7F, // last character code
16, // row height in pixels
16 // character width in pixels
};
// End

View File

@ -0,0 +1,112 @@
#include "lcd7920_STM.h"
// Standard ASCII 6x8 font
PROGMEM const uint8_t glcd5x5_STM[] PROGMEM = {
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x01, 0x17, 0x00, 0x00, 0x00, 0x00, // Code for char !
0x02, 0x03, 0x03, 0x00, 0x00, 0x00, // Code for char "
0x04, 0x0A, 0x1F, 0x1F, 0x0A, 0x00, // Code for char #
0x03, 0x16, 0x1F, 0x1A, 0x00, 0x00, // Code for char $
0x04, 0x12, 0x08, 0x04, 0x12, 0x00, // Code for char %
0x04, 0x0A, 0x15, 0x0A, 0x14, 0x00, // Code for char &
0x01, 0x03, 0x00, 0x00, 0x00, 0x00, // Code for char '
0x02, 0x1E, 0x01, 0x00, 0x00, 0x00, // Code for char (
0x02, 0x01, 0x1E, 0x00, 0x00, 0x00, // Code for char )
0x02, 0x03, 0x03, 0x00, 0x00, 0x00, // Code for char *
0x03, 0x04, 0x0E, 0x04, 0x00, 0x00, // Code for char +
0x01, 0x10, 0x00, 0x00, 0x00, 0x00, // Code for char ,
0x02, 0x04, 0x04, 0x00, 0x00, 0x00, // Code for char -
0x01, 0x10, 0x00, 0x00, 0x00, 0x00, // Code for char .
0x02, 0x1C, 0x07, 0x00, 0x00, 0x00, // Code for char /
0x03, 0x0E, 0x11, 0x0E, 0x00, 0x00, // Code for char 0
0x02, 0x02, 0x1F, 0x00, 0x00, 0x00, // Code for char 1
0x03, 0x19, 0x15, 0x12, 0x00, 0x00, // Code for char 2
0x03, 0x11, 0x15, 0x0A, 0x00, 0x00, // Code for char 3
0x03, 0x0C, 0x0A, 0x1F, 0x00, 0x00, // Code for char 4
0x03, 0x17, 0x15, 0x0D, 0x00, 0x00, // Code for char 5
0x03, 0x0E, 0x15, 0x08, 0x00, 0x00, // Code for char 6
0x03, 0x01, 0x1D, 0x03, 0x00, 0x00, // Code for char 7
0x03, 0x0A, 0x15, 0x0A, 0x00, 0x00, // Code for char 8
0x03, 0x06, 0x15, 0x0E, 0x00, 0x00, // Code for char 9
0x01, 0x14, 0x00, 0x00, 0x00, 0x00, // Code for char :
0x01, 0x14, 0x00, 0x00, 0x00, 0x00, // Code for char ;
0x02, 0x08, 0x14, 0x00, 0x00, 0x00, // Code for char <
0x02, 0x08, 0x08, 0x00, 0x00, 0x00, // Code for char =
0x02, 0x14, 0x08, 0x00, 0x00, 0x00, // Code for char >
0x02, 0x15, 0x02, 0x00, 0x00, 0x00, // Code for char ?
0x05, 0x0C, 0x12, 0x0D, 0x0D, 0x0A, // Code for char @
0x04, 0x1C, 0x0B, 0x0B, 0x1C, 0x00, // Code for char A
0x04, 0x1F, 0x15, 0x15, 0x0A, 0x00, // Code for char B
0x04, 0x0E, 0x11, 0x11, 0x0A, 0x00, // Code for char C
0x04, 0x1F, 0x11, 0x11, 0x0E, 0x00, // Code for char D
0x03, 0x1F, 0x15, 0x11, 0x00, 0x00, // Code for char E
0x03, 0x1F, 0x05, 0x01, 0x00, 0x00, // Code for char F
0x04, 0x0E, 0x11, 0x15, 0x1D, 0x00, // Code for char G
0x04, 0x1F, 0x04, 0x04, 0x1F, 0x00, // Code for char H
0x01, 0x1F, 0x00, 0x00, 0x00, 0x00, // Code for char I
0x03, 0x18, 0x10, 0x0F, 0x00, 0x00, // Code for char J
0x04, 0x1F, 0x04, 0x0A, 0x11, 0x00, // Code for char K
0x03, 0x1F, 0x10, 0x10, 0x00, 0x00, // Code for char L
0x05, 0x1F, 0x02, 0x04, 0x02, 0x1F, // Code for char M
0x04, 0x1F, 0x02, 0x04, 0x1F, 0x00, // Code for char N
0x04, 0x0E, 0x11, 0x11, 0x0E, 0x00, // Code for char O
0x04, 0x1F, 0x05, 0x05, 0x02, 0x00, // Code for char P
0x04, 0x0E, 0x11, 0x09, 0x16, 0x00, // Code for char Q
0x04, 0x1F, 0x05, 0x05, 0x1A, 0x00, // Code for char R
0x04, 0x12, 0x15, 0x15, 0x09, 0x00, // Code for char S
0x03, 0x01, 0x1F, 0x01, 0x00, 0x00, // Code for char T
0x04, 0x0F, 0x10, 0x10, 0x0F, 0x00, // Code for char U
0x03, 0x07, 0x18, 0x07, 0x00, 0x00, // Code for char V
0x05, 0x07, 0x18, 0x06, 0x18, 0x07, // Code for char W
0x03, 0x1B, 0x04, 0x1B, 0x00, 0x00, // Code for char X
0x03, 0x03, 0x1C, 0x03, 0x00, 0x00, // Code for char Y
0x03, 0x19, 0x15, 0x13, 0x00, 0x00, // Code for char Z
0x02, 0x1F, 0x01, 0x00, 0x00, 0x00, // Code for char [
0x02, 0x07, 0x1C, 0x00, 0x00, 0x00, // Code for char BackSlash
0x02, 0x01, 0x1F, 0x00, 0x00, 0x00, // Code for char ]
0x03, 0x02, 0x01, 0x02, 0x00, 0x00, // Code for char ^
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char _
0x02, 0x01, 0x02, 0x00, 0x00, 0x00, // Code for char `
0x03, 0x08, 0x14, 0x1C, 0x00, 0x00, // Code for char a
0x03, 0x1F, 0x14, 0x08, 0x00, 0x00, // Code for char b
0x03, 0x08, 0x14, 0x14, 0x00, 0x00, // Code for char c
0x03, 0x08, 0x14, 0x1F, 0x00, 0x00, // Code for char d
0x03, 0x18, 0x14, 0x08, 0x00, 0x00, // Code for char e
0x02, 0x1E, 0x05, 0x00, 0x00, 0x00, // Code for char f
0x03, 0x08, 0x14, 0x1C, 0x00, 0x00, // Code for char g
0x03, 0x1F, 0x04, 0x18, 0x00, 0x00, // Code for char h
0x01, 0x1D, 0x00, 0x00, 0x00, 0x00, // Code for char i
0x01, 0x1D, 0x00, 0x00, 0x00, 0x00, // Code for char j
0x03, 0x1F, 0x08, 0x14, 0x00, 0x00, // Code for char k
0x01, 0x1F, 0x00, 0x00, 0x00, 0x00, // Code for char l
0x05, 0x1C, 0x04, 0x1C, 0x04, 0x18, // Code for char m
0x03, 0x1C, 0x04, 0x18, 0x00, 0x00, // Code for char n
0x03, 0x1C, 0x14, 0x1C, 0x00, 0x00, // Code for char o
0x03, 0x1C, 0x14, 0x08, 0x00, 0x00, // Code for char p
0x03, 0x08, 0x14, 0x1C, 0x00, 0x00, // Code for char q
0x02, 0x1C, 0x04, 0x00, 0x00, 0x00, // Code for char r
0x02, 0x1C, 0x04, 0x00, 0x00, 0x00, // Code for char s
0x02, 0x0E, 0x14, 0x00, 0x00, 0x00, // Code for char t
0x03, 0x0C, 0x10, 0x1C, 0x00, 0x00, // Code for char u
0x03, 0x0C, 0x10, 0x0C, 0x00, 0x00, // Code for char v
0x04, 0x1C, 0x10, 0x10, 0x1C, 0x00, // Code for char w
0x03, 0x14, 0x08, 0x14, 0x00, 0x00, // Code for char x
0x03, 0x04, 0x18, 0x04, 0x00, 0x00, // Code for char y
0x03, 0x14, 0x1C, 0x14, 0x00, 0x00, // Code for char z
0x02, 0x0C, 0x13, 0x00, 0x00, 0x00, // Code for char {
0x01, 0x1F, 0x00, 0x00, 0x00, 0x00, // Code for char |
0x02, 0x13, 0x0C, 0x00, 0x00, 0x00, // Code for char }
0x03, 0x02, 0x03, 0x01, 0x00, 0x00, // Code for char ~
0x01, 0x1F, 0x00, 0x00, 0x00, 0x00 // Code for char 
};
extern const PROGMEM LcdFont font5x5_STM =
{
glcd5x5_STM, // font data
0x20, // first character code
0x7F, // last character code
5, // row height in pixels
5 // character width in pixels
};

View File

@ -0,0 +1,112 @@
#include "lcd7920_STM.h"
// Standard ASCII 6x8 font
PROGMEM const uint8_t glcd5x7_STM[] PROGMEM = {
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x04, 0x00, 0x06, 0x5F, 0x06, 0x00, // Code for char !
0x05, 0x07, 0x03, 0x00, 0x07, 0x03, // Code for char "
0x05, 0x24, 0x7E, 0x24, 0x7E, 0x24, // Code for char #
0x04, 0x24, 0x2B, 0x6A, 0x12, 0x00, // Code for char $
0x05, 0x63, 0x13, 0x08, 0x64, 0x63, // Code for char %
0x05, 0x36, 0x49, 0x56, 0x20, 0x50, // Code for char &
0x03, 0x00, 0x07, 0x03, 0x00, 0x00, // Code for char '
0x03, 0x00, 0x3E, 0x41, 0x00, 0x00, // Code for char (
0x03, 0x00, 0x41, 0x3E, 0x00, 0x00, // Code for char )
0x05, 0x08, 0x3E, 0x1C, 0x3E, 0x08, // Code for char *
0x05, 0x08, 0x08, 0x3E, 0x08, 0x08, // Code for char +
0x03, 0x00, 0x60, 0x60, 0x00, 0x00, // Code for char ,
0x05, 0x08, 0x08, 0x08, 0x08, 0x08, // Code for char -
0x03, 0x00, 0x60, 0x60, 0x00, 0x00, // Code for char .
0x05, 0x20, 0x10, 0x08, 0x04, 0x02, // Code for char /
0x05, 0x3E, 0x51, 0x49, 0x45, 0x3E, // Code for char 0
0x04, 0x00, 0x42, 0x7F, 0x40, 0x00, // Code for char 1
0x05, 0x62, 0x51, 0x49, 0x49, 0x46, // Code for char 2
0x05, 0x22, 0x49, 0x49, 0x49, 0x36, // Code for char 3
0x05, 0x18, 0x14, 0x12, 0x7F, 0x10, // Code for char 4
0x05, 0x2F, 0x49, 0x49, 0x49, 0x31, // Code for char 5
0x05, 0x3C, 0x4A, 0x49, 0x49, 0x30, // Code for char 6
0x05, 0x01, 0x71, 0x09, 0x05, 0x03, // Code for char 7
0x05, 0x36, 0x49, 0x49, 0x49, 0x36, // Code for char 8
0x05, 0x06, 0x49, 0x49, 0x29, 0x1E, // Code for char 9
0x03, 0x00, 0x6C, 0x6C, 0x00, 0x00, // Code for char :
0x03, 0x00, 0x6C, 0x6C, 0x00, 0x00, // Code for char ;
0x04, 0x08, 0x14, 0x22, 0x41, 0x00, // Code for char <
0x05, 0x24, 0x24, 0x24, 0x24, 0x24, // Code for char =
0x05, 0x00, 0x41, 0x22, 0x14, 0x08, // Code for char >
0x05, 0x02, 0x01, 0x59, 0x09, 0x06, // Code for char ?
0x05, 0x3E, 0x41, 0x5D, 0x55, 0x1E, // Code for char @
0x05, 0x7E, 0x11, 0x11, 0x11, 0x7E, // Code for char A
0x05, 0x7F, 0x49, 0x49, 0x49, 0x36, // Code for char B
0x05, 0x3E, 0x41, 0x41, 0x41, 0x22, // Code for char C
0x05, 0x7F, 0x41, 0x41, 0x41, 0x3E, // Code for char D
0x05, 0x7F, 0x49, 0x49, 0x49, 0x41, // Code for char E
0x05, 0x7F, 0x09, 0x09, 0x09, 0x01, // Code for char F
0x05, 0x3E, 0x41, 0x49, 0x49, 0x7A, // Code for char G
0x05, 0x7F, 0x08, 0x08, 0x08, 0x7F, // Code for char H
0x04, 0x00, 0x41, 0x7F, 0x41, 0x00, // Code for char I
0x05, 0x30, 0x40, 0x40, 0x40, 0x3F, // Code for char J
0x05, 0x7F, 0x08, 0x14, 0x22, 0x41, // Code for char K
0x05, 0x7F, 0x40, 0x40, 0x40, 0x40, // Code for char L
0x05, 0x7F, 0x02, 0x04, 0x02, 0x7F, // Code for char M
0x05, 0x7F, 0x02, 0x04, 0x08, 0x7F, // Code for char N
0x05, 0x3E, 0x41, 0x41, 0x41, 0x3E, // Code for char O
0x05, 0x7F, 0x09, 0x09, 0x09, 0x06, // Code for char P
0x05, 0x3E, 0x41, 0x51, 0x21, 0x5E, // Code for char Q
0x05, 0x7F, 0x09, 0x09, 0x19, 0x66, // Code for char R
0x05, 0x26, 0x49, 0x49, 0x49, 0x32, // Code for char S
0x05, 0x01, 0x01, 0x7F, 0x01, 0x01, // Code for char T
0x05, 0x3F, 0x40, 0x40, 0x40, 0x3F, // Code for char U
0x05, 0x1F, 0x20, 0x40, 0x20, 0x1F, // Code for char V
0x05, 0x3F, 0x40, 0x3C, 0x40, 0x3F, // Code for char W
0x05, 0x63, 0x14, 0x08, 0x14, 0x63, // Code for char X
0x05, 0x07, 0x08, 0x70, 0x08, 0x07, // Code for char Y
0x04, 0x71, 0x49, 0x45, 0x43, 0x00, // Code for char Z
0x04, 0x00, 0x7F, 0x41, 0x41, 0x00, // Code for char [
0x05, 0x02, 0x04, 0x08, 0x10, 0x20, // Code for char BackSlash
0x04, 0x00, 0x41, 0x41, 0x7F, 0x00, // Code for char ]
0x05, 0x04, 0x02, 0x01, 0x02, 0x04, // Code for char ^
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char _
0x03, 0x00, 0x03, 0x07, 0x00, 0x00, // Code for char `
0x05, 0x20, 0x54, 0x54, 0x54, 0x78, // Code for char a
0x05, 0x7F, 0x44, 0x44, 0x44, 0x38, // Code for char b
0x05, 0x38, 0x44, 0x44, 0x44, 0x28, // Code for char c
0x05, 0x38, 0x44, 0x44, 0x44, 0x7F, // Code for char d
0x05, 0x38, 0x54, 0x54, 0x54, 0x08, // Code for char e
0x04, 0x08, 0x7E, 0x09, 0x09, 0x00, // Code for char f
0x05, 0x18, 0x24, 0x24, 0x24, 0x7C, // Code for char g
0x04, 0x7F, 0x04, 0x04, 0x78, 0x00, // Code for char h
0x04, 0x00, 0x00, 0x7D, 0x40, 0x00, // Code for char i
0x04, 0x40, 0x00, 0x04, 0x7D, 0x00, // Code for char j
0x04, 0x7F, 0x10, 0x28, 0x44, 0x00, // Code for char k
0x04, 0x00, 0x00, 0x7F, 0x40, 0x00, // Code for char l
0x05, 0x7C, 0x04, 0x18, 0x04, 0x78, // Code for char m
0x04, 0x7C, 0x04, 0x04, 0x78, 0x00, // Code for char n
0x05, 0x38, 0x44, 0x44, 0x44, 0x38, // Code for char o
0x05, 0x7C, 0x44, 0x44, 0x44, 0x38, // Code for char p
0x05, 0x38, 0x44, 0x44, 0x44, 0x7C, // Code for char q
0x05, 0x44, 0x78, 0x44, 0x04, 0x08, // Code for char r
0x05, 0x08, 0x54, 0x54, 0x54, 0x20, // Code for char s
0x04, 0x04, 0x3E, 0x44, 0x24, 0x00, // Code for char t
0x04, 0x3C, 0x40, 0x20, 0x7C, 0x00, // Code for char u
0x05, 0x1C, 0x20, 0x40, 0x20, 0x1C, // Code for char v
0x05, 0x3C, 0x60, 0x30, 0x60, 0x3C, // Code for char w
0x04, 0x6C, 0x10, 0x10, 0x6C, 0x00, // Code for char x
0x04, 0x1C, 0x20, 0x60, 0x3C, 0x00, // Code for char y
0x04, 0x64, 0x54, 0x54, 0x4C, 0x00, // Code for char z
0x04, 0x08, 0x3E, 0x41, 0x41, 0x00, // Code for char {
0x03, 0x00, 0x00, 0x77, 0x00, 0x00, // Code for char |
0x05, 0x00, 0x41, 0x41, 0x3E, 0x08, // Code for char }
0x04, 0x02, 0x01, 0x02, 0x01, 0x00, // Code for char ~
0x05, 0x3C, 0x26, 0x23, 0x26, 0x3C // Code for char 
};
extern const PROGMEM LcdFont font5x7_STM =
{
glcd5x7_STM, // font data
0x20, // first character code
0x7F, // last character code
7, // row height in pixels
5 // character width in pixels
};

View File

@ -0,0 +1,565 @@
// Driver for 128x634 graphical LCD with ST7920 controller
// D Crocker, Escher Technologies Ltd.
// adapted for STM32-Arduino by Matthias Diro
#include "lcd7920_STM.h"
#include <pins_arduino.h>
#include <avr/interrupt.h>
// LCD basic instructions. These all take 72us to execute except LcdDisplayClear, which takes 1.6ms
const uint8_t LcdDisplayClear = 0x01;
const uint8_t LcdHome = 0x02;
const uint8_t LcdEntryModeSet = 0x06; // move cursor right and indcement address when writing data
const uint8_t LcdDisplayOff = 0x08;
const uint8_t LcdDisplayOn = 0x0C; // add 0x02 for cursor on and/or 0x01 for cursor blink on
const uint8_t LcdFunctionSetBasicAlpha = 0x20;
const uint8_t LcdFunctionSetBasicGraphic = 0x22;
const uint8_t LcdFunctionSetExtendedAlpha = 0x24;
const uint8_t LcdFunctionSetExtendedGraphic = 0x26;
const uint8_t LcdSetDdramAddress = 0x80; // add the address we want to set
// LCD extended instructions
const uint8_t LcdSetGdramAddress = 0x80;
//const unsigned int LcdCommandDelayMicros = 72 - 24; // 72us required, less 24us time to send the command @ 1MHz
const unsigned int LcdCommandDelayMicros = 2;
const unsigned int LcdDataDelayMicros = 2;// 10; // Delay between sending data bytes
const unsigned int LcdDisplayClearDelayMillis = 2; // 1.6ms should be enough
const unsigned int numRows = 64;
const unsigned int numCols = 128;
Lcd7920::Lcd7920(uint8_t cPin, uint8_t dPin, bool spi) : clockPin(cPin), dataPin(dPin), useSpi(spi), currentFont(0), textInverted(false)
{
}
size_t Lcd7920::write(uint8_t ch)
{
if (gfxMode)
{
if (currentFont == 0)
{
return 0;
}
const uint8_t startChar = pgm_read_byte_near(&(currentFont->startCharacter));
const uint8_t endChar = pgm_read_byte_near(&(currentFont->endCharacter));
if (ch < startChar || ch > endChar)
{
return 0;
}
const uint8_t fontWidth = pgm_read_byte_near(&(currentFont->width));
const uint8_t fontHeight = pgm_read_byte_near(&(currentFont->height));
const uint8_t bytesPerColumn = (fontHeight + 7)/8;
const uint8_t bytesPerChar = (bytesPerColumn * fontWidth) + 1;
PROGMEM const uint8_t *fontPtr = (PROGMEM const uint8_t*)pgm_read_word_near(&(currentFont->ptr)) + (bytesPerChar * (ch - startChar));
uint16_t cmask = (1 << fontHeight) - 1;
uint8_t nCols = pgm_read_byte_near(fontPtr++);
// Update dirty rectangle coordinates, except for endCol which we do at the end
{
if (startRow > row) { startRow = row; }
if (startCol > column) { startCol = column; }
uint8_t nextRow = row + fontHeight;
if (nextRow > numRows) { nextRow = numRows; }
if (endRow < nextRow) { endRow = nextRow; }
}
// Decide whether to add a space column first (auto-kerning)
// We don't add a space column before a space character.
// We add a space column after a space character if we would have added one between the preceding and following characters.
if (column != numCols)
{
uint16_t thisCharColData = pgm_read_word_near(fontPtr) & cmask; // atmega328p is little-endian
if (thisCharColData == 0) // for characters with deliberate space row at the start, e.g. decimal point
{
thisCharColData = pgm_read_word_near(fontPtr + 2) & cmask;
}
bool wantSpace = ((thisCharColData | (thisCharColData << 1)) & (lastCharColData | (lastCharColData << 1))) != 0;
if (wantSpace)
{
// Add space after character
uint8_t mask = 0x80 >> (column & 7);
uint8_t *p = image + ((row * (numCols/8)) + (column/8));
for (uint8_t i = 0; i < fontHeight && p < (image + sizeof(image)); ++i)
{
if (textInverted)
{
*p |= mask;
}
else
{
*p &= ~mask;
}
p += (numCols/8);
}
++column;
}
}
while (nCols != 0 && column < numCols)
{
uint16_t colData = pgm_read_word_near(fontPtr);
fontPtr += bytesPerColumn;
if (colData != 0)
{
lastCharColData = colData & cmask;
}
uint8_t mask1 = 0x80 >> (column & 7);
uint8_t mask2 = ~mask1;
uint8_t *p = image + ((row * (numCols/8)) + (column/8));
const uint16_t setPixelVal = (textInverted) ? 0 : 1;
for (uint8_t i = 0; i < fontHeight && p < (image + sizeof(image)); ++i)
{
if ((colData & 1) == setPixelVal)
{
*p |= mask1; // set pixel
}
else
{
*p &= mask2; // clear pixel
}
colData >>= 1;
p += (numCols/8);
}
--nCols;
++column;
}
if (column > endCol) { endCol = column; }
}
else
{
// Alphanumeric mode
if (ch == '\r')
{
setCursor(0, column);
}
else if (ch == '\n')
{
setCursor(0, row + 1);
}
else
{
if (column == 16)
{
setCursor(row + 1, 0);
}
sendLcdData(ch);
++column;
commandDelay(); // so that we are ready to write another character immediately
}
}
return 1;
}
// Select normal or inverted text (only works in graphics mode)
void Lcd7920::textInvert(bool b)
{
if (b != textInverted)
{
textInverted = b;
lastCharColData = 0xFFFF; // always need space between inverted and non-inverted text
}
}
// NB - if using SPI then the SS pin must be set to be an output before calling this!
void Lcd7920::begin(bool gmode)
{
// Set up the SPI interface for talking to the LCD. We have to set MOSI, SCLK and SS to outputs, then enable SPI.
digitalWrite(clockPin, LOW);
digitalWrite(dataPin, LOW);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
if (useSpi)
{
delay(1); //dummy
// SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR0); // enable SPI, master mode, clock low when idle, data sampled on rising edge, clock = f/16 (= 1MHz), send MSB first
//SPSR = (1 << SPI2X); // double the speed to 2MHz (optional)
}
gfxMode = false;
sendLcdCommand(LcdFunctionSetBasicAlpha);
delay(1);
sendLcdCommand(LcdFunctionSetBasicAlpha);
commandDelay();
sendLcdCommand(LcdEntryModeSet);
commandDelay();
extendedMode = false;
clear(); // clear alpha ram
if (gmode)
{
gfxMode = true;
clear(); // clear gfx ram
}
setCursor(0, 0);
sendLcdCommand(LcdDisplayOn);
commandDelay();
currentFont = 0;
textInverted = false;
}
void Lcd7920::setFont(const PROGMEM LcdFont *newFont)
{
currentFont = newFont;
}
void Lcd7920::clear()
{
if (gfxMode)
{
memset(image, 0, sizeof(image));
// flag whole image as dirty and update
startRow = 0;
endRow = numRows;
startCol = 0;
endCol = numCols;
flush();
}
else
{
ensureBasicMode();
sendLcdCommand(LcdDisplayClear);
delay(LcdDisplayClearDelayMillis);
}
setCursor(0, 0);
textInverted = false;
}
// Draw a line using the Bresenham Algorithm (thanks Wikipedia)
void Lcd7920::line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, PixelMode mode)
{
int dx = (x1 >= x0) ? x1 - x0 : x0 - x1;
int dy = (y1 >= y0) ? y1 - y0 : y0 - y1;
int sx = (x0 < x1) ? 1 : -1;
int sy = (y0 < y1) ? 1 : -1;
int err = dx - dy;
for (;;)
{
setPixel(x0, y0, mode);
if (x0 == x1 && y0 == y1) break;
int e2 = err + err;
if (e2 > -dy)
{
err -= dy;
x0 += sx;
}
if (e2 < dx)
{
err += dx;
y0 += sy;
}
}
}
void Lcd7920::fastHline(uint8_t x0, uint8_t y0, uint8_t x1, PixelMode mode)
{
for (byte xx=0;xx< x1;xx++)
{
setPixel(x0+xx, y0, mode);
}
}
void Lcd7920::fastVline(uint8_t x0, uint8_t y0, uint8_t y1, PixelMode mode)
{
for (byte yy=0;yy< y1;yy++)
{
setPixel(x0, y0+yy, mode);
}
}
// draw simple box - x0,y0=start, x1,y1-length in pixel
void Lcd7920::box(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, PixelMode mode)
{
//line( x0, y0, x0+x1, y0, mode);
fastHline(x0,y0,x1, mode);
fastHline(x0,y0+y1,x1, mode);
// line( x0, y0+y1, x0+x1, y0+y1, mode);
//line( x0, y0+1, x0, y0+y1-1, mode);
fastVline(x0,y0+1,y1-1, mode);
fastVline(x0+x1-1,y0+1,y1-1, mode);
//line( x0+x1, y0+1, x0+x1, y0+y1-1, mode);
//line( x0, y0, x0+x1, y0+y1, mode);
}
//draw full box
void Lcd7920::fillbox(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, PixelMode mode)
{
for (byte x=0;x<y1;x++)
{
//line( x0, y0+x, x0+x1, y0+x, mode);
fastHline(x0,y0+x,x1, mode);
}
}
// Draw a circle using the Bresenham Algorithm (thanks Wikipedia)
void Lcd7920::circle(uint8_t x0, uint8_t y0, uint8_t radius, PixelMode mode)
{
int f = 1 - (int)radius;
int ddF_x = 1;
int ddF_y = -2 * (int)radius;
int x = 0;
int y = radius;
setPixel(x0, y0 + radius, mode);
setPixel(x0, y0 - radius, mode);
setPixel(x0 + radius, y0, mode);
setPixel(x0 - radius, y0, mode);
while(x < y)
{
// keep ddF_x == 2 * x + 1;
// keep ddF_y == -2 * y;
// keep f == x*x + y*y - radius*radius + 2*x - y + 1;
if(f >= 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x;
setPixel(x0 + x, y0 + y, mode);
setPixel(x0 - x, y0 + y, mode);
setPixel(x0 + x, y0 - y, mode);
setPixel(x0 - x, y0 - y, mode);
setPixel(x0 + y, y0 + x, mode);
setPixel(x0 - y, y0 + x, mode);
setPixel(x0 + y, y0 - x, mode);
setPixel(x0 - y, y0 - x, mode);
}
}
// Draw a bitmap
void Lcd7920::bitmap(uint8_t x0, uint8_t y0, uint8_t width, uint8_t height, PROGMEM const uint8_t data[])
{
for (uint8_t r = 0; r < height && r + y0 < numRows; ++r)
{
uint8_t *p = image + (((r + y0) * (numCols/8)) + (x0/8));
uint16_t bitMapOffset = r * (width/8);
for (uint8_t c = 0; c < (width/8) && c + (x0/8) < numCols/8; ++c)
{
*p++ = pgm_read_byte_near(bitMapOffset++);
}
}
if (x0 < startCol) startCol = x0;
if (x0 + width > endCol) endCol = x0 + width;
if (y0 < startRow) startRow = y0;
if (y0 + height > endRow) endRow = y0 + height;
}
// Flush the dirty part of the image to the lcd
void Lcd7920::flush()
{
if (gfxMode && endCol > startCol && endRow > startRow)
{
uint8_t startColNum = startCol/16;
uint8_t endColNum = (endCol + 15)/16;
for (uint8_t r = startRow; r < endRow; ++r)
{
setGraphicsAddress(r, startColNum);
uint8_t *ptr = image + ((16 * r) + (2 * startColNum));
for (uint8_t i = startColNum; i < endColNum; ++i)
{
sendLcdData(*ptr++);
//commandDelay(); // don't seem to need a delay here
sendLcdData(*ptr++);
//commandDelay(); // don't seem to need as long a delay as this
delayMicroseconds(LcdDataDelayMicros);
}
}
startRow = numRows;
startCol = numCols;
endCol = endRow = 0;
}
}
// Set the cursor position. We can only set alternate columns. The row addressing is rather odd.
void Lcd7920::setCursor(uint8_t r, uint8_t c)
{
if (gfxMode)
{
row = r % numRows;
column = c % numCols;
lastCharColData = 0u; // flag that we just set the cursor position, so no space before next character
}
else
{
row = r % 4;
column = c % 16;
ensureBasicMode();
sendLcdCommand(LcdSetDdramAddress + ((row & 1) * 0x10) + (column/2) + (row >> 1) * 8);
commandDelay();
}
}
void Lcd7920::setPixel(uint8_t x, uint8_t y, PixelMode mode)
{
if (y < numRows && x < numCols)
{
uint8_t *p = image + ((y * (numCols/8)) + (x/8));
uint8_t mask = 0x80u >> (x%8);
switch(mode)
{
case PixelClear:
*p &= ~mask;
break;
case PixelSet:
*p |= mask;
break;
case PixelFlip:
*p ^= mask;
break;
}
// Change the dirty rectangle to account for a pixel being dirty (we assume it was changed)
if (startRow > y) { startRow = y; }
if (endRow <= y) { endRow = y + 1; }
if (startCol > x) { startCol = x; }
if (endCol <= x) { endCol = x + 1; }
}
}
bool Lcd7920::readPixel(uint8_t x, uint8_t y)
{
if (y < numRows && x < numCols)
{
uint8_t *p = image + ((y * (numCols/8)) + (x/8));
return (*p & (0x80u >> (x%8))) != 0;
}
return false;
}
void Lcd7920::setGraphicsAddress(unsigned int r, unsigned int c)
{
if (gfxMode)
{
ensureExtendedMode();
sendLcdCommand(LcdSetGdramAddress | (r & 31));
//commandDelay(); // don't seem to need this one
sendLcdCommand(LcdSetGdramAddress | c | ((r & 32) >> 2));
commandDelay(); // we definitely need this one
}
}
void Lcd7920::commandDelay()
{
delayMicroseconds(LcdCommandDelayMicros);
}
// Send a command to the LCD
void Lcd7920::sendLcdCommand(uint8_t command)
{
sendLcd(0xF8, command);
}
// Send a data byte to the LCD
void Lcd7920::sendLcdData(uint8_t data)
{
sendLcd(0xFA, data);
}
// Send a command to the lcd. Data1 is sent as-is, data2 is split into 2 bytes, high nibble first.
void Lcd7920::sendLcd(uint8_t data1, uint8_t data2)
{
if (useSpi)
{
delay(1); // dummy
/*
SPDR = data1;
while ((SPSR & (1 << SPIF)) == 0) { }
SPDR = data2 & 0xF0;
while ((SPSR & (1 << SPIF)) == 0) { }
SPDR = data2 << 4;
while ((SPSR & (1 << SPIF)) == 0) { }
*/
}
else
{
sendLcdSlow(data1);
sendLcdSlow(data2 & 0xF0);
sendLcdSlow(data2 << 4);
}
}
void Lcd7920::sendLcdSlow(uint8_t data)
{
/*
#if 1
// Fast shiftOut function
volatile uint32_t *sclkPort = portOutputRegister(digitalPinToPort(clockPin));
volatile uint32_t *mosiPort = portOutputRegister(digitalPinToPort(dataPin));
uint8_t sclkMask = digitalPinToBitMask(clockPin);
uint8_t mosiMask = digitalPinToBitMask(dataPin);
uint8_t oldSREG = SREG;
cli();
for (uint8_t i = 0; i < 8; ++i)
{
if (data & 0x80)
{
*mosiPort |= mosiMask;
}
else
{
*mosiPort &= ~mosiMask;
}
*sclkPort |= sclkMask;
*sclkPort &= ~sclkMask;
data <<= 1;
}
SREG = oldSREG;
#else
*/
// really slow version, like Arduino shiftOut function
for (uint8_t i = 0; i < 8; ++i)
{
digitalWrite(dataPin, (data & 0x80) ? HIGH : LOW);
// mosifast((data & 0x80) ? HIGH : LOW); // faster
digitalWrite(clockPin, HIGH); // do not change to high speed!
digitalWrite(clockPin, LOW); // do not change to high speed pin change!
data <<= 1;
}
/*
for (uint8_t i = 0; i < 8; ++i)
{
mosifast((data & 0x80) ? HIGH : LOW);
delayMicroseconds(1);
sckfast(HIGH);
sckfast(LOW);
data <<= 1;
}
*/
//#endif
}
void Lcd7920::ensureBasicMode()
{
if (extendedMode)
{
sendLcdCommand(gfxMode ? LcdFunctionSetBasicGraphic : LcdFunctionSetBasicAlpha);
commandDelay();
extendedMode = false;
}
}
void Lcd7920::ensureExtendedMode()
{
if (!extendedMode)
{
sendLcdCommand(gfxMode ? LcdFunctionSetExtendedGraphic : LcdFunctionSetExtendedAlpha);
commandDelay();
extendedMode = true;
}
}

View File

@ -0,0 +1,124 @@
#include <Arduino.h>
#include <avr/pgmspace.h>
#include <Print.h>
#define mosifast(P) gpio_write_bit(GPIOB, 10, (P)); // STM32-define mosipin not in use -> much too fast!
#define sckfast(P) gpio_write_bit(GPIOA, 8, (P));// STM32-define sck pin
// Enumeration for specifying drawing modes
enum PixelMode
{
PixelClear = 0, // clear the pixel(s)
PixelSet = 1, // set the pixel(s)
PixelFlip = 2 // invert the pixel(s)
};
// Struct for describing a font table, always held in PROGMEM
struct LcdFont
{
PROGMEM const uint8_t *ptr; // pointer to font table
uint8_t startCharacter; // character code (e.g. ASCII) of the first character in the font
uint8_t endCharacter; // character code of the last character in the font
uint8_t height; // row height in pixels - only this number of pixels will be fetched and drawn - maximum 16 in this version of the sofware
uint8_t width; // max character width in pixels (the font table contains this number of bytes or words per character, plus 1 for the active width)
};
// Class for driving 128x64 graphical LCD fitted wirth ST7920 controller
// This drives the GLCD in serial mode so that it needs just 2 pins.
// Preferably, we use SPI to do the comms.
// Derive the LCD class from the Print class so that we can print stuff to it in alpha mode
class Lcd7920 : public Print
{
public:
// Construct a GLCD driver.
// cPin = clock pin (connects to E pin of ST7920)
// dPin = data pin (connects to R/W pin of ST7920)
// useSpi = true to use hardware SPI. If true then cPin must correspond to SCLK, dPin must correspond to MOSI, and SS must be configured as an output.
Lcd7920(uint8_t cPin, uint8_t dPin, bool useSpi); // constructor
// Write a single character in the current font. Called by the 'print' functions. Works in both graphic and alphanumeric mode.
// If in graphic mode, a call to setFont must have been made before calling this.
// c = character to write
// Returns the number of characters written (1 if we wrote it, 0 otherwise)
virtual size_t write(uint8_t c); // write a character
// Initialize the display. Call this in setup(). If using graphics mode, also call setFont to select initial text font.
// gmode = true to use graphics mode, false to use ST7920 alphanumeric mode.
void begin(bool gmode);
// Select the font to use for subsequent calls to write() in graphics mode. Must be called before calling write() in graphics mode.
// newFont = pointer to font descriptor in PROGMEM
void setFont(const PROGMEM LcdFont *newFont);
// Select normal or inverted text (only works in graphics mode)
void textInvert(bool b);
// Clear the display. Works in both graphic and alphanumeric mode. Also selects non-inverted text.
void clear();
// Set the cursor position
// r = row. In alphanumeric mode this is text row number.
// In graphics mode it is the number of pixels from the top of the display to the top of the character.
// c = column. In alphanumeric mode this must be even (S7920 restriction becasue the characters are double width).
// In graphics ode this is the number of pixels from the left hand edge of the display and the left hand edge of the character.
void setCursor(uint8_t r, uint8_t c); // 'c' in alpha mode, should be an even column number
// Flush the display buffer to the display. In graphics mode, calls to write, setPixel, line and circle will not be committed to the display until this is called.
void flush();
// Set, clear or invert a pixel
// x = x-coordinate of the pixel, measured from left hand edge of the display
// y = y-coordinate of the pixel, measured down from the top of the display
// mode = whether we want to set, clear or invert the pixel
void setPixel(uint8_t x, uint8_t y, PixelMode mode);
// Read a pixel. Returns true if the pixel is set, false if it is clear.
// x = x-coordinate of the pixel, measured from left hand edge of the display
// y = y-coordinate of the pixel, measured down from the top of the display
bool readPixel(uint8_t x, uint8_t y);
// Draw a line.
// x0 = x-coordinate of one end of the line, measured from left hand edge of the display
// y0 = y-coordinate of one end of the line, measured down from the top of the display
// x1, y1 = coordinates of the other end od the line
// mode = whether we want to set, clear or invert each pixel
void line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, PixelMode mode);
void fastHline(uint8_t x0, uint8_t y0, uint8_t x1, PixelMode mode);
void fastVline(uint8_t x0, uint8_t y0, uint8_t y1, PixelMode mode);
void box(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, PixelMode mode); // new add Diro
void fillbox(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, PixelMode mode); // new add Diro
// Draw a circle
// x0 = x-coordinate of the centre, measured from left hand edge of the display
// y0 = y-coordinate of the centre, measured down from the top of the display
// redius = radius of the circle in pixels
// mode = whether we want to set, clear or invert each pixel
void circle(uint8_t x0, uint8_t y0, uint8_t radius, PixelMode mode);
// Draw a bitmap
// x0 = x-coordinate of the top left, measured from left hand edge of the display. Currently, must be a multiple of 8.
// y0 = y-coordinate of the top left, measured down from the top of the display
// width = width of bitmap in pixels. Currently, must be a multiple of 8.
// rows = height of bitmap in pixels
// data = bitmap image in PROGMEM, must be ((width/8) * rows) bytes long
void bitmap(uint8_t x0, uint8_t y0, uint8_t width, uint8_t height, PROGMEM const uint8_t data[]);
private:
bool gfxMode;
bool extendedMode;
bool useSpi;
bool textInverted;
uint8_t clockPin, dataPin;
uint16_t lastCharColData; // data for the last non-space column, used for kerning
uint8_t row, column;
uint8_t startRow, startCol, endRow, endCol; // coordinates of the dirty rectangle
uint8_t image[(128 * 64)/8]; // image buffer, 1K in size (= half the RAM of the Uno)
const PROGMEM struct LcdFont *currentFont; // pointer to descriptor for current font
void sendLcdCommand(uint8_t command);
void sendLcdData(uint8_t data);
void sendLcd(uint8_t data1, uint8_t data2);
void sendLcdSlow(uint8_t data);
void commandDelay();
void setGraphicsAddress(unsigned int r, unsigned int c);
void ensureBasicMode();
void ensureExtendedMode();
};

View File

@ -0,0 +1 @@
This library has been provided by Matthias (@madias from the Arduino forum)