初始化提交

This commit is contained in:
王立帮
2024-07-20 22:09:06 +08:00
commit c247dd07a6
6876 changed files with 2743096 additions and 0 deletions

View File

@@ -0,0 +1,195 @@
#if defined(__AVR__)
#include <avr/pgmspace.h>
#define fontdatatype const uint8_t
#elif defined(__PIC32MX__)
#define PROGMEM
#define fontdatatype const unsigned char
#elif defined(__arm__)
#define PROGMEM
#define fontdatatype const unsigned char
#endif
fontdatatype SmallFont[] PROGMEM =
{
0x06, 0x08, 0x20, 0x5f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sp
0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, // !
0x00, 0x00, 0x07, 0x00, 0x07, 0x00, // "
0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14, // #
0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12, // $
0x00, 0x23, 0x13, 0x08, 0x64, 0x62, // %
0x00, 0x36, 0x49, 0x55, 0x22, 0x50, // &
0x00, 0x00, 0x05, 0x03, 0x00, 0x00, // '
0x00, 0x00, 0x1c, 0x22, 0x41, 0x00, // (
0x00, 0x00, 0x41, 0x22, 0x1c, 0x00, // )
0x00, 0x14, 0x08, 0x3E, 0x08, 0x14, // *
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, // +
0x00, 0x00, 0x00, 0xA0, 0x60, 0x00, // ,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, // -
0x00, 0x00, 0x60, 0x60, 0x00, 0x00, // .
0x00, 0x20, 0x10, 0x08, 0x04, 0x02, // /
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E, // 0
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00, // 1
0x00, 0x42, 0x61, 0x51, 0x49, 0x46, // 2
0x00, 0x21, 0x41, 0x45, 0x4B, 0x31, // 3
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10, // 4
0x00, 0x27, 0x45, 0x45, 0x45, 0x39, // 5
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30, // 6
0x00, 0x01, 0x71, 0x09, 0x05, 0x03, // 7
0x00, 0x36, 0x49, 0x49, 0x49, 0x36, // 8
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E, // 9
0x00, 0x00, 0x36, 0x36, 0x00, 0x00, // :
0x00, 0x00, 0x56, 0x36, 0x00, 0x00, // ;
0x00, 0x08, 0x14, 0x22, 0x41, 0x00, // <
0x00, 0x14, 0x14, 0x14, 0x14, 0x14, // =
0x00, 0x00, 0x41, 0x22, 0x14, 0x08, // >
0x00, 0x02, 0x01, 0x51, 0x09, 0x06, // ?
0x00, 0x32, 0x49, 0x59, 0x51, 0x3E, // @
0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C, // A
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36, // B
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22, // C
0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C, // D
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41, // E
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01, // F
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A, // G
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F, // H
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00, // I
0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, // J
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41, // K
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40, // L
0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F, // M
0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F, // N
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E, // O
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06, // P
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E, // Q
0x00, 0x7F, 0x09, 0x19, 0x29, 0x46, // R
0x00, 0x46, 0x49, 0x49, 0x49, 0x31, // S
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01, // T
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F, // U
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F, // V
0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F, // W
0x00, 0x63, 0x14, 0x08, 0x14, 0x63, // X
0x00, 0x07, 0x08, 0x70, 0x08, 0x07, // Y
0x00, 0x61, 0x51, 0x49, 0x45, 0x43, // Z
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00, // [
0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, // Backslash (Checker pattern)
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00, // ]
0x00, 0x04, 0x02, 0x01, 0x02, 0x04, // ^
0x00, 0x40, 0x40, 0x40, 0x40, 0x40, // _
0x00, 0x00, 0x03, 0x05, 0x00, 0x00, // `
0x00, 0x20, 0x54, 0x54, 0x54, 0x78, // a
0x00, 0x7F, 0x48, 0x44, 0x44, 0x38, // b
0x00, 0x38, 0x44, 0x44, 0x44, 0x20, // c
0x00, 0x38, 0x44, 0x44, 0x48, 0x7F, // d
0x00, 0x38, 0x54, 0x54, 0x54, 0x18, // e
0x00, 0x08, 0x7E, 0x09, 0x01, 0x02, // f
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C, // g
0x00, 0x7F, 0x08, 0x04, 0x04, 0x78, // h
0x00, 0x00, 0x44, 0x7D, 0x40, 0x00, // i
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00, // j
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, // k
0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, // l
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78, // m
0x00, 0x7C, 0x08, 0x04, 0x04, 0x78, // n
0x00, 0x38, 0x44, 0x44, 0x44, 0x38, // o
0x00, 0xFC, 0x24, 0x24, 0x24, 0x18, // p
0x00, 0x18, 0x24, 0x24, 0x18, 0xFC, // q
0x00, 0x7C, 0x08, 0x04, 0x04, 0x08, // r
0x00, 0x48, 0x54, 0x54, 0x54, 0x20, // s
0x00, 0x04, 0x3F, 0x44, 0x40, 0x20, // t
0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C, // u
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C, // v
0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C, // w
0x00, 0x44, 0x28, 0x10, 0x28, 0x44, // x
0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C, // y
0x00, 0x44, 0x64, 0x54, 0x4C, 0x44, // z
0x00, 0x00, 0x10, 0x7C, 0x82, 0x00, // {
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, // |
0x00, 0x00, 0x82, 0x7C, 0x10, 0x00, // }
0x00, 0x00, 0x06, 0x09, 0x09, 0x06 // ~ (Degrees)
};
fontdatatype MediumNumbers[] PROGMEM =
{
0x0c, 0x10, 0x2d, 0x0d,
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, // -
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, // .
0x00, 0x00, 0x02, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x02, 0x00, 0x00, 0x00, 0x00, 0x81, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x81, 0x00, 0x00, // /
0x00, 0xfc, 0x7a, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7a, 0xfc, 0x00, 0x00, 0x7e, 0xbc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xbc, 0x7e, 0x00, // 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x00, // 1
0x00, 0x00, 0x02, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x7a, 0xfc, 0x00, 0x00, 0x7e, 0xbd, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x81, 0x00, 0x00, // 2
0x00, 0x00, 0x02, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x7a, 0xfc, 0x00, 0x00, 0x00, 0x81, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xbd, 0x7e, 0x00, // 3
0x00, 0xfc, 0x78, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x78, 0xfc, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3d, 0x7e, 0x00, // 4
0x00, 0xfc, 0x7a, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x02, 0x00, 0x00, 0x00, 0x00, 0x81, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xbd, 0x7e, 0x00, // 5
0x00, 0xfc, 0x7a, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x02, 0x00, 0x00, 0x00, 0x7e, 0xbd, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xbd, 0x7e, 0x00, // 6
0x00, 0x00, 0x02, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7a, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x00, // 7
0x00, 0xfc, 0x7a, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x7a, 0xfc, 0x00, 0x00, 0x7e, 0xbd, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xbd, 0x7e, 0x00, // 8
0x00, 0xfc, 0x7a, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x7a, 0xfc, 0x00, 0x00, 0x00, 0x81, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xbd, 0x7e, 0x00, // 9
};
fontdatatype BigNumbers[] PROGMEM =
{
0x0e, 0x18, 0x2d, 0x0d,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xe0, 0xe0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, // .
0x00, 0x00, 0x02, 0x06, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0x00, // /
0x00, 0xfc, 0xfa, 0xf6, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xf6, 0xfa, 0xfc, 0x00, 0x00, 0xef, 0xc7, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0xc7, 0xef, 0x00, 0x00, 0x7f, 0xbf, 0xdf, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xbf, 0x7f, 0x00, // 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0xc7, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x7f, 0x00, // 1
0x00, 0x00, 0x02, 0x06, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xf6, 0xfa, 0xfc, 0x00, 0x00, 0xe0, 0xd0, 0xb8, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x3b, 0x17, 0x0f, 0x00, 0x00, 0x7f, 0xbf, 0xdf, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0x00, // 2
0x00, 0x00, 0x02, 0x06, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xf6, 0xfa, 0xfc, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xbb, 0xd7, 0xef, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xbf, 0x7f, 0x00, // 3
0x00, 0xfc, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0xfc, 0x00, 0x00, 0x0f, 0x17, 0x3b, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xbb, 0xd7, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x7f, 0x00, // 4
0x00, 0xfc, 0xfa, 0xf6, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x17, 0x3b, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xb8, 0xd0, 0xe0, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xbf, 0x7f, 0x00, // 5
0x00, 0xfc, 0xfa, 0xf6, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0xef, 0xd7, 0xbb, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xb8, 0xd0, 0xe0, 0x00, 0x00, 0x7f, 0xbf, 0xdf, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xbf, 0x7f, 0x00, // 6
0x00, 0x00, 0x02, 0x06, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xf6, 0xfa, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0xc7, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x7f, 0x00, // 7
0x00, 0xfc, 0xfa, 0xf6, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xf6, 0xfa, 0xfc, 0x00, 0x00, 0xef, 0xd7, 0xbb, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xbb, 0xd7, 0xef, 0x00, 0x00, 0x7f, 0xbf, 0xdf, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xbf, 0x7f, 0x00, // 8
0x00, 0xfc, 0xfa, 0xf6, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xf6, 0xfa, 0xfc, 0x00, 0x00, 0x0f, 0x17, 0x3b, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xbb, 0xd7, 0xef, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xbf, 0x7f, 0x00, // 9
};
fontdatatype TinyFont[] PROGMEM =
{
0x04, 0x06, 0x20, 0x5f,
0x00, 0x00, 0x00, 0x03, 0xa0, 0x00, 0xc0, 0x0c, 0x00, 0xf9, 0x4f, 0x80, 0x6b, 0xeb, 0x00, 0x98, 0x8c, 0x80, 0x52, 0xa5, 0x80, 0x03, 0x00, 0x00, // Space, !"#$%&'
0x01, 0xc8, 0x80, 0x89, 0xc0, 0x00, 0x50, 0x85, 0x00, 0x21, 0xc2, 0x00, 0x08, 0x40, 0x00, 0x20, 0x82, 0x00, 0x00, 0x20, 0x00, 0x18, 0x8c, 0x00, // ()*+,-./
0xfa, 0x2f, 0x80, 0x4b, 0xe0, 0x80, 0x5a, 0x66, 0x80, 0x8a, 0xa5, 0x00, 0xe0, 0x8f, 0x80, 0xea, 0xab, 0x00, 0x72, 0xa9, 0x00, 0x9a, 0x8c, 0x00, // 01234567
0xfa, 0xaf, 0x80, 0x4a, 0xa7, 0x00, 0x01, 0x40, 0x00, 0x09, 0x40, 0x00, 0x21, 0x48, 0x80, 0x51, 0x45, 0x00, 0x89, 0x42, 0x00, 0x42, 0x66, 0x00, // 89:;<=>?
0x72, 0xa6, 0x80, 0x7a, 0x87, 0x80, 0xfa, 0xa5, 0x00, 0x72, 0x25, 0x00, 0xfa, 0x27, 0x00, 0xfa, 0xa8, 0x80, 0xfa, 0x88, 0x00, 0x72, 0x2b, 0x00, // @ABCDEFG
0xf8, 0x8f, 0x80, 0x8b, 0xe8, 0x80, 0x8b, 0xe8, 0x00, 0xf8, 0x8d, 0x80, 0xf8, 0x20, 0x80, 0xf9, 0x0f, 0x80, 0xf9, 0xcf, 0x80, 0x72, 0x27, 0x00, // HIJKLMNO
0xfa, 0x84, 0x00, 0x72, 0x27, 0x40, 0xfa, 0x85, 0x80, 0x4a, 0xa9, 0x00, 0x83, 0xe8, 0x00, 0xf0, 0x2f, 0x00, 0xe0, 0x6e, 0x00, 0xf0, 0xef, 0x00, // PQRSTUVW
0xd8, 0x8d, 0x80, 0xc0, 0xec, 0x00, 0x9a, 0xac, 0x80, 0x03, 0xe8, 0x80, 0xc0, 0x81, 0x80, 0x8b, 0xe0, 0x00, 0x42, 0x04, 0x00, 0x08, 0x20, 0x80, // XYZ[\]^_
0x02, 0x04, 0x00, 0x31, 0x23, 0x80, 0xf9, 0x23, 0x00, 0x31, 0x24, 0x80, 0x31, 0x2f, 0x80, 0x31, 0x62, 0x80, 0x23, 0xea, 0x00, 0x25, 0x53, 0x80, // `abcdefg
0xf9, 0x03, 0x80, 0x02, 0xe0, 0x00, 0x06, 0xe0, 0x00, 0xf8, 0x42, 0x80, 0x03, 0xe0, 0x00, 0x79, 0x87, 0x80, 0x39, 0x03, 0x80, 0x31, 0x23, 0x00, // hijklmno
0x7d, 0x23, 0x00, 0x31, 0x27, 0xc0, 0x78, 0x84, 0x00, 0x29, 0x40, 0x00, 0x43, 0xe4, 0x00, 0x70, 0x27, 0x00, 0x60, 0x66, 0x00, 0x70, 0x67, 0x00, // pqrstuvw
0x48, 0xc4, 0x80, 0x74, 0x57, 0x80, 0x59, 0xe6, 0x80, 0x23, 0xe8, 0x80, 0x03, 0x60, 0x00, 0x8b, 0xe2, 0x00, 0x61, 0x0c, 0x00 // zyx{|}~
};
fontdatatype Hanzi12x16[] PROGMEM =
{
0x0c, 0x10, 0x30, 0x04,
/*-- 文字: 温 --*/
/*-- 新宋体9; 此字体下对应的点阵为宽x高=12x12 --*/
/*-- 高度不是8的倍数现调整为宽度x高度=12x16 --*/
0x22,0x44,0x00,0xC0,0x5F,0xD5,0x55,0xD5,0x5F,0xC0,0x00,0x00,0x04,0x02,0x09,0x0F,
0x08,0x0F,0x08,0x0F,0x08,0x0F,0x08,0x00,
/*-- 文字: 度 --*/
/*-- 新宋体9; 此字体下对应的点阵为宽x高=12x12 --*/
/*-- 高度不是8的倍数现调整为宽度x高度=12x16 --*/
0x00,0xFE,0x0A,0x8A,0xBE,0xAA,0xAB,0xAA,0xBE,0x8A,0x0A,0x00,0x08,0x07,0x00,0x08,
0x09,0x0A,0x04,0x04,0x0A,0x09,0x08,0x00,
/*-- 文字: 湿 --*/
/*-- 新宋体9; 此字体下对应的点阵为宽x高=12x12 --*/
/*-- 高度不是8的倍数现调整为宽度x高度=12x16 --*/
0x11,0x22,0x80,0x3E,0x2A,0xEA,0x2A,0xEA,0x2A,0x3E,0x80,0x00,0x04,0x02,0x08,0x09,
0x08,0x0F,0x08,0x0F,0x08,0x09,0x08,0x00,
/*-- 文字: --*/
/*-- 新宋体9; 此字体下对应的点阵为宽x高=12x12 --*/
/*-- 高度不是8的倍数现调整为宽度x高度=12x16 --*/
0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

View File

@@ -0,0 +1,21 @@
Version:
1.0 01 Sep 2011 - initial release
1.1 04 Sep 2011 - added invertText();
2.0 18 Mar 2013 - combined Arduino and chipKit libraries into a single library
updated library to support Arduino v1.0 (and higher)
added setContrast();
added support for Arduino Leonardo and Arduino Due
fixed a bug that caused bitmaps to use double the memory on chipKits
changed license to CC BY-NC-SA 3.0
2.1 08 May 2013 - modified printNumI() and printNumF()
added support for String objects to print()
added support for chipKit uC32
reorganized files
2.11 14 Jun 2013 - fixed the '%' symbol in SmallFont
added fillScr(), clrLine(), clrRect(), clrRoundRect() and clrCircle()
2.12 16 Mar 2014 - added functions for enabling and disabling Sleep Mode
added an example for the use of Sleep Mode
added support for Bobuino
2.13 08 Sep 2014 - fixed compatibility-issues with Arduino 1.5.7

View File

@@ -0,0 +1,837 @@
/*
LCD5110_Graph.cpp - Arduino/chipKit library support for Nokia 5110 compatible LCDs
Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
Basic functionality of this library are based on the demo-code provided by
ITead studio. You can find the latest version of the library at
http://www.RinkyDinkElectronics.com/
This library has been made to make it easy to use the Nokia 5110 LCD module
as a graphics display on an Arduino or a chipKit.
This library is free software; you can redistribute it and/or
modify it under the terms of the CC BY-NC-SA 3.0 license.
Please see the included documents for further information.
Commercial use of this library requires you to buy a license that
will allow commercial use. This includes using the library,
modified or not, as a tool to sell products.
The license applies to all part of the library including the
examples and tools supplied with the library.
*/
#include "LCD5110_Graph.h"
#if defined(__AVR__)
#include <avr/pgmspace.h>
#include "hardware/avr/HW_AVR.h"
#elif defined(__PIC32MX__)
#pragma message("Compiling for PIC32 Architecture...")
#include "hardware/pic32/HW_PIC32.h"
#elif defined(__arm__)
#pragma message("Compiling for ARM Architecture...")
#include "hardware/arm/HW_ARM.h"
#endif
LCD5110::LCD5110(int SCK, int MOSI, int DC, int RST, int CS)
{
P_SCK = portOutputRegister(digitalPinToPort(SCK));
B_SCK = digitalPinToBitMask(SCK);
P_MOSI = portOutputRegister(digitalPinToPort(MOSI));
B_MOSI = digitalPinToBitMask(MOSI);
P_DC = portOutputRegister(digitalPinToPort(DC));
B_DC = digitalPinToBitMask(DC);
P_RST = portOutputRegister(digitalPinToPort(RST));
B_RST = digitalPinToBitMask(RST);
P_CS = portOutputRegister(digitalPinToPort(CS));
B_CS = digitalPinToBitMask(CS);
pinMode(SCK,OUTPUT);
pinMode(MOSI,OUTPUT);
pinMode(DC,OUTPUT);
pinMode(RST,OUTPUT);
pinMode(CS,OUTPUT);
SCK_Pin=SCK;
RST_Pin=RST;
}
void LCD5110::_LCD_Write(unsigned char data, unsigned char mode)
{
cbi(P_CS, B_CS);
if (mode==LCD_COMMAND)
cbi(P_DC, B_DC);
else
sbi(P_DC, B_DC);
for (unsigned char c=0; c<8; c++)
{
if (data & 0x80)
sbi(P_MOSI, B_MOSI);
else
cbi(P_MOSI, B_MOSI);
data = data<<1;
pulseClock;
}
sbi(P_CS, B_CS);
}
void LCD5110::InitLCD(int contrast)
{
if (contrast>0x7F)
contrast=0x7F;
if (contrast<0)
contrast=0;
resetLCD;
_LCD_Write(PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION, LCD_COMMAND);
_LCD_Write(PCD8544_SETVOP | contrast, LCD_COMMAND);
_LCD_Write(PCD8544_SETTEMP | LCD_TEMP, LCD_COMMAND);
_LCD_Write(PCD8544_SETBIAS | LCD_BIAS, LCD_COMMAND);
_LCD_Write(PCD8544_FUNCTIONSET, LCD_COMMAND);
_LCD_Write(PCD8544_SETYADDR, LCD_COMMAND);
_LCD_Write(PCD8544_SETXADDR, LCD_COMMAND);
_LCD_Write(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL, LCD_COMMAND);
clrScr();
update();
cfont.font=0;
_sleep=false;
_contrast=contrast;
}
void LCD5110::setContrast(int contrast)
{
if (contrast>0x7F)
contrast=0x7F;
if (contrast<0)
contrast=0;
_LCD_Write(PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION, LCD_COMMAND);
_LCD_Write(PCD8544_SETVOP | contrast, LCD_COMMAND);
_LCD_Write(PCD8544_FUNCTIONSET, LCD_COMMAND);
_contrast=contrast;
}
void LCD5110::enableSleep()
{
_sleep = true;
_LCD_Write(PCD8544_SETYADDR, LCD_COMMAND);
_LCD_Write(PCD8544_SETXADDR, LCD_COMMAND);
for (int b=0; b<504; b++)
_LCD_Write(0, LCD_DATA);
_LCD_Write(PCD8544_FUNCTIONSET | PCD8544_POWERDOWN, LCD_COMMAND);
}
void LCD5110::disableSleep()
{
_sleep = false;
_LCD_Write(PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION, LCD_COMMAND);
_LCD_Write(PCD8544_SETVOP | _contrast, LCD_COMMAND);
_LCD_Write(PCD8544_SETTEMP | LCD_TEMP, LCD_COMMAND);
_LCD_Write(PCD8544_SETBIAS | LCD_BIAS, LCD_COMMAND);
_LCD_Write(PCD8544_FUNCTIONSET, LCD_COMMAND);
_LCD_Write(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL, LCD_COMMAND);
update();
}
void LCD5110::update()
{
if (_sleep==false)
{
_LCD_Write(PCD8544_SETYADDR, LCD_COMMAND);
_LCD_Write(PCD8544_SETXADDR, LCD_COMMAND);
for (int b=0; b<504; b++)
_LCD_Write(scrbuf[b], LCD_DATA);
}
}
void LCD5110::clrScr()
{
for (int c=0; c<504; c++)
scrbuf[c]=0;
}
void LCD5110::fillScr()
{
for (int c=0; c<504; c++)
scrbuf[c]=255;
}
void LCD5110::invert(bool mode)
{
if (mode==true)
_LCD_Write(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYINVERTED, LCD_COMMAND);
else
_LCD_Write(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL, LCD_COMMAND);
}
void LCD5110::setPixel(uint16_t x, uint16_t y)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
by=((y/8)*84)+x;
bi=y % 8;
scrbuf[by]=scrbuf[by] | (1<<bi);
}
}
void LCD5110::clrPixel(uint16_t x, uint16_t y)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
by=((y/8)*84)+x;
bi=y % 8;
scrbuf[by]=scrbuf[by] & ~(1<<bi);
}
}
void LCD5110::invPixel(uint16_t x, uint16_t y)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
by=((y/8)*84)+x;
bi=y % 8;
if ((scrbuf[by] & (1<<bi))==0)
scrbuf[by]=scrbuf[by] | (1<<bi);
else
scrbuf[by]=scrbuf[by] & ~(1<<bi);
}
}
void LCD5110::invertText(bool mode)
{
if (mode==true)
cfont.inverted=1;
else
cfont.inverted=0;
}
void LCD5110::print(char *st, int x, int y)
{
unsigned char ch;
int stl;
stl = strlen(st);
if (x == RIGHT)
x = 84-(stl*cfont.x_size);
if (x == CENTER)
x = (84-(stl*cfont.x_size))/2;
for (int cnt=0; cnt<stl; cnt++)
_print_char(*st++, x + (cnt*(cfont.x_size)), y);
}
void LCD5110::print(String st, int x, int y)
{
char buf[st.length()+1];
st.toCharArray(buf, st.length()+1);
print(buf, x, y);
}
void LCD5110::printNumI(long num, int x, int y, int length, char filler)
{
char buf[25];
char st[27];
boolean neg=false;
int c=0, f=0;
if (num==0)
{
if (length!=0)
{
for (c=0; c<(length-1); c++)
st[c]=filler;
st[c]=48;
st[c+1]=0;
}
else
{
st[0]=48;
st[1]=0;
}
}
else
{
if (num<0)
{
neg=true;
num=-num;
}
while (num>0)
{
buf[c]=48+(num % 10);
c++;
num=(num-(num % 10))/10;
}
buf[c]=0;
if (neg)
{
st[0]=45;
}
if (length>(c+neg))
{
for (int i=0; i<(length-c-neg); i++)
{
st[i+neg]=filler;
f++;
}
}
for (int i=0; i<c; i++)
{
st[i+neg+f]=buf[c-i-1];
}
st[c+neg+f]=0;
}
print(st,x,y);
}
void LCD5110::printNumF(double num, byte dec, int x, int y, char divider, int length, char filler)
{
char st[27];
boolean neg=false;
if (num<0)
neg = true;
_convert_float(st, num, length, dec);
if (divider != '.')
{
for (int i=0; i<sizeof(st); i++)
if (st[i]=='.')
st[i]=divider;
}
if (filler != ' ')
{
if (neg)
{
st[0]='-';
for (int i=1; i<sizeof(st); i++)
if ((st[i]==' ') || (st[i]=='-'))
st[i]=filler;
}
else
{
for (int i=0; i<sizeof(st); i++)
if (st[i]==' ')
st[i]=filler;
}
}
print(st,x,y);
}
void LCD5110::_print_char(unsigned char c, int x, int y)
{
if ((cfont.y_size % 8) == 0)
{
int font_idx = ((c - cfont.offset)*(cfont.x_size*(cfont.y_size/8)))+4;
for (int rowcnt=0; rowcnt<(cfont.y_size/8); rowcnt++)
{
for(int cnt=0; cnt<cfont.x_size; cnt++)
{
for (int b=0; b<8; b++)
if ((fontbyte(font_idx+cnt+(rowcnt*cfont.x_size)) & (1<<b))!=0)
if (cfont.inverted==0)
setPixel(x+cnt, y+(rowcnt*8)+b);
else
clrPixel(x+cnt, y+(rowcnt*8)+b);
else
if (cfont.inverted==0)
clrPixel(x+cnt, y+(rowcnt*8)+b);
else
setPixel(x+cnt, y+(rowcnt*8)+b);
}
}
}
else
{
int font_idx = ((c - cfont.offset)*((cfont.x_size*cfont.y_size/8)))+4;
int cbyte=fontbyte(font_idx);
int cbit=7;
for (int cx=0; cx<cfont.x_size; cx++)
{
for (int cy=0; cy<cfont.y_size; cy++)
{
if ((cbyte & (1<<cbit)) != 0)
if (cfont.inverted==0)
setPixel(x+cx, y+cy);
else
clrPixel(x+cx, y+cy);
else
if (cfont.inverted==0)
clrPixel(x+cx, y+cy);
else
setPixel(x+cx, y+cy);
cbit--;
if (cbit<0)
{
cbit=7;
font_idx++;
cbyte=fontbyte(font_idx);
}
}
}
}
}
void LCD5110::setFont(uint8_t* font)
{
cfont.font=font;
cfont.x_size=fontbyte(0);
cfont.y_size=fontbyte(1);
cfont.offset=fontbyte(2);
cfont.numchars=fontbyte(3);
cfont.inverted=0;
}
void LCD5110::drawHLine(int x, int y, int l)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
for (int cx=0; cx<l; cx++)
{
by=((y/8)*84)+x;
bi=y % 8;
scrbuf[by+cx] |= (1<<bi);
}
}
}
void LCD5110::clrHLine(int x, int y, int l)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
for (int cx=0; cx<l; cx++)
{
by=((y/8)*84)+x;
bi=y % 8;
scrbuf[by+cx] &= ~(1<<bi);
}
}
}
void LCD5110::drawVLine(int x, int y, int l)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
for (int cy=0; cy<l; cy++)
{
setPixel(x, y+cy);
}
}
}
void LCD5110::clrVLine(int x, int y, int l)
{
int by, bi;
if ((x>=0) and (x<84) and (y>=0) and (y<48))
{
for (int cy=0; cy<l; cy++)
{
clrPixel(x, y+cy);
}
}
}
void LCD5110::drawLine(int x1, int y1, int x2, int y2)
{
int tmp;
double delta, tx, ty;
double m, b, dx, dy;
if (((x2-x1)<0))
{
tmp=x1;
x1=x2;
x2=tmp;
tmp=y1;
y1=y2;
y2=tmp;
}
if (((y2-y1)<0))
{
tmp=x1;
x1=x2;
x2=tmp;
tmp=y1;
y1=y2;
y2=tmp;
}
if (y1==y2)
{
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
drawHLine(x1, y1, x2-x1);
}
else if (x1==x2)
{
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
drawVLine(x1, y1, y2-y1);
}
else if (abs(x2-x1)>abs(y2-y1))
{
delta=(double(y2-y1)/double(x2-x1));
ty=double(y1);
if (x1>x2)
{
for (int i=x1; i>=x2; i--)
{
setPixel(i, int(ty+0.5));
ty=ty-delta;
}
}
else
{
for (int i=x1; i<=x2; i++)
{
setPixel(i, int(ty+0.5));
ty=ty+delta;
}
}
}
else
{
delta=(float(x2-x1)/float(y2-y1));
tx=float(x1);
if (y1>y2)
{
for (int i=y2+1; i>y1; i--)
{
setPixel(int(tx+0.5), i);
tx=tx+delta;
}
}
else
{
for (int i=y1; i<y2+1; i++)
{
setPixel(int(tx+0.5), i);
tx=tx+delta;
}
}
}
}
void LCD5110::clrLine(int x1, int y1, int x2, int y2)
{
int tmp;
double delta, tx, ty;
double m, b, dx, dy;
if (((x2-x1)<0))
{
tmp=x1;
x1=x2;
x2=tmp;
tmp=y1;
y1=y2;
y2=tmp;
}
if (((y2-y1)<0))
{
tmp=x1;
x1=x2;
x2=tmp;
tmp=y1;
y1=y2;
y2=tmp;
}
if (y1==y2)
{
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
clrHLine(x1, y1, x2-x1);
}
else if (x1==x2)
{
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
clrVLine(x1, y1, y2-y1);
}
else if (abs(x2-x1)>abs(y2-y1))
{
delta=(double(y2-y1)/double(x2-x1));
ty=double(y1);
if (x1>x2)
{
for (int i=x1; i>=x2; i--)
{
clrPixel(i, int(ty+0.5));
ty=ty-delta;
}
}
else
{
for (int i=x1; i<=x2; i++)
{
clrPixel(i, int(ty+0.5));
ty=ty+delta;
}
}
}
else
{
delta=(float(x2-x1)/float(y2-y1));
tx=float(x1);
if (y1>y2)
{
for (int i=y2+1; i>y1; i--)
{
clrPixel(int(tx+0.5), i);
tx=tx+delta;
}
}
else
{
for (int i=y1; i<y2+1; i++)
{
clrPixel(int(tx+0.5), i);
tx=tx+delta;
}
}
}
}
void LCD5110::drawRect(int x1, int y1, int x2, int y2)
{
int tmp;
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
drawHLine(x1, y1, x2-x1);
drawHLine(x1, y2, x2-x1);
drawVLine(x1, y1, y2-y1);
drawVLine(x2, y1, y2-y1+1);
}
void LCD5110::clrRect(int x1, int y1, int x2, int y2)
{
int tmp;
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
clrHLine(x1, y1, x2-x1);
clrHLine(x1, y2, x2-x1);
clrVLine(x1, y1, y2-y1);
clrVLine(x2, y1, y2-y1+1);
}
void LCD5110::drawRoundRect(int x1, int y1, int x2, int y2)
{
int tmp;
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
if ((x2-x1)>4 && (y2-y1)>4)
{
setPixel(x1+1,y1+1);
setPixel(x2-1,y1+1);
setPixel(x1+1,y2-1);
setPixel(x2-1,y2-1);
drawHLine(x1+2, y1, x2-x1-3);
drawHLine(x1+2, y2, x2-x1-3);
drawVLine(x1, y1+2, y2-y1-3);
drawVLine(x2, y1+2, y2-y1-3);
}
}
void LCD5110::clrRoundRect(int x1, int y1, int x2, int y2)
{
int tmp;
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
if ((x2-x1)>4 && (y2-y1)>4)
{
clrPixel(x1+1,y1+1);
clrPixel(x2-1,y1+1);
clrPixel(x1+1,y2-1);
clrPixel(x2-1,y2-1);
clrHLine(x1+2, y1, x2-x1-3);
clrHLine(x1+2, y2, x2-x1-3);
clrVLine(x1, y1+2, y2-y1-3);
clrVLine(x2, y1+2, y2-y1-3);
}
}
void LCD5110::drawCircle(int x, int y, int radius)
{
int f = 1 - radius;
int ddF_x = 1;
int ddF_y = -2 * radius;
int x1 = 0;
int y1 = radius;
char ch, cl;
setPixel(x, y + radius);
setPixel(x, y - radius);
setPixel(x + radius, y);
setPixel(x - radius, y);
while(x1 < y1)
{
if(f >= 0)
{
y1--;
ddF_y += 2;
f += ddF_y;
}
x1++;
ddF_x += 2;
f += ddF_x;
setPixel(x + x1, y + y1);
setPixel(x - x1, y + y1);
setPixel(x + x1, y - y1);
setPixel(x - x1, y - y1);
setPixel(x + y1, y + x1);
setPixel(x - y1, y + x1);
setPixel(x + y1, y - x1);
setPixel(x - y1, y - x1);
}
}
void LCD5110::clrCircle(int x, int y, int radius)
{
int f = 1 - radius;
int ddF_x = 1;
int ddF_y = -2 * radius;
int x1 = 0;
int y1 = radius;
char ch, cl;
clrPixel(x, y + radius);
clrPixel(x, y - radius);
clrPixel(x + radius, y);
clrPixel(x - radius, y);
while(x1 < y1)
{
if(f >= 0)
{
y1--;
ddF_y += 2;
f += ddF_y;
}
x1++;
ddF_x += 2;
f += ddF_x;
clrPixel(x + x1, y + y1);
clrPixel(x - x1, y + y1);
clrPixel(x + x1, y - y1);
clrPixel(x - x1, y - y1);
clrPixel(x + y1, y + x1);
clrPixel(x - y1, y + x1);
clrPixel(x + y1, y - x1);
clrPixel(x - y1, y - x1);
}
}
void LCD5110::drawBitmap(int x, int y, uint8_t* bitmap, int sx, int sy)
{
int bit;
byte data;
for (int cy=0; cy<sy; cy++)
{
bit= cy % 8;
for(int cx=0; cx<sx; cx++)
{
data=bitmapbyte(cx+((cy/8)*sx));
if ((data & (1<<bit))>0)
setPixel(x+cx, y+cy);
else
clrPixel(x+cx, y+cy);
}
}
}

View File

@@ -0,0 +1,128 @@
/*
LCD5110_Graph.h - Arduino/chipKit library support for Nokia 5110 compatible LCDs
Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
Basic functionality of this library are based on the demo-code provided by
ITead studio. You can find the latest version of the library at
http://www.RinkyDinkElectronics.com/
This library has been made to make it easy to use the Nokia 5110 LCD module
as a graphics display on an Arduino or a chipKit.
This library is free software; you can redistribute it and/or
modify it under the terms of the CC BY-NC-SA 3.0 license.
Please see the included documents for further information.
Commercial use of this library requires you to buy a license that
will allow commercial use. This includes using the library,
modified or not, as a tool to sell products.
The license applies to all part of the library including the
examples and tools supplied with the library.
*/
#ifndef LCD5110_Graph_h
#define LCD5110_Graph_h
#define LEFT 0
#define RIGHT 9999
#define CENTER 9998
#define LCD_COMMAND 0
#define LCD_DATA 1
// PCD8544 Commandset
// ------------------
// General commands
#define PCD8544_POWERDOWN 0x04
#define PCD8544_ENTRYMODE 0x02
#define PCD8544_EXTENDEDINSTRUCTION 0x01
#define PCD8544_DISPLAYBLANK 0x00
#define PCD8544_DISPLAYNORMAL 0x04
#define PCD8544_DISPLAYALLON 0x01
#define PCD8544_DISPLAYINVERTED 0x05
// Normal instruction set
#define PCD8544_FUNCTIONSET 0x20
#define PCD8544_DISPLAYCONTROL 0x08
#define PCD8544_SETYADDR 0x40
#define PCD8544_SETXADDR 0x80
// Extended instruction set
#define PCD8544_SETTEMP 0x04
#define PCD8544_SETBIAS 0x10
#define PCD8544_SETVOP 0x80
// Display presets
#define LCD_BIAS 0x03 // Range: 0-7 (0x00-0x07)
#define LCD_TEMP 0x02 // Range: 0-3 (0x00-0x03)
#define LCD_CONTRAST 0x46 // Range: 0-127 (0x00-0x7F)
#if defined(__AVR__)
#include "Arduino.h"
#include "hardware/avr/HW_AVR_defines.h"
#elif defined(__PIC32MX__)
#include "WProgram.h"
#include "hardware/pic32/HW_PIC32_defines.h"
#elif defined(__arm__)
#include "Arduino.h"
#include "hardware/arm/HW_ARM_defines.h"
#endif
struct _current_font
{
uint8_t* font;
uint8_t x_size;
uint8_t y_size;
uint8_t offset;
uint8_t numchars;
uint8_t inverted;
};
class LCD5110
{
public:
LCD5110(int SCK, int MOSI, int DC, int RST, int CS);
void InitLCD(int contrast=LCD_CONTRAST);
void setContrast(int contrast);
void enableSleep();
void disableSleep();
void update();
void clrScr();
void fillScr();
void invert(bool mode);
void setPixel(uint16_t x, uint16_t y);
void clrPixel(uint16_t x, uint16_t y);
void invPixel(uint16_t x, uint16_t y);
void invertText(bool mode);
void print(char *st, int x, int y);
void print(String st, int x, int y);
void printNumI(long num, int x, int y, int length=0, char filler=' ');
void printNumF(double num, byte dec, int x, int y, char divider='.', int length=0, char filler=' ');
void setFont(uint8_t* font);
void drawBitmap(int x, int y, uint8_t* bitmap, int sx, int sy);
void drawLine(int x1, int y1, int x2, int y2);
void clrLine(int x1, int y1, int x2, int y2);
void drawRect(int x1, int y1, int x2, int y2);
void clrRect(int x1, int y1, int x2, int y2);
void drawRoundRect(int x1, int y1, int x2, int y2);
void clrRoundRect(int x1, int y1, int x2, int y2);
void drawCircle(int x, int y, int radius);
void clrCircle(int x, int y, int radius);
protected:
regtype *P_SCK, *P_MOSI, *P_DC, *P_RST, *P_CS;
regsize B_SCK, B_MOSI, B_DC, B_RST, B_CS;
uint8_t SCK_Pin, RST_Pin; // Needed for for faster MCUs
_current_font cfont;
uint8_t scrbuf[504];
boolean _sleep;
int _contrast;
void _LCD_Write(unsigned char data, unsigned char mode);
void _print_char(unsigned char c, int x, int row);
void _convert_float(char *buf, double num, int width, byte prec);
void drawHLine(int x, int y, int l);
void clrHLine(int x, int y, int l);
void drawVLine(int x, int y, int l);
void clrVLine(int x, int y, int l);
};
#endif

View File

@@ -0,0 +1,79 @@
const unsigned char arduino_logo[] ={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC, // 0x0010 (16) pixels
0xFE, 0xFE, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFE, // 0x0020 (32) pixels
0xFC, 0xFC, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, // 0x0030 (48) pixels
0xF0, 0xF0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, // 0x0040 (64) pixels
0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xE0, 0xC0, 0x86, 0x06, 0x06, 0x00, // 0x0050 (80) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0x0060 (96) pixels
0x1F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // 0x0070 (112) pixels
0x80, 0x80, 0x00, 0x00, 0x01, 0x01, 0x03, 0x0F, 0x1F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xFE, // 0x0080 (128) pixels
0xFF, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F, 0x03, 0x01, 0x01, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xF8, // 0x0090 (144) pixels
0xF8, 0xF8, 0xF8, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1F, 0xFF, 0xFF, 0xFF, // 0x00A0 (160) pixels
0xFF, 0xFF, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x7F, 0xFF, // 0x00B0 (176) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, // 0x00C0 (192) pixels
0x07, 0x07, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xF0, 0xF8, 0xFE, 0xFF, // 0x00D0 (208) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, // 0x00E0 (224) pixels
0x07, 0x07, 0x07, 0x3F, 0x3F, 0x3F, 0x3F, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, // 0x00F0 (240) pixels
0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0100 (256) pixels
0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, // 0x0110 (272) pixels
0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFC, 0xFE, 0xFF, 0x7F, 0x7F, 0x3F, 0x3F, // 0x0120 (288) pixels
0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, // 0x0130 (304) pixels
0x7F, 0xFF, 0xFE, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFE, // 0x0140 (320) pixels
0xFE, 0xFF, 0x7F, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0150 (336) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, // 0x0160 (352) pixels
0x00, 0x00, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0x81, 0x81, 0x01, 0x01, 0xC1, 0xC1, 0xC0, 0xC0, // 0x0170 (368) pixels
0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, // 0x0180 (384) pixels
0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC1, 0xC1, 0x01, 0x01, 0xC1, 0xC1, 0xC1, 0x01, 0x01, // 0x0190 (400) pixels
0x01, 0xC1, 0xC1, 0x01, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, // 0x01A0 (416) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xFF, 0x3F, 0x3B, // 0x01B0 (432) pixels
0x3F, 0x7F, 0xFE, 0xF0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x1C, 0x3C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, // 0x01C0 (448) pixels
0xFF, 0xFF, 0xFF, 0xE0, 0xE0, 0xF1, 0x7F, 0x3F, 0x1F, 0x00, 0x3F, 0x7F, 0xFF, 0xE0, 0xC0, 0xE0, // 0x01D0 (464) pixels
0xFF, 0x7F, 0x3F, 0x00, 0x00, 0xE0, 0xE0, 0xFF, 0xFF, 0xFF, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0xFF, // 0x01E0 (480) pixels
0xFF, 0x07, 0x0F, 0x3E, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x3F, 0x7F, 0xFF, 0xE0, 0xC0, 0xE1, 0x7F, // 0x01F0 (496) pixels
0x7F, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char The_End[] ={
0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0x00, // 0x0010 (16) pixels
0x80, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x0020 (32) pixels
0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x0030 (48) pixels
0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0x00, 0x00, // 0x0040 (64) pixels
0x00, 0x00, 0x80, 0xE0, 0xF0, 0xF0, 0x60, 0x40, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, // 0x0050 (80) pixels
0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x81, 0xFC, 0xFF, 0x0F, 0x03, 0x00, 0x00, 0x00, // 0x0060 (96) pixels
0xEE, 0x6F, 0x67, 0xFF, 0xFF, 0x7F, 0x71, 0x30, 0xF0, 0xFF, 0x3F, 0x39, 0x38, 0x18, 0x00, 0x01, // 0x0070 (112) pixels
0x00, 0xF8, 0xFF, 0x1F, 0x0F, 0x0C, 0x0D, 0x8D, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // 0x0080 (128) pixels
0x00, 0xC0, 0xFF, 0x7F, 0x0F, 0x0C, 0x0D, 0x0D, 0x84, 0x80, 0x80, 0x07, 0x07, 0x83, 0xFF, 0xFF, // 0x0090 (144) pixels
0x1F, 0x3F, 0xFE, 0xF8, 0xF8, 0xFE, 0xDF, 0x03, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0x1F, 0x00, // 0x00A0 (160) pixels
0x00, 0x80, 0x81, 0xC3, 0xE7, 0x7F, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x07, 0x03, 0x00, // 0x00B0 (176) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x0F, 0x0F, 0x07, 0x00, // 0x00C0 (192) pixels
0x00, 0x06, 0x06, 0x3F, 0x1F, 0x0F, 0x0F, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x07, 0x03, 0x00, 0x00, // 0x00D0 (208) pixels
0x00, 0x00, 0x06, 0x1F, 0x3F, 0x1F, 0x0F, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x03, 0x00, // 0x00E0 (224) pixels
0x06, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x18, 0x1C, 0x1F, // 0x00F0 (240) pixels
0x0F, 0x07, 0x06, 0x07, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char pacman1[] ={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3E, 0x1C, // 0x0010 (16) pixels
0x0C, 0x00, 0x00, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, // 0x0020 (32) pixels
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x00, 0x00, 0x00,
};
const unsigned char pacman2[] ={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0x7C, // 0x0010 (16) pixels
0x7C, 0x38, 0x20, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, // 0x0020 (32) pixels
0xF9, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00,
};
const unsigned char pacman3[] ={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, // 0x0010 (16) pixels
0xF8, 0xF0, 0xE0, 0x80, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0x0020 (32) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xF9, 0x79, 0x19, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00,
};
const unsigned char pill[] ={
0x0E, 0x1F, 0x1F, 0x1F, 0x0E,
};

View File

@@ -0,0 +1,174 @@
// LCD5110_Graph_Demo
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of most of the functions
// in the library.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins:
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern unsigned char SmallFont[];
extern unsigned char TinyFont[];
extern uint8_t arduino_logo[];
extern uint8_t The_End[];
extern uint8_t pacman1[];
extern uint8_t pacman2[];
extern uint8_t pacman3[];
extern uint8_t pill[];
float y;
uint8_t* bm;
int pacy;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
randomSeed(analogRead(7));
}
void loop()
{
myGLCD.clrScr();
myGLCD.drawBitmap(0, 0, arduino_logo, 84, 48);
myGLCD.update();
delay(2000);
myGLCD.clrScr();
myGLCD.print("LCD5110_Graph", CENTER, 0);
myGLCD.print("DEMO", CENTER, 20);
myGLCD.drawRect(28, 18, 56, 28);
for (int i=0; i<6; i++)
{
myGLCD.drawLine(57, 18+(i*2), 83-(i*3), 18+(i*2));
myGLCD.drawLine((i*3), 28-(i*2), 28, 28-(i*2));
}
myGLCD.setFont(TinyFont);
myGLCD.print("(C)2015 by", CENTER, 36);
myGLCD.print("Henning Karlsen", CENTER, 42);
myGLCD.update();
delay(5000);
myGLCD.clrScr();
for (int i=0; i<48; i+=2)
{
myGLCD.drawLine(0, i, 83, 47-i);
myGLCD.update();
}
for (int i=83; i>=0; i-=2)
{
myGLCD.drawLine(i, 0, 83-i, 47);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
myGLCD.drawRect(0, 0, 83, 47);
for (int i=0; i<48; i+=4)
{
myGLCD.drawLine(0, i, i*1.75, 47);
myGLCD.update();
}
for (int i=0; i<48; i+=4)
{
myGLCD.drawLine(83, 47-i, 83-(i*1.75), 0);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
for (int i=0; i<8; i++)
{
myGLCD.drawRoundRect(i*3, i*3, 83-(i*3), 47-(i*3));
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
for (int i=0; i<17; i++)
{
myGLCD.drawCircle(41, 23, i*3);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
myGLCD.drawRect(0, 0, 83, 47);
myGLCD.drawLine(0, 23, 84, 23);
myGLCD.drawLine(41, 0, 41, 47);
for (int c=0; c<4; c++)
{
for (int i=0; i<84; i++)
{
y=i*0.017453292519943295769236907684886;
myGLCD.invPixel(i, (sin(y*6)*20)+23);
myGLCD.update();
delay(20);
}
}
delay(2000);
for (int pc=0; pc<3; pc++)
{
pacy=random(0, 28);
for (int i=-20; i<84; i++)
{
myGLCD.clrScr();
for (int p=4; p>((i+20)/20); p--)
myGLCD.drawBitmap(p*20-8, pacy+7, pill, 5, 5);
switch(((i+20)/3) % 4)
{
case 0: bm=pacman1;
break;
case 1: bm=pacman2;
break;
case 2: bm=pacman3;
break;
case 3: bm=pacman2;
break;
}
myGLCD.drawBitmap(i, pacy, bm, 20, 20);
myGLCD.update();
delay(25);
}
}
for (int i=0; i<25; i++)
{
myGLCD.clrScr();
myGLCD.drawBitmap(0, i-24, The_End, 84, 24);
myGLCD.update();
delay(100);
}
myGLCD.setFont(SmallFont);
myGLCD.print("Runtime (ms):", CENTER, 32);
myGLCD.printNumI(millis(), CENTER, 40);
myGLCD.update();
for (int i=0; i<5; i++)
{
myGLCD.invert(true);
delay(1000);
myGLCD.invert(false);
delay(1000);
}
}

View File

@@ -0,0 +1,41 @@
// LCD5110_Scrolling_Text
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of how to use print().
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins:
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern unsigned char SmallFont[];
int y;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
randomSeed(analogRead(0));
}
void loop()
{
y = random(0, 40);
for (int i=84; i>=-(34*6); i--)
{
myGLCD.print("LCD5110_Graph Scrolling Text Demo ", i, y);
myGLCD.update();
delay(50);
}
}

View File

@@ -0,0 +1,60 @@
// LCD5110_Sleep_Mode
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of sleep mode.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins using a levelshifter to get the
// correct voltage to the module.
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
void setup()
{
myGLCD.InitLCD();
}
void loop()
{
myGLCD.setFont(SmallFont);
myGLCD.clrScr();
myGLCD.print("Entering", CENTER, 0);
myGLCD.invertText(true);
myGLCD.print(" Sleep Mode ", CENTER, 8);
myGLCD.invertText(false);
myGLCD.print("in", CENTER, 16);
myGLCD.print("seconds", CENTER, 40);
myGLCD.update();
myGLCD.setFont(MediumNumbers);
for (int s=10; s>=0; s--)
{
myGLCD.printNumI(s, CENTER, 24, 2, '0');
myGLCD.update();
delay(1000);
}
myGLCD.enableSleep();
myGLCD.clrScr();
myGLCD.setFont(SmallFont);
myGLCD.print("Awake again!", CENTER, 0);
myGLCD.print("Text has been", CENTER, 16);
myGLCD.print("changed while", CENTER, 24);
myGLCD.print("in Sleep Mode.", CENTER, 32);
delay(5000);
myGLCD.disableSleep();
delay(5000);
}

View File

@@ -0,0 +1,40 @@
// LCD5110_TinyFont_View
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of the tiniest font.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins:
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern unsigned char TinyFont[];
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(TinyFont);
}
void loop()
{
myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0);
myGLCD.print("0123456789:;<=>?", CENTER, 6);
myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 12);
myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 18);
myGLCD.print("`abcdefghijklmno", CENTER, 24);
myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 30);
myGLCD.update();
while (1);
}

View File

@@ -0,0 +1,81 @@
#include <avr/pgmspace.h>
const uint8_t arduino_logo[] PROGMEM={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC, // 0x0010 (16) pixels
0xFE, 0xFE, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFE, // 0x0020 (32) pixels
0xFC, 0xFC, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, // 0x0030 (48) pixels
0xF0, 0xF0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, // 0x0040 (64) pixels
0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xE0, 0xC0, 0x86, 0x06, 0x06, 0x00, // 0x0050 (80) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0x0060 (96) pixels
0x1F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // 0x0070 (112) pixels
0x80, 0x80, 0x00, 0x00, 0x01, 0x01, 0x03, 0x0F, 0x1F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xFE, // 0x0080 (128) pixels
0xFF, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F, 0x03, 0x01, 0x01, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xF8, // 0x0090 (144) pixels
0xF8, 0xF8, 0xF8, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1F, 0xFF, 0xFF, 0xFF, // 0x00A0 (160) pixels
0xFF, 0xFF, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x7F, 0xFF, // 0x00B0 (176) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, // 0x00C0 (192) pixels
0x07, 0x07, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xF0, 0xF8, 0xFE, 0xFF, // 0x00D0 (208) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, // 0x00E0 (224) pixels
0x07, 0x07, 0x07, 0x3F, 0x3F, 0x3F, 0x3F, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, // 0x00F0 (240) pixels
0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0100 (256) pixels
0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, // 0x0110 (272) pixels
0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFC, 0xFE, 0xFF, 0x7F, 0x7F, 0x3F, 0x3F, // 0x0120 (288) pixels
0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, // 0x0130 (304) pixels
0x7F, 0xFF, 0xFE, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFE, // 0x0140 (320) pixels
0xFE, 0xFF, 0x7F, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0150 (336) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, // 0x0160 (352) pixels
0x00, 0x00, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0x81, 0x81, 0x01, 0x01, 0xC1, 0xC1, 0xC0, 0xC0, // 0x0170 (368) pixels
0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, // 0x0180 (384) pixels
0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC1, 0xC1, 0x01, 0x01, 0xC1, 0xC1, 0xC1, 0x01, 0x01, // 0x0190 (400) pixels
0x01, 0xC1, 0xC1, 0x01, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, // 0x01A0 (416) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xFF, 0x3F, 0x3B, // 0x01B0 (432) pixels
0x3F, 0x7F, 0xFE, 0xF0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x1C, 0x3C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, // 0x01C0 (448) pixels
0xFF, 0xFF, 0xFF, 0xE0, 0xE0, 0xF1, 0x7F, 0x3F, 0x1F, 0x00, 0x3F, 0x7F, 0xFF, 0xE0, 0xC0, 0xE0, // 0x01D0 (464) pixels
0xFF, 0x7F, 0x3F, 0x00, 0x00, 0xE0, 0xE0, 0xFF, 0xFF, 0xFF, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0xFF, // 0x01E0 (480) pixels
0xFF, 0x07, 0x0F, 0x3E, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x3F, 0x7F, 0xFF, 0xE0, 0xC0, 0xE1, 0x7F, // 0x01F0 (496) pixels
0x7F, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t The_End[] PROGMEM={
0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0x00, // 0x0010 (16) pixels
0x80, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x0020 (32) pixels
0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x0030 (48) pixels
0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0x00, 0x00, // 0x0040 (64) pixels
0x00, 0x00, 0x80, 0xE0, 0xF0, 0xF0, 0x60, 0x40, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, // 0x0050 (80) pixels
0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x81, 0xFC, 0xFF, 0x0F, 0x03, 0x00, 0x00, 0x00, // 0x0060 (96) pixels
0xEE, 0x6F, 0x67, 0xFF, 0xFF, 0x7F, 0x71, 0x30, 0xF0, 0xFF, 0x3F, 0x39, 0x38, 0x18, 0x00, 0x01, // 0x0070 (112) pixels
0x00, 0xF8, 0xFF, 0x1F, 0x0F, 0x0C, 0x0D, 0x8D, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // 0x0080 (128) pixels
0x00, 0xC0, 0xFF, 0x7F, 0x0F, 0x0C, 0x0D, 0x0D, 0x84, 0x80, 0x80, 0x07, 0x07, 0x83, 0xFF, 0xFF, // 0x0090 (144) pixels
0x1F, 0x3F, 0xFE, 0xF8, 0xF8, 0xFE, 0xDF, 0x03, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0x1F, 0x00, // 0x00A0 (160) pixels
0x00, 0x80, 0x81, 0xC3, 0xE7, 0x7F, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x07, 0x03, 0x00, // 0x00B0 (176) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x0F, 0x0F, 0x07, 0x00, // 0x00C0 (192) pixels
0x00, 0x06, 0x06, 0x3F, 0x1F, 0x0F, 0x0F, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x07, 0x03, 0x00, 0x00, // 0x00D0 (208) pixels
0x00, 0x00, 0x06, 0x1F, 0x3F, 0x1F, 0x0F, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x03, 0x00, // 0x00E0 (224) pixels
0x06, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x18, 0x1C, 0x1F, // 0x00F0 (240) pixels
0x0F, 0x07, 0x06, 0x07, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t pacman1[] PROGMEM={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3E, 0x1C, // 0x0010 (16) pixels
0x0C, 0x00, 0x00, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, // 0x0020 (32) pixels
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x00, 0x00, 0x00,
};
const uint8_t pacman2[] PROGMEM={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0x7C, // 0x0010 (16) pixels
0x7C, 0x38, 0x20, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, // 0x0020 (32) pixels
0xF9, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00,
};
const uint8_t pacman3[] PROGMEM={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, // 0x0010 (16) pixels
0xF8, 0xF0, 0xE0, 0x80, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0x0020 (32) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xF9, 0x79, 0x19, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00,
};
const uint8_t pill[] PROGMEM={
0x0E, 0x1F, 0x1F, 0x1F, 0x0E,
};

View File

@@ -0,0 +1,175 @@
// LCD5110_Graph_Demo
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of most of the functions
// in the library.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins using a levelshifter to get the
// correct voltage to the module.
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t SmallFont[];
extern uint8_t arduino_logo[];
extern unsigned char TinyFont[];
extern uint8_t The_End[];
extern uint8_t pacman1[];
extern uint8_t pacman2[];
extern uint8_t pacman3[];
extern uint8_t pill[];
float y;
uint8_t* bm;
int pacy;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
randomSeed(analogRead(7));
}
void loop()
{
myGLCD.clrScr();
myGLCD.drawBitmap(0, 0, arduino_logo, 84, 48);
myGLCD.update();
delay(2000);
myGLCD.clrScr();
myGLCD.print("LCD5110_Graph", CENTER, 0);
myGLCD.print("DEMO", CENTER, 20);
myGLCD.drawRect(28, 18, 56, 28);
for (int i=0; i<6; i++)
{
myGLCD.drawLine(57, 18+(i*2), 83-(i*3), 18+(i*2));
myGLCD.drawLine((i*3), 28-(i*2), 28, 28-(i*2));
}
myGLCD.setFont(TinyFont);
myGLCD.print("(C)2015 by", CENTER, 36);
myGLCD.print("Henning Karlsen", CENTER, 42);
myGLCD.update();
delay(5000);
myGLCD.clrScr();
for (int i=0; i<48; i+=2)
{
myGLCD.drawLine(0, i, 83, 47-i);
myGLCD.update();
}
for (int i=83; i>=0; i-=2)
{
myGLCD.drawLine(i, 0, 83-i, 47);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
myGLCD.drawRect(0, 0, 83, 47);
for (int i=0; i<48; i+=4)
{
myGLCD.drawLine(0, i, i*1.75, 47);
myGLCD.update();
}
for (int i=0; i<48; i+=4)
{
myGLCD.drawLine(83, 47-i, 83-(i*1.75), 0);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
for (int i=0; i<8; i++)
{
myGLCD.drawRoundRect(i*3, i*3, 83-(i*3), 47-(i*3));
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
for (int i=0; i<17; i++)
{
myGLCD.drawCircle(41, 23, i*3);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
myGLCD.drawRect(0, 0, 83, 47);
myGLCD.drawLine(0, 23, 84, 23);
myGLCD.drawLine(41, 0, 41, 47);
for (int c=0; c<4; c++)
{
for (int i=0; i<84; i++)
{
y=i*0.017453292519943295769236907684886;
myGLCD.invPixel(i, (sin(y*6)*20)+23);
myGLCD.update();
delay(20);
}
}
delay(2000);
for (int pc=0; pc<3; pc++)
{
pacy=random(0, 28);
for (int i=-20; i<84; i++)
{
myGLCD.clrScr();
for (int p=4; p>((i+20)/20); p--)
myGLCD.drawBitmap(p*20-8, pacy+7, pill, 5, 5);
switch(((i+20)/3) % 4)
{
case 0: bm=pacman1;
break;
case 1: bm=pacman2;
break;
case 2: bm=pacman3;
break;
case 3: bm=pacman2;
break;
}
myGLCD.drawBitmap(i, pacy, bm, 20, 20);
myGLCD.update();
delay(25);
}
}
for (int i=0; i<25; i++)
{
myGLCD.clrScr();
myGLCD.drawBitmap(0, i-24, The_End, 84, 24);
myGLCD.update();
delay(100);
}
myGLCD.setFont(SmallFont);
myGLCD.print("Runtime (ms):", CENTER, 32);
myGLCD.printNumI(millis(), CENTER, 40);
myGLCD.update();
for (int i=0; i<5; i++)
{
myGLCD.invert(true);
delay(1000);
myGLCD.invert(false);
delay(1000);
}
}

View File

@@ -0,0 +1,42 @@
// LCD5110_Scrolling_Text
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of how to use print().
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins using a levelshifter to get the
// correct voltage to the module.
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t SmallFont[];
int y;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
randomSeed(analogRead(0));
}
void loop()
{
y = random(0, 40);
for (int i=84; i>=-(34*6); i--)
{
myGLCD.print("LCD5110_Graph Scrolling Text Demo ", i, y);
myGLCD.update();
delay(50);
}
}

View File

@@ -0,0 +1,58 @@
// LCD5110_Sleep_Mode
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of sleep mode.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins using a levelshifter to get the
// correct voltage to the module.
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
void setup()
{
myGLCD.InitLCD();
}
void loop()
{
myGLCD.setFont(SmallFont);
myGLCD.clrScr();
myGLCD.print("Entering", CENTER, 0);
myGLCD.print("Sleep Mode", CENTER, 8);
myGLCD.print("in", CENTER, 16);
myGLCD.print("Seconds", CENTER, 40);
myGLCD.update();
myGLCD.setFont(MediumNumbers);
for (int s=10; s>=0; s--)
{
myGLCD.printNumI(s, CENTER, 24, 2, '0');
myGLCD.update();
delay(1000);
}
myGLCD.enableSleep();
myGLCD.clrScr();
myGLCD.setFont(SmallFont);
myGLCD.print("Awake again!", CENTER, 0);
myGLCD.print("Text has been", CENTER, 16);
myGLCD.print("changed while", CENTER, 24);
myGLCD.print("in Sleep Mode.", CENTER, 32);
delay(5000);
myGLCD.disableSleep();
delay(5000);
}

View File

@@ -0,0 +1,41 @@
// LCD5110_TinyFont_View
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of the tiniest font.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins using a levelshifter to get the
// correct voltage to the module.
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t TinyFont[];
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(TinyFont);
}
void loop()
{
myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0);
myGLCD.print("0123456789:;<=>?", CENTER, 6);
myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 12);
myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 18);
myGLCD.print("`abcdefghijklmno", CENTER, 24);
myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 30);
myGLCD.update();
while (1);
}

View File

@@ -0,0 +1,68 @@
const unsigned char ck_logo[] ={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF0, 0xE0, 0x00, // 0x0010 (16) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, // 0x0020 (32) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, // 0x0030 (48) pixels
0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x40, 0x00, 0xC0, // 0x0040 (64) pixels
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, // 0x0050 (80) pixels
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xF0, 0xF0, 0x38, 0x3C, 0x1C, 0x1C, 0x1C, 0x1C, 0x18, 0x00, 0x00, // 0x0060 (96) pixels
0xFF, 0xFF, 0xFF, 0x38, 0x18, 0x1C, 0x1C, 0x3C, 0xF8, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0xF9, 0xFD, // 0x0070 (112) pixels
0xFD, 0x00, 0x00, 0x00, 0xF8, 0xFC, 0xF0, 0x70, 0x18, 0x1C, 0x1C, 0x1C, 0x38, 0xF8, 0xF0, 0xE0, // 0x0080 (128) pixels
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x07, // 0x0090 (144) pixels
0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, // 0x00A0 (160) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x1F, 0x7F, 0xF9, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, // 0x00B0 (176) pixels
0xC0, 0xC0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, // 0x00C0 (192) pixels
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, // 0x00D0 (208) pixels
0xE0, 0xF8, 0x7F, 0x3F, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x07, 0x1F, 0xFF, // 0x00E0 (224) pixels
0xFF, 0xFF, 0xFF, 0xFC, 0xE0, 0x80, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, // 0x00F0 (240) pixels
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0100 (256) pixels
0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0110 (272) pixels
0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x00, // 0x0120 (288) pixels
0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, // 0x0130 (304) pixels
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, // 0x0140 (320) pixels
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, // 0x0150 (336) pixels
};
const unsigned char The_End[] ={
0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0x00, // 0x0010 (16) pixels
0x80, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x0020 (32) pixels
0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x0030 (48) pixels
0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0x00, 0x00, // 0x0040 (64) pixels
0x00, 0x00, 0x80, 0xE0, 0xF0, 0xF0, 0x60, 0x40, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, // 0x0050 (80) pixels
0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x81, 0xFC, 0xFF, 0x0F, 0x03, 0x00, 0x00, 0x00, // 0x0060 (96) pixels
0xEE, 0x6F, 0x67, 0xFF, 0xFF, 0x7F, 0x71, 0x30, 0xF0, 0xFF, 0x3F, 0x39, 0x38, 0x18, 0x00, 0x01, // 0x0070 (112) pixels
0x00, 0xF8, 0xFF, 0x1F, 0x0F, 0x0C, 0x0D, 0x8D, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // 0x0080 (128) pixels
0x00, 0xC0, 0xFF, 0x7F, 0x0F, 0x0C, 0x0D, 0x0D, 0x84, 0x80, 0x80, 0x07, 0x07, 0x83, 0xFF, 0xFF, // 0x0090 (144) pixels
0x1F, 0x3F, 0xFE, 0xF8, 0xF8, 0xFE, 0xDF, 0x03, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0x1F, 0x00, // 0x00A0 (160) pixels
0x00, 0x80, 0x81, 0xC3, 0xE7, 0x7F, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x07, 0x03, 0x00, // 0x00B0 (176) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x0F, 0x0F, 0x07, 0x00, // 0x00C0 (192) pixels
0x00, 0x06, 0x06, 0x3F, 0x1F, 0x0F, 0x0F, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x07, 0x03, 0x00, 0x00, // 0x00D0 (208) pixels
0x00, 0x00, 0x06, 0x1F, 0x3F, 0x1F, 0x0F, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x03, 0x00, // 0x00E0 (224) pixels
0x06, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x18, 0x1C, 0x1F, // 0x00F0 (240) pixels
0x0F, 0x07, 0x06, 0x07, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char pacman1[] ={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3E, 0x1C, // 0x0010 (16) pixels
0x0C, 0x00, 0x00, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, // 0x0020 (32) pixels
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x00, 0x00, 0x00,
};
const unsigned char pacman2[] ={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0x7C, // 0x0010 (16) pixels
0x7C, 0x38, 0x20, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, // 0x0020 (32) pixels
0xF9, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00,
};
const unsigned char pacman3[] ={
0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, // 0x0010 (16) pixels
0xF8, 0xF0, 0xE0, 0x80, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0x0020 (32) pixels
0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xF9, 0x79, 0x19, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, // 0x0030 (48) pixels
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00,
};
const unsigned char pill[] ={
0x0E, 0x1F, 0x1F, 0x1F, 0x0E,
};

View File

@@ -0,0 +1,174 @@
// LCD5110_Graph_Demo
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of most of the functions
// in the library.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins:
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern unsigned char SmallFont[];
extern unsigned char TinyFont[];
extern uint8_t ck_logo[];
extern uint8_t The_End[];
extern uint8_t pacman1[];
extern uint8_t pacman2[];
extern uint8_t pacman3[];
extern uint8_t pill[];
float y;
uint8_t* bm;
int pacy;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
randomSeed(analogRead(7));
}
void loop()
{
myGLCD.clrScr();
myGLCD.drawBitmap(0, 8, ck_logo, 84, 32);
myGLCD.update();
delay(2000);
myGLCD.clrScr();
myGLCD.print("LCD5110_Graph", CENTER, 0);
myGLCD.print("DEMO", CENTER, 20);
myGLCD.drawRect(28, 18, 56, 28);
for (int i=0; i<6; i++)
{
myGLCD.drawLine(57, 18+(i*2), 83-(i*3), 18+(i*2));
myGLCD.drawLine((i*3), 28-(i*2), 28, 28-(i*2));
}
myGLCD.setFont(TinyFont);
myGLCD.print("(C)2015 by", CENTER, 36);
myGLCD.print("Henning Karlsen", CENTER, 42);
myGLCD.update();
delay(5000);
myGLCD.clrScr();
for (int i=0; i<48; i+=2)
{
myGLCD.drawLine(0, i, 83, 47-i);
myGLCD.update();
}
for (int i=83; i>=0; i-=2)
{
myGLCD.drawLine(i, 0, 83-i, 47);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
myGLCD.drawRect(0, 0, 83, 47);
for (int i=0; i<48; i+=4)
{
myGLCD.drawLine(0, i, i*1.75, 47);
myGLCD.update();
}
for (int i=0; i<48; i+=4)
{
myGLCD.drawLine(83, 47-i, 83-(i*1.75), 0);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
for (int i=0; i<8; i++)
{
myGLCD.drawRoundRect(i*3, i*3, 83-(i*3), 47-(i*3));
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
for (int i=0; i<17; i++)
{
myGLCD.drawCircle(41, 23, i*3);
myGLCD.update();
}
delay(2000);
myGLCD.clrScr();
myGLCD.drawRect(0, 0, 83, 47);
myGLCD.drawLine(0, 23, 84, 23);
myGLCD.drawLine(41, 0, 41, 47);
for (int c=0; c<4; c++)
{
for (int i=0; i<84; i++)
{
y=i*0.017453292519943295769236907684886;
myGLCD.invPixel(i, (sin(y*6)*20)+23);
myGLCD.update();
delay(20);
}
}
delay(2000);
for (int pc=0; pc<3; pc++)
{
pacy=random(0, 28);
for (int i=-20; i<84; i++)
{
myGLCD.clrScr();
for (int p=4; p>((i+20)/20); p--)
myGLCD.drawBitmap(p*20-8, pacy+7, pill, 5, 5);
switch(((i+20)/3) % 4)
{
case 0: bm=pacman1;
break;
case 1: bm=pacman2;
break;
case 2: bm=pacman3;
break;
case 3: bm=pacman2;
break;
}
myGLCD.drawBitmap(i, pacy, bm, 20, 20);
myGLCD.update();
delay(25);
}
}
for (int i=0; i<25; i++)
{
myGLCD.clrScr();
myGLCD.drawBitmap(0, i-24, The_End, 84, 24);
myGLCD.update();
delay(100);
}
myGLCD.setFont(SmallFont);
myGLCD.print("Runtime (ms):", CENTER, 32);
myGLCD.printNumI(millis(), CENTER, 40);
myGLCD.update();
for (int i=0; i<5; i++)
{
myGLCD.invert(true);
delay(1000);
myGLCD.invert(false);
delay(1000);
}
}

View File

@@ -0,0 +1,41 @@
// LCD5110_Scrolling_Text
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of how to use print().
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins:
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern unsigned char SmallFont[];
int y;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
randomSeed(analogRead(0));
}
void loop()
{
y = random(0, 40);
for (int i=84; i>=-(34*6); i--)
{
myGLCD.print("LCD5110_Graph Scrolling Text Demo ", i, y);
myGLCD.update();
delay(50);
}
}

View File

@@ -0,0 +1,58 @@
// LCD5110_Sleep_Mode
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of sleep mode.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins using a levelshifter to get the
// correct voltage to the module.
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
void setup()
{
myGLCD.InitLCD();
}
void loop()
{
myGLCD.setFont(SmallFont);
myGLCD.clrScr();
myGLCD.print("Entering", CENTER, 0);
myGLCD.print("Sleep Mode", CENTER, 8);
myGLCD.print("in", CENTER, 16);
myGLCD.print("Seconds", CENTER, 40);
myGLCD.update();
myGLCD.setFont(MediumNumbers);
for (int s=10; s>=0; s--)
{
myGLCD.printNumI(s, CENTER, 24, 2, '0');
myGLCD.update();
delay(1000);
}
myGLCD.enableSleep();
myGLCD.clrScr();
myGLCD.setFont(SmallFont);
myGLCD.print("Awake again!", CENTER, 0);
myGLCD.print("Text has been", CENTER, 16);
myGLCD.print("changed while", CENTER, 24);
myGLCD.print("in Sleep Mode.", CENTER, 32);
delay(5000);
myGLCD.disableSleep();
delay(5000);
}

View File

@@ -0,0 +1,40 @@
// LCD5110_TinyFont_View
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of the tiniest font.
//
// This program requires a Nokia 5110 LCD module.
//
// It is assumed that the LCD module is connected to
// the following pins:
// SCK - Pin 8
// MOSI - Pin 9
// DC - Pin 10
// RST - Pin 11
// CS - Pin 12
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(8,9,10,11,12);
extern unsigned char TinyFont[];
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(TinyFont);
}
void loop()
{
myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0);
myGLCD.print("0123456789:;<=>?", CENTER, 6);
myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 12);
myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 18);
myGLCD.print("`abcdefghijklmno", CENTER, 24);
myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 30);
myGLCD.update();
while (1);
}

View File

@@ -0,0 +1,7 @@
void LCD5110::_convert_float(char *buf, double num, int width, byte prec)
{
char format[10];
sprintf(format, "%%%i.%if", width, prec);
sprintf(buf, format, num);
}

View File

@@ -0,0 +1,12 @@
// *** Hardwarespecific defines ***
#define cbi(reg, bitmask) *reg &= ~bitmask
#define sbi(reg, bitmask) *reg |= bitmask
#define pulseClock cbi(P_SCK, B_SCK); asm ("nop"); sbi(P_SCK, B_SCK)
#define resetLCD sbi(P_DC, B_DC); sbi(P_MOSI, B_MOSI); sbi(P_SCK, B_SCK); sbi(P_CS, B_CS); digitalWrite(RST_Pin, LOW); digitalWrite(RST_Pin, HIGH)
#define fontbyte(x) cfont.font[x]
#define bitmapbyte(x) bitmap[x]
#define regtype volatile uint32_t
#define regsize volatile uint32_t
#define bitmapdatatype unsigned char*

View File

@@ -0,0 +1,4 @@
void LCD5110::_convert_float(char *buf, double num, int width, byte prec)
{
dtostrf(num, width, prec, buf);
}

View File

@@ -0,0 +1,12 @@
// *** Hardwarespecific defines ***
#define cbi(reg, bitmask) *reg &= ~bitmask
#define sbi(reg, bitmask) *reg |= bitmask
#define pulseClock cbi(P_SCK, B_SCK); asm ("nop"); sbi(P_SCK, B_SCK)
#define resetLCD sbi(P_DC, B_DC); sbi(P_MOSI, B_MOSI); sbi(P_SCK, B_SCK); sbi(P_CS, B_CS); cbi(P_RST, B_RST); delay(10); sbi(P_RST, B_RST)
#define fontbyte(x) pgm_read_byte(&cfont.font[x])
#define bitmapbyte(x) pgm_read_byte(&bitmap[x])
#define regtype volatile uint8_t
#define regsize volatile uint8_t
#define bitmapdatatype uint8_t*

View File

@@ -0,0 +1,7 @@
void LCD5110::_convert_float(char *buf, double num, int width, byte prec)
{
char format[10];
sprintf(format, "%%%i.%if", width, prec);
sprintf(buf, format, num);
}

View File

@@ -0,0 +1,13 @@
// *** Hardwarespecific defines ***
#define cbi(reg, bitmask) (*(reg + 1)) = bitmask
#define sbi(reg, bitmask) (*(reg + 2)) = bitmask
#define pulseClock digitalWrite(SCK_Pin, LOW); digitalWrite(SCK_Pin, HIGH)
#define resetLCD sbi(P_DC, B_DC); sbi(P_MOSI, B_MOSI); sbi(P_SCK, B_SCK); sbi(P_CS, B_CS); cbi(P_RST, B_RST); delay(10); sbi(P_RST, B_RST)
#define fontbyte(x) cfont.font[x]
#define bitmapbyte(x) bitmap[x]
#define PROGMEM
#define regtype volatile uint32_t
#define regsize volatile uint16_t
#define bitmapdatatype unsigned char*

View File

@@ -0,0 +1,31 @@
LCD5110 KEYWORD1
InitLCD KEYWORD2
setContrast KEYWORD2
enableSleep KEYWORD2
disableSleep KEYWORD2
update KEYWORD2
clrScr KEYWORD2
fillScr KEYWORD2
invert KEYWORD2
setPixel KEYWORD2
clrPixel KEYWORD2
invPixel KEYWORD2
invertText KEYWORD2
print KEYWORD2
printNumI KEYWORD2
printNumF KEYWORD2
setFont KEYWORD2
drawBitmap KEYWORD2
drawLine KEYWORD2
clrLine KEYWORD2
drawRect KEYWORD2
clrRect KEYWORD2
drawRoundRect KEYWORD2
clrRoundRect KEYWORD2
drawCircle KEYWORD2
clrCircle KEYWORD2
LEFT LITERAL1
RIGHT LITERAL1
CENTER LITERAL1