initial commit
This commit is contained in:
commit
0f88ee5d81
399
fonts.c
Executable file
399
fonts.c
Executable file
@ -0,0 +1,399 @@
|
||||
#include "fonts.h"
|
||||
|
||||
#ifdef ASCII_8X16_MS_Gothic
|
||||
static unsigned char const AsciiLib[95][16] = {
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
|
||||
|
||||
{0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00},/*"!",1*/
|
||||
|
||||
{0x36,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
|
||||
|
||||
{0x00,0x24,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0x48,0xFC,0x48,0x48,0x48,0x48,0x00},/*"#",3*/
|
||||
|
||||
{0x10,0x38,0x54,0x92,0x92,0x50,0x30,0x18,0x14,0x12,0x92,0x92,0x54,0x38,0x10,0x00},/*"$",4*/
|
||||
|
||||
{0x00,0x62,0x92,0x94,0x94,0x68,0x08,0x10,0x20,0x2C,0x52,0x52,0x92,0x8C,0x00,0x00},/*"%",5*/
|
||||
|
||||
{0x00,0x30,0x48,0x48,0x48,0x48,0x30,0x20,0x54,0x94,0x88,0x88,0x94,0x62,0x00,0x00},/*"&",6*/
|
||||
|
||||
{0x30,0x30,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
|
||||
|
||||
{0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x00},/*"(",8*/
|
||||
|
||||
{0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00},/*")",9*/
|
||||
|
||||
{0x00,0x00,0x00,0x10,0x92,0x54,0x38,0x10,0x38,0x54,0x92,0x10,0x00,0x00,0x00,0x00},/*"*",10*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00},/*"+",11*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x10,0x20,0x00},/*",",12*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00},/*".",14*/
|
||||
|
||||
{0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00},/*"/",15*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x48,0x30,0x00,0x00},/*"0",16*/
|
||||
|
||||
{0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"1",17*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x04,0x08,0x08,0x10,0x20,0x20,0x40,0x80,0xFC,0x00,0x00},/*"2",18*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x04,0x08,0x30,0x08,0x04,0x84,0x84,0x48,0x30,0x00,0x00},/*"3",19*/
|
||||
|
||||
{0x00,0x08,0x08,0x18,0x18,0x28,0x28,0x48,0x48,0x88,0xFC,0x08,0x08,0x08,0x00,0x00},/*"4",20*/
|
||||
|
||||
{0x00,0xFC,0x80,0x80,0x80,0xB0,0xC8,0x84,0x04,0x04,0x04,0x84,0x48,0x30,0x00,0x00},/*"5",21*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x80,0xB0,0xC8,0x84,0x84,0x84,0x84,0x48,0x30,0x00,0x00},/*"6",22*/
|
||||
|
||||
{0x00,0xFC,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x00,0x00},/*"7",23*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x84,0x48,0x30,0x48,0x84,0x84,0x84,0x48,0x30,0x00,0x00},/*"8",24*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x4C,0x34,0x04,0x84,0x84,0x48,0x30,0x00,0x00},/*"9",25*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00},/*":",26*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x10,0x20,0x00},/*";",27*/
|
||||
|
||||
{0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00},/*"<",28*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
|
||||
|
||||
{0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00},/*">",30*/
|
||||
|
||||
{0x00,0x30,0x48,0x84,0x84,0x04,0x08,0x10,0x20,0x20,0x00,0x00,0x30,0x30,0x00,0x00},/*"?",31*/
|
||||
|
||||
{0x00,0x38,0x44,0x82,0x9A,0xAA,0xAA,0xAA,0xAA,0xAA,0x9C,0x80,0x42,0x3C,0x00,0x00},/*"@",32*/
|
||||
|
||||
{0x00,0x10,0x10,0x28,0x28,0x28,0x28,0x44,0x44,0x44,0x7C,0x82,0x82,0x82,0x00,0x00},/*"A",33*/
|
||||
|
||||
{0x00,0xF8,0x84,0x82,0x82,0x82,0x84,0xF8,0x84,0x82,0x82,0x82,0x84,0xF8,0x00,0x00},/*"B",34*/
|
||||
|
||||
{0x00,0x38,0x44,0x82,0x82,0x80,0x80,0x80,0x80,0x80,0x82,0x82,0x44,0x38,0x00,0x00},/*"C",35*/
|
||||
|
||||
{0x00,0xF8,0x84,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x84,0xF8,0x00,0x00},/*"D",36*/
|
||||
|
||||
{0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00},/*"E",37*/
|
||||
|
||||
{0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00},/*"F",38*/
|
||||
|
||||
{0x00,0x38,0x44,0x82,0x82,0x80,0x80,0x80,0x8E,0x82,0x82,0x82,0x46,0x3A,0x00,0x00},/*"G",39*/
|
||||
|
||||
{0x00,0x82,0x82,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x82,0x82,0x82,0x00,0x00},/*"H",40*/
|
||||
|
||||
{0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00},/*"I",41*/
|
||||
|
||||
{0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x84,0x84,0x48,0x30,0x00,0x00},/*"J",42*/
|
||||
|
||||
{0x00,0x82,0x84,0x84,0x88,0x90,0x90,0xA0,0xD0,0x88,0x88,0x84,0x82,0x82,0x00,0x00},/*"K",43*/
|
||||
|
||||
{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00},/*"L",44*/
|
||||
|
||||
{0x00,0x82,0x82,0xC6,0xC6,0xC6,0xC6,0xAA,0xAA,0xAA,0xAA,0x92,0x92,0x92,0x00,0x00},/*"M",45*/
|
||||
|
||||
{0x00,0x82,0x82,0xC2,0xC2,0xA2,0xA2,0x92,0x92,0x8A,0x8A,0x86,0x86,0x82,0x00,0x00},/*"N",46*/
|
||||
|
||||
{0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00},/*"O",47*/
|
||||
|
||||
{0x00,0xF8,0x84,0x82,0x82,0x82,0x84,0xF8,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00},/*"P",48*/
|
||||
|
||||
{0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x92,0x8A,0x44,0x3A,0x00,0x00},/*"Q",49*/
|
||||
|
||||
{0x00,0xF8,0x84,0x82,0x82,0x82,0x84,0xF8,0x88,0x88,0x84,0x84,0x82,0x82,0x00,0x00},/*"R",50*/
|
||||
|
||||
{0x00,0x38,0x44,0x82,0x82,0x80,0x60,0x18,0x04,0x02,0x82,0x82,0x44,0x38,0x00,0x00},/*"S",51*/
|
||||
|
||||
{0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"T",52*/
|
||||
|
||||
{0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00},/*"U",53*/
|
||||
|
||||
{0x00,0x82,0x82,0x82,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x00,0x00},/*"V",54*/
|
||||
|
||||
{0x00,0x92,0x92,0x92,0x92,0xAA,0xAA,0xAA,0xAA,0x44,0x44,0x44,0x44,0x44,0x00,0x00},/*"W",55*/
|
||||
|
||||
{0x00,0x82,0x82,0x44,0x44,0x28,0x28,0x10,0x28,0x28,0x44,0x44,0x82,0x82,0x00,0x00},/*"X",56*/
|
||||
|
||||
{0x00,0x82,0x82,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"Y",57*/
|
||||
|
||||
{0x00,0xFE,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x20,0x40,0x40,0x80,0xFE,0x00,0x00},/*"Z",58*/
|
||||
|
||||
{0x7C,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00},/*"[",59*/
|
||||
|
||||
{0x00,0x82,0x82,0x44,0x44,0x28,0x28,0x7C,0x10,0x10,0x7C,0x10,0x10,0x10,0x00,0x00},/*"\",60*/
|
||||
|
||||
{0x7C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x7C,0x00},/*"]",61*/
|
||||
|
||||
{0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF},/*"_",63*/
|
||||
|
||||
{0x30,0x30,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",64*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x84,0x04,0x3C,0x44,0x84,0x8C,0x76,0x00,0x00},/*"a",65*/
|
||||
|
||||
{0x00,0x80,0x80,0x80,0x80,0x80,0xB8,0xC4,0x82,0x82,0x82,0x82,0xC4,0xB8,0x00,0x00},/*"b",66*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x80,0x80,0x80,0x80,0x42,0x3C,0x00,0x00},/*"c",67*/
|
||||
|
||||
{0x00,0x02,0x02,0x02,0x02,0x02,0x3A,0x46,0x82,0x82,0x82,0x82,0x46,0x3A,0x00,0x00},/*"d",68*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x82,0xFE,0x80,0x80,0x42,0x3C,0x00,0x00},/*"e",69*/
|
||||
|
||||
{0x00,0x18,0x20,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00},/*"f",70*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x3A,0x44,0x44,0x38,0x40,0x7C,0x82,0x82,0x7C,0x00},/*"g",71*/
|
||||
|
||||
{0x00,0x80,0x80,0x80,0x80,0x80,0xB8,0xC4,0x82,0x82,0x82,0x82,0x82,0x82,0x00,0x00},/*"h",72*/
|
||||
|
||||
{0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"i",73*/
|
||||
|
||||
{0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x60,0x00},/*"j",74*/
|
||||
|
||||
{0x00,0x80,0x80,0x80,0x80,0x80,0x84,0x88,0x90,0xA0,0xD0,0x88,0x84,0x82,0x00,0x00},/*"k",75*/
|
||||
|
||||
{0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"l",76*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0xAC,0xD2,0x92,0x92,0x92,0x92,0x92,0x92,0x00,0x00},/*"m",77*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0xC4,0x82,0x82,0x82,0x82,0x82,0x82,0x00,0x00},/*"n",78*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00},/*"o",79*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0xC4,0x82,0x82,0x82,0xC4,0xB8,0x80,0x80,0x00},/*"p",80*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x3A,0x46,0x82,0x82,0x82,0x46,0x3A,0x02,0x02,0x00},/*"q",81*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x2E,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00},/*"r",82*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x82,0x80,0x60,0x1C,0x02,0x82,0x7C,0x00,0x00},/*"s",83*/
|
||||
|
||||
{0x00,0x00,0x20,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00},/*"t",84*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x46,0x3A,0x00,0x00},/*"u",85*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00},/*"v",86*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x92,0x92,0xAA,0xAA,0x44,0x44,0x44,0x00,0x00},/*"w",87*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x44,0x28,0x10,0x10,0x28,0x44,0x82,0x00,0x00},/*"x",88*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x44,0x44,0x28,0x28,0x10,0x20,0xC0,0x00},/*"y",89*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x04,0x08,0x10,0x20,0x40,0x80,0xFE,0x00,0x00},/*"z",90*/
|
||||
|
||||
{0x1C,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x1C,0x00},/*"{",91*/
|
||||
|
||||
{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10},/*"|",92*/
|
||||
|
||||
{0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00},/*"}",93*/
|
||||
|
||||
{0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ASCII_8X16_System
|
||||
static unsigned char const AsciiLib[95][16] = {
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
|
||||
|
||||
{0x00,0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00},/*"!",1*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
|
||||
|
||||
{0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00},/*"#",3*/
|
||||
|
||||
{0x00,0x18,0x18,0x3C,0x66,0x60,0x30,0x18,0x0C,0x06,0x66,0x3C,0x18,0x18,0x00,0x00},/*"$",4*/
|
||||
|
||||
{0x00,0x00,0x70,0xD8,0xDA,0x76,0x0C,0x18,0x30,0x6E,0x5B,0x1B,0x0E,0x00,0x00,0x00},/*"%",5*/
|
||||
|
||||
{0x00,0x00,0x00,0x38,0x6C,0x6C,0x38,0x60,0x6F,0x66,0x66,0x3B,0x00,0x00,0x00,0x00},/*"&",6*/
|
||||
|
||||
{0x00,0x00,0x00,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
|
||||
|
||||
{0x00,0x00,0x00,0x0C,0x18,0x18,0x30,0x30,0x30,0x30,0x30,0x18,0x18,0x0C,0x00,0x00},/*"(",8*/
|
||||
|
||||
{0x00,0x00,0x00,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x00,0x00},/*")",9*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x36,0x1C,0x7F,0x1C,0x36,0x00,0x00,0x00,0x00,0x00,0x00},/*"*",10*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00},/*"+",11*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x0C,0x18,0x00,0x00},/*",",12*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00},/*".",14*/
|
||||
|
||||
{0x00,0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00,0x00},/*"/",15*/
|
||||
|
||||
{0x00,0x00,0x00,0x1E,0x33,0x37,0x37,0x33,0x3B,0x3B,0x33,0x1E,0x00,0x00,0x00,0x00},/*"0",16*/
|
||||
|
||||
{0x00,0x00,0x00,0x0C,0x1C,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x00,0x00,0x00,0x00},/*"1",17*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00,0x00},/*"2",18*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x06,0x1C,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"3",19*/
|
||||
|
||||
{0x00,0x00,0x00,0x30,0x30,0x36,0x36,0x36,0x66,0x7F,0x06,0x06,0x00,0x00,0x00,0x00},/*"4",20*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7C,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00},/*"5",21*/
|
||||
|
||||
{0x00,0x00,0x00,0x1C,0x18,0x30,0x7C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"6",22*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x30,0x00,0x00,0x00,0x00},/*"7",23*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x76,0x3C,0x6E,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"8",24*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3E,0x0C,0x18,0x38,0x00,0x00,0x00,0x00},/*"9",25*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00},/*":",26*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x1C,0x1C,0x0C,0x18,0x00,0x00},/*";",27*/
|
||||
|
||||
{0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00},/*"<",28*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
|
||||
|
||||
{0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00},/*">",30*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x0C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00},/*"?",31*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0xC3,0xC3,0xCF,0xDB,0xDB,0xCF,0xC0,0x7F,0x00,0x00,0x00,0x00},/*"@",32*/
|
||||
|
||||
{0x00,0x00,0x00,0x18,0x3C,0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x00,0x00,0x00,0x00},/*"A",33*/
|
||||
|
||||
{0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00},/*"B",34*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x60,0x60,0x60,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"C",35*/
|
||||
|
||||
{0x00,0x00,0x00,0x78,0x6C,0x66,0x66,0x66,0x66,0x66,0x6C,0x78,0x00,0x00,0x00,0x00},/*"D",36*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7C,0x60,0x60,0x60,0x7E,0x00,0x00,0x00,0x00},/*"E",37*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7C,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00},/*"F",38*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x60,0x60,0x6E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00},/*"G",39*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00},/*"H",40*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00},/*"I",41*/
|
||||
|
||||
{0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"J",42*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x6C,0x6C,0x78,0x6C,0x6C,0x66,0x66,0x00,0x00,0x00,0x00},/*"K",43*/
|
||||
|
||||
{0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00,0x00,0x00},/*"L",44*/
|
||||
|
||||
{0x00,0x00,0x00,0x63,0x63,0x77,0x6B,0x6B,0x6B,0x63,0x63,0x63,0x00,0x00,0x00,0x00},/*"M",45*/
|
||||
|
||||
{0x00,0x00,0x00,0x63,0x63,0x73,0x7B,0x6F,0x67,0x63,0x63,0x63,0x00,0x00,0x00,0x00},/*"N",46*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"O",47*/
|
||||
|
||||
{0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00},/*"P",48*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x0C,0x06,0x00,0x00},/*"Q",49*/
|
||||
|
||||
{0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0x00,0x00,0x00,0x00},/*"R",50*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x66,0x60,0x30,0x18,0x0C,0x06,0x66,0x3C,0x00,0x00,0x00,0x00},/*"S",51*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00},/*"T",52*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"U",53*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00},/*"V",54*/
|
||||
|
||||
{0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x6B,0x6B,0x36,0x36,0x36,0x00,0x00,0x00,0x00},/*"W",55*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x34,0x18,0x18,0x2C,0x66,0x66,0x66,0x00,0x00,0x00,0x00},/*"X",56*/
|
||||
|
||||
{0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00},/*"Y",57*/
|
||||
|
||||
{0x00,0x00,0x00,0x7E,0x06,0x06,0x0C,0x18,0x30,0x60,0x60,0x7E,0x00,0x00,0x00,0x00},/*"Z",58*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00},/*"[",59*/
|
||||
|
||||
{0x00,0x00,0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0C,0x0C,0x06,0x06,0x00,0x00,0x00},/*"\",60*/
|
||||
|
||||
{0x00,0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00},/*"]",61*/
|
||||
|
||||
{0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00},/*"_",63*/
|
||||
|
||||
{0x00,0x00,0x00,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",64*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00},/*"a",65*/
|
||||
|
||||
{0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00},/*"b",66*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x60,0x66,0x3C,0x00,0x00,0x00,0x00},/*"c",67*/
|
||||
|
||||
{0x00,0x00,0x00,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00},/*"d",68*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x7E,0x60,0x60,0x3C,0x00,0x00,0x00,0x00},/*"e",69*/
|
||||
|
||||
{0x00,0x00,0x00,0x1E,0x30,0x30,0x30,0x7E,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00},/*"f",70*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x06,0x7C,0x00},/*"g",71*/
|
||||
|
||||
{0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00},/*"h",72*/
|
||||
|
||||
{0x00,0x00,0x18,0x18,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00},/*"i",73*/
|
||||
|
||||
{0x00,0x00,0x0C,0x0C,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x78,0x00},/*"j",74*/
|
||||
|
||||
{0x00,0x00,0x00,0x60,0x60,0x66,0x66,0x6C,0x78,0x6C,0x66,0x66,0x00,0x00,0x00,0x00},/*"k",75*/
|
||||
|
||||
{0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00},/*"l",76*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x7E,0x6B,0x6B,0x6B,0x6B,0x6B,0x63,0x00,0x00,0x00,0x00},/*"m",77*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00},/*"n",78*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},/*"o",79*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00},/*"p",80*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x06,0x06,0x00},/*"q",81*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x66,0x6E,0x70,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00},/*"r",82*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x3E,0x60,0x60,0x3C,0x06,0x06,0x7C,0x00,0x00,0x00,0x00},/*"s",83*/
|
||||
|
||||
{0x00,0x00,0x00,0x30,0x30,0x7E,0x30,0x30,0x30,0x30,0x30,0x1E,0x00,0x00,0x00,0x00},/*"t",84*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00},/*"u",85*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00},/*"v",86*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x63,0x6B,0x6B,0x6B,0x6B,0x36,0x36,0x00,0x00,0x00,0x00},/*"w",87*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x00,0x00,0x00,0x00},/*"x",88*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x0C,0x18,0xF0,0x00},/*"y",89*/
|
||||
|
||||
{0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00,0x00},/*"z",90*/
|
||||
|
||||
{0x00,0x00,0x00,0x0C,0x18,0x18,0x18,0x30,0x60,0x30,0x18,0x18,0x18,0x0C,0x00,0x00},/*"{",91*/
|
||||
|
||||
{0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00},/*"|",92*/
|
||||
|
||||
{0x00,0x00,0x00,0x30,0x18,0x18,0x18,0x0C,0x06,0x0C,0x18,0x18,0x18,0x30,0x00,0x00},/*"}",93*/
|
||||
|
||||
{0x00,0x00,0x00,0x71,0xDB,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
void GetASCIICode(unsigned char* pBuffer,unsigned char ASCII) {
|
||||
memcpy(pBuffer,AsciiLib[(ASCII - 32)] ,16);
|
||||
}
|
||||
|
12
fonts.h
Executable file
12
fonts.h
Executable file
@ -0,0 +1,12 @@
|
||||
#ifndef ASCIILIB_H
|
||||
#define ASCIILIB_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//#define ASCII_8X16_MS_Gothic
|
||||
#define ASCII_8X16_System
|
||||
|
||||
void GetASCIICode(unsigned char* pBuffer,unsigned char ASCII);
|
||||
|
||||
#endif
|
||||
|
673
glcd.c
Executable file
673
glcd.c
Executable file
@ -0,0 +1,673 @@
|
||||
#include "glcd.h"
|
||||
#include "fonts.h"
|
||||
#include <math.h>
|
||||
|
||||
static uint16_t DeviceCode;
|
||||
|
||||
static __inline void lcdWriteIndex(uint16_t index) {
|
||||
Clr_Rs;
|
||||
Set_nRd;
|
||||
|
||||
palWritePort(LCD_PORT, index);
|
||||
|
||||
Clr_nWr;
|
||||
Set_nWr;
|
||||
}
|
||||
|
||||
static __inline void lcdWriteData(uint16_t data) {
|
||||
Set_Rs;
|
||||
|
||||
palWritePort(LCD_PORT, data);
|
||||
|
||||
Clr_nWr;
|
||||
Set_nWr;
|
||||
}
|
||||
|
||||
static __inline uint16_t lcdReadData(void) {
|
||||
uint16_t value;
|
||||
|
||||
Set_Rs;
|
||||
Set_nWr;
|
||||
Clr_nRd;
|
||||
|
||||
// change pin mode to digital input
|
||||
LCD_PORT->CRH = 0x44444444;
|
||||
LCD_PORT->CRL = 0x44444444;
|
||||
|
||||
value = LCD_PORT->IDR;
|
||||
value = LCD_PORT->IDR;
|
||||
|
||||
// change pin mode back to digital output
|
||||
LCD_PORT->CRH = 0x33333333;
|
||||
LCD_PORT->CRL = 0x33333333;
|
||||
|
||||
Set_nRd;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static __inline void lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) {
|
||||
Clr_Cs;
|
||||
lcdWriteIndex(lcdReg);
|
||||
lcdWriteData(lcdRegValue);
|
||||
Set_Cs;
|
||||
}
|
||||
|
||||
static __inline uint16_t lcdReadReg(uint16_t lcdReg) {
|
||||
uint16_t lcdRAM;
|
||||
|
||||
Clr_Cs;
|
||||
lcdWriteIndex(lcdReg);
|
||||
lcdRAM = lcdReadData();
|
||||
Set_Cs;
|
||||
|
||||
return lcdRAM;
|
||||
}
|
||||
|
||||
static void lcdSetCursor(uint16_t Xpos,uint16_t Ypos) {
|
||||
if(DeviceCode==0x8989)
|
||||
{
|
||||
lcdWriteReg(0x004e,Xpos);
|
||||
lcdWriteReg(0x004f,Ypos);
|
||||
}
|
||||
else if(DeviceCode==0x9919)
|
||||
{
|
||||
lcdWriteReg(0x004e,Xpos);
|
||||
lcdWriteReg(0x004f,Ypos);
|
||||
}
|
||||
else
|
||||
{
|
||||
lcdWriteReg(0x0020,Xpos);
|
||||
lcdWriteReg(0x0021,Ypos);
|
||||
}
|
||||
}
|
||||
|
||||
static void lcdDelay(uint16_t nCount) {
|
||||
uint16_t TimingDelay;
|
||||
while(nCount--)
|
||||
{
|
||||
for(TimingDelay=0;TimingDelay<10000;TimingDelay++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void lcdSetWindows(uint16_t xStart,uint16_t yStart,uint16_t xLong,uint16_t yLong) {
|
||||
lcdSetCursor(xStart,yStart);
|
||||
lcdWriteReg(0x0050,xStart);
|
||||
lcdWriteReg(0x0051,xStart+xLong-1);
|
||||
lcdWriteReg(0x0052,yStart);
|
||||
lcdWriteReg(0x0053,yStart+yLong-1);
|
||||
}
|
||||
|
||||
void lcdClear(uint16_t Color) {
|
||||
uint32_t index=0;
|
||||
lcdSetCursor(0,0);
|
||||
Clr_Cs;
|
||||
lcdWriteIndex(0x0022);
|
||||
for(index=0;index<76800;index++)
|
||||
{
|
||||
lcdWriteData(Color);
|
||||
}
|
||||
Set_Cs;
|
||||
}
|
||||
|
||||
uint16_t lcdGetPoint(uint16_t Xpos,uint16_t Ypos) {
|
||||
u16 dummy;
|
||||
|
||||
lcdSetCursor(Xpos,Ypos);
|
||||
Clr_Cs;
|
||||
lcdWriteIndex(0x0022);
|
||||
dummy = lcdReadData();
|
||||
dummy = lcdReadData();
|
||||
Set_Cs;
|
||||
|
||||
if( DeviceCode==0x7783 || DeviceCode==0x4531 || DeviceCode==0x8989 )
|
||||
return dummy;
|
||||
else
|
||||
return lcdBGR2RGB( dummy );
|
||||
}
|
||||
|
||||
void lcdDrawPixel(uint16_t Xpos,uint16_t Ypos,uint16_t point) {
|
||||
lcdSetCursor(Xpos,Ypos);
|
||||
lcdWriteReg(0x0022,point);
|
||||
}
|
||||
|
||||
void lcdDrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
|
||||
int16_t dy, dx;
|
||||
int8_t addx=1, addy=1;
|
||||
int16_t P, diff;
|
||||
|
||||
int16_t i=0;
|
||||
dx = abs((int8_t)(x2 - x1));
|
||||
dy = abs((int16_t)(y2 - y1));
|
||||
|
||||
if(x1 > x2)
|
||||
addx = -1;
|
||||
if(y1 > y2)
|
||||
addy = -1;
|
||||
|
||||
if(dx >= dy)
|
||||
{
|
||||
dy *= 2;
|
||||
P = dy - dx;
|
||||
diff = P - dx;
|
||||
|
||||
for(; i<=dx; ++i)
|
||||
{
|
||||
lcdDrawPixel(x1, y1, color);
|
||||
|
||||
if(P < 0)
|
||||
{
|
||||
P += dy;
|
||||
x1 += addx;
|
||||
}
|
||||
else
|
||||
{
|
||||
P += diff;
|
||||
x1 += addx;
|
||||
y1 += addy;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dx *= 2;
|
||||
P = dx - dy;
|
||||
diff = P - dy;
|
||||
|
||||
for(; i<=dy; ++i)
|
||||
{
|
||||
lcdDrawPixel(x1, y1, color);
|
||||
|
||||
if(P < 0)
|
||||
{
|
||||
P += dx;
|
||||
y1 += addy;
|
||||
}
|
||||
else
|
||||
{
|
||||
P += diff;
|
||||
x1 += addx;
|
||||
y1 += addy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcdChar(unsigned short Xpos,unsigned short Ypos,unsigned char c,unsigned short charColor,unsigned short bkColor) {
|
||||
unsigned short i=0;
|
||||
unsigned short j=0;
|
||||
unsigned char buffer[16];
|
||||
unsigned char tmp_char=0;
|
||||
GetASCIICode(buffer,c);
|
||||
for (i=0;i<16;i++)
|
||||
{
|
||||
tmp_char=buffer[i];
|
||||
for (j=0;j<8;j++)
|
||||
{
|
||||
if (((tmp_char >> (7-j)) & 0x01) == 0x01)
|
||||
{
|
||||
lcdDrawPixel(Xpos+j,Ypos+i,charColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
lcdDrawPixel(Xpos+j,Ypos+i,bkColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcdString(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor) {
|
||||
uint8_t TempChar;
|
||||
|
||||
do {
|
||||
TempChar=*str++;
|
||||
lcdChar(Xpos,Ypos,TempChar,Color,bkColor);
|
||||
if (Xpos<232) {
|
||||
Xpos+=8;
|
||||
} else if (Ypos<304) {
|
||||
Xpos=0;
|
||||
Ypos+=16;
|
||||
} else {
|
||||
Xpos=0;
|
||||
Ypos=0;
|
||||
}
|
||||
} while (*str!=0);
|
||||
}
|
||||
|
||||
uint16_t lcdBGR2RGB(uint16_t color) {
|
||||
uint16_t r, g, b, rgb;
|
||||
|
||||
b = ( color>>0 ) & 0x1f;
|
||||
g = ( color>>5 ) & 0x3f;
|
||||
r = ( color>>11 ) & 0x1f;
|
||||
|
||||
rgb = (b<<11) + (g<<5) + (r<<0);
|
||||
|
||||
return( rgb );
|
||||
}
|
||||
|
||||
void lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) {
|
||||
uint16_t i;
|
||||
|
||||
for(i = y0; i < y1; i++)
|
||||
lcdDrawLine(x0, i, x1, i, color);
|
||||
}
|
||||
|
||||
void lcdFillArea2(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) {
|
||||
uint32_t index, area;
|
||||
|
||||
area = ((x1-x0) * (y1-y0));
|
||||
|
||||
lcdSetWindows(x0, y0, x1, y1);
|
||||
lcdSetCursor(x0, x1);
|
||||
Clr_Cs;
|
||||
lcdWriteIndex(0x0022);
|
||||
for(index = 0; index < area; index++)
|
||||
lcdWriteData(color);
|
||||
Set_Cs;
|
||||
}
|
||||
|
||||
void lcdDrawRect(uint8_t x0, uint16_t y0, uint8_t x1, uint16_t y1, uint8_t filled, uint16_t color) {
|
||||
uint8_t i,TempX;
|
||||
uint16_t j, TempY;
|
||||
|
||||
if (x0 > x1) {
|
||||
TempX = x1;
|
||||
x1 = x0;
|
||||
x0 = TempX;
|
||||
}
|
||||
if (y0 > y1) {
|
||||
TempY = y1;
|
||||
y1 = y0;
|
||||
y0 = TempY;
|
||||
}
|
||||
if(filled) {
|
||||
for(i=x0; i<x1; i++)
|
||||
for(j=y0; j<y1; j++)
|
||||
lcdDrawPixel(i , j , color);
|
||||
} else {
|
||||
lcdDrawLine(x0, y0, x1, y0, color);
|
||||
lcdDrawLine(x0, y1, x1, y1, color);
|
||||
lcdDrawLine(x0, y0, x0, y1, color);
|
||||
lcdDrawLine(x1, y0, x1, y1, color);
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawCircle(uint8_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color) {
|
||||
int16_t a, b, P;
|
||||
a = 0;
|
||||
b = radius;
|
||||
P = 1 - radius;
|
||||
|
||||
do {
|
||||
if(filled) {
|
||||
lcdDrawLine(x-a, y+b, x+a, y+b, color);
|
||||
lcdDrawLine(x-a, y-b, x+a, y-b, color);
|
||||
lcdDrawLine(x-b, y+a, x+b, y+a, color);
|
||||
lcdDrawLine(x-b, y-a, x+b, y-a, color);
|
||||
} else {
|
||||
lcdDrawPixel(a+x, b+y, color);
|
||||
lcdDrawPixel(b+x, a+y, color);
|
||||
lcdDrawPixel(x-a, b+y, color);
|
||||
lcdDrawPixel(x-b, a+y, color);
|
||||
lcdDrawPixel(b+x, y-a, color);
|
||||
lcdDrawPixel(a+x, y-b, color);
|
||||
lcdDrawPixel(x-a, y-b, color);
|
||||
lcdDrawPixel(x-b, y-a, color);
|
||||
}
|
||||
|
||||
if(P < 0)
|
||||
P += 3 + 2*a++;
|
||||
else
|
||||
P += 5 + 2*(a++ - b--);
|
||||
} while(a <= b);
|
||||
}
|
||||
|
||||
void lcdTest(void) {
|
||||
uint16_t x;
|
||||
uint8_t y;
|
||||
uint8_t r,g,b;
|
||||
|
||||
for(y = 0; y < SCREEN_HEIGHT; y++) {
|
||||
for(x = 0; x < SCREEN_WIDTH; x++) {
|
||||
r = x + y;
|
||||
g = x - y;
|
||||
b = y - x;
|
||||
lcdDrawPixel(y, x, RGB565CONVERT(r,g,b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcdInit() {
|
||||
lcdDelay(5);
|
||||
DeviceCode = lcdReadReg(0x0000);
|
||||
if(DeviceCode==0x9325 || DeviceCode==0x9328)
|
||||
{
|
||||
lcdWriteReg(0x00e7,0x0010);
|
||||
lcdWriteReg(0x0000,0x0001);
|
||||
lcdWriteReg(0x0001,0x0100);
|
||||
lcdWriteReg(0x0002,0x0700);
|
||||
lcdWriteReg(0x0003,(1<<12)|(1<<5)|(1<<4)|(0<<3) );
|
||||
lcdWriteReg(0x0004,0x0000);
|
||||
lcdWriteReg(0x0008,0x0207);
|
||||
lcdWriteReg(0x0009,0x0000);
|
||||
lcdWriteReg(0x000a,0x0000);
|
||||
lcdWriteReg(0x000c,0x0001);
|
||||
lcdWriteReg(0x000d,0x0000);
|
||||
lcdWriteReg(0x000f,0x0000);
|
||||
lcdWriteReg(0x0010,0x0000);
|
||||
lcdWriteReg(0x0011,0x0007);
|
||||
lcdWriteReg(0x0012,0x0000);
|
||||
lcdWriteReg(0x0013,0x0000);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0010,0x1590);
|
||||
lcdWriteReg(0x0011,0x0227);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0012,0x009c);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0013,0x1900);
|
||||
lcdWriteReg(0x0029,0x0023);
|
||||
lcdWriteReg(0x002b,0x000e);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0020,0x0000);
|
||||
lcdWriteReg(0x0021,0x0000);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0030,0x0007);
|
||||
lcdWriteReg(0x0031,0x0707);
|
||||
lcdWriteReg(0x0032,0x0006);
|
||||
lcdWriteReg(0x0035,0x0704);
|
||||
lcdWriteReg(0x0036,0x1f04);
|
||||
lcdWriteReg(0x0037,0x0004);
|
||||
|
||||
lcdWriteReg(0x0038,0x0000);
|
||||
lcdWriteReg(0x0039,0x0706);
|
||||
lcdWriteReg(0x003c,0x0701);
|
||||
lcdWriteReg(0x003d,0x000f);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0050,0x0000);
|
||||
lcdWriteReg(0x0051,0x00ef);
|
||||
lcdWriteReg(0x0052,0x0000);
|
||||
lcdWriteReg(0x0053,0x013f);
|
||||
lcdWriteReg(0x0060,0xa700);
|
||||
lcdWriteReg(0x0061,0x0001);
|
||||
lcdWriteReg(0x006a,0x0000);
|
||||
lcdWriteReg(0x0080,0x0000);
|
||||
lcdWriteReg(0x0081,0x0000);
|
||||
lcdWriteReg(0x0082,0x0000);
|
||||
lcdWriteReg(0x0083,0x0000);
|
||||
lcdWriteReg(0x0084,0x0000);
|
||||
lcdWriteReg(0x0085,0x0000);
|
||||
|
||||
lcdWriteReg(0x0090,0x0010);
|
||||
lcdWriteReg(0x0092,0x0000);
|
||||
lcdWriteReg(0x0093,0x0003);
|
||||
lcdWriteReg(0x0095,0x0110);
|
||||
lcdWriteReg(0x0097,0x0000);
|
||||
lcdWriteReg(0x0098,0x0000);
|
||||
lcdWriteReg(0x0007,0x0133);
|
||||
|
||||
lcdWriteReg(0x0020,0x0000);
|
||||
lcdWriteReg(0x0021,0x0000);
|
||||
}
|
||||
else if(DeviceCode==0x9320 || DeviceCode==0x9300)
|
||||
{
|
||||
lcdWriteReg(0x00,0x0000);
|
||||
lcdWriteReg(0x01,0x0100);
|
||||
lcdWriteReg(0x02,0x0700);
|
||||
lcdWriteReg(0x03,0x1018);
|
||||
|
||||
lcdWriteReg(0x04,0x0000);
|
||||
lcdWriteReg(0x08,0x0202);
|
||||
lcdWriteReg(0x09,0x0000);
|
||||
lcdWriteReg(0x0a,0x0000);
|
||||
lcdWriteReg(0x0c,(1<<0));
|
||||
lcdWriteReg(0x0d,0x0000);
|
||||
lcdWriteReg(0x0f,0x0000);
|
||||
|
||||
lcdDelay(10);
|
||||
lcdWriteReg(0x07,0x0101);
|
||||
lcdDelay(10);
|
||||
|
||||
lcdWriteReg(0x10,(1<<12)|(0<<8)|(1<<7)|(1<<6)|(0<<4));
|
||||
lcdWriteReg(0x11,0x0007);
|
||||
lcdWriteReg(0x12,(1<<8)|(1<<4)|(0<<0));
|
||||
lcdWriteReg(0x13,0x0b00);
|
||||
lcdWriteReg(0x29,0x0000);
|
||||
|
||||
lcdWriteReg(0x2b,(1<<14)|(1<<4));
|
||||
|
||||
lcdWriteReg(0x50,0);
|
||||
lcdWriteReg(0x51,239);
|
||||
lcdWriteReg(0x52,0);
|
||||
lcdWriteReg(0x53,319);
|
||||
|
||||
lcdWriteReg(0x60,0x2700);
|
||||
lcdWriteReg(0x61,0x0001);
|
||||
lcdWriteReg(0x6a,0x0000);
|
||||
|
||||
lcdWriteReg(0x80,0x0000);
|
||||
lcdWriteReg(0x81,0x0000);
|
||||
lcdWriteReg(0x82,0x0000);
|
||||
lcdWriteReg(0x83,0x0000);
|
||||
lcdWriteReg(0x84,0x0000);
|
||||
lcdWriteReg(0x85,0x0000);
|
||||
|
||||
lcdWriteReg(0x90,(0<<7)|(16<<0));
|
||||
lcdWriteReg(0x92,0x0000);
|
||||
lcdWriteReg(0x93,0x0001);
|
||||
lcdWriteReg(0x95,0x0110);
|
||||
lcdWriteReg(0x97,(0<<8));
|
||||
lcdWriteReg(0x98,0x0000);
|
||||
|
||||
lcdWriteReg(0x07,0x0173);
|
||||
}
|
||||
else if(DeviceCode==0x9331)
|
||||
{
|
||||
lcdWriteReg(0x00E7, 0x1014);
|
||||
lcdWriteReg(0x0001, 0x0100);
|
||||
lcdWriteReg(0x0002, 0x0200);
|
||||
lcdWriteReg(0x0003, 0x1030);
|
||||
lcdWriteReg(0x0008, 0x0202);
|
||||
lcdWriteReg(0x0009, 0x0000);
|
||||
lcdWriteReg(0x000A, 0x0000);
|
||||
lcdWriteReg(0x000C, 0x0000);
|
||||
lcdWriteReg(0x000D, 0x0000);
|
||||
lcdWriteReg(0x000F, 0x0000);
|
||||
lcdWriteReg(0x0010, 0x0000);
|
||||
lcdWriteReg(0x0011, 0x0007);
|
||||
lcdWriteReg(0x0012, 0x0000);
|
||||
lcdWriteReg(0x0013, 0x0000);
|
||||
lcdDelay(20);
|
||||
lcdWriteReg(0x0010, 0x1690);
|
||||
lcdWriteReg(0x0011, 0x0227);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0012, 0x000C);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0013, 0x0800);
|
||||
lcdWriteReg(0x0029, 0x0011);
|
||||
lcdWriteReg(0x002B, 0x000B);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0020, 0x0000);
|
||||
lcdWriteReg(0x0021, 0x0000);
|
||||
lcdWriteReg(0x0030, 0x0000);
|
||||
lcdWriteReg(0x0031, 0x0106);
|
||||
lcdWriteReg(0x0032, 0x0000);
|
||||
lcdWriteReg(0x0035, 0x0204);
|
||||
lcdWriteReg(0x0036, 0x160A);
|
||||
lcdWriteReg(0x0037, 0x0707);
|
||||
lcdWriteReg(0x0038, 0x0106);
|
||||
lcdWriteReg(0x0039, 0x0707);
|
||||
lcdWriteReg(0x003C, 0x0402);
|
||||
lcdWriteReg(0x003D, 0x0C0F);
|
||||
lcdWriteReg(0x0050, 0x0000);
|
||||
lcdWriteReg(0x0051, 0x00EF);
|
||||
lcdWriteReg(0x0052, 0x0000);
|
||||
lcdWriteReg(0x0053, 0x013F);
|
||||
lcdWriteReg(0x0060, 0x2700);
|
||||
lcdWriteReg(0x0061, 0x0001);
|
||||
lcdWriteReg(0x006A, 0x0000);
|
||||
lcdWriteReg(0x0080, 0x0000);
|
||||
lcdWriteReg(0x0081, 0x0000);
|
||||
lcdWriteReg(0x0082, 0x0000);
|
||||
lcdWriteReg(0x0083, 0x0000);
|
||||
lcdWriteReg(0x0084, 0x0000);
|
||||
lcdWriteReg(0x0085, 0x0000);
|
||||
lcdWriteReg(0x0090, 0x0010);
|
||||
lcdWriteReg(0x0092, 0x0600);
|
||||
lcdWriteReg(0x0007,0x0021);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0007,0x0061);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0007,0x0133);
|
||||
lcdDelay(5);
|
||||
}
|
||||
else if(DeviceCode==0x9919)
|
||||
{
|
||||
lcdWriteReg(0x28,0x0006);
|
||||
lcdWriteReg(0x00,0x0001);
|
||||
lcdWriteReg(0x10,0x0000);
|
||||
lcdWriteReg(0x01,0x72ef);
|
||||
lcdWriteReg(0x02,0x0600);
|
||||
lcdWriteReg(0x03,0x6a38);
|
||||
lcdWriteReg(0x11,0x6874);
|
||||
lcdWriteReg(0x0f,0x0000);
|
||||
lcdWriteReg(0x0b,0x5308);
|
||||
lcdWriteReg(0x0c,0x0003);
|
||||
lcdWriteReg(0x0d,0x000a);
|
||||
lcdWriteReg(0x0e,0x2e00);
|
||||
lcdWriteReg(0x1e,0x00be);
|
||||
lcdWriteReg(0x25,0x8000);
|
||||
lcdWriteReg(0x26,0x7800);
|
||||
lcdWriteReg(0x27,0x0078);
|
||||
lcdWriteReg(0x4e,0x0000);
|
||||
lcdWriteReg(0x4f,0x0000);
|
||||
lcdWriteReg(0x12,0x08d9);
|
||||
lcdWriteReg(0x30,0x0000);
|
||||
lcdWriteReg(0x31,0x0104);
|
||||
lcdWriteReg(0x32,0x0100);
|
||||
lcdWriteReg(0x33,0x0305);
|
||||
lcdWriteReg(0x34,0x0505);
|
||||
lcdWriteReg(0x35,0x0305);
|
||||
lcdWriteReg(0x36,0x0707);
|
||||
lcdWriteReg(0x37,0x0300);
|
||||
lcdWriteReg(0x3a,0x1200);
|
||||
lcdWriteReg(0x3b,0x0800);
|
||||
lcdWriteReg(0x07,0x0033);
|
||||
}
|
||||
else if(DeviceCode==0x1505)
|
||||
{
|
||||
lcdWriteReg(0x0007,0x0000);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0012,0x011C);
|
||||
lcdWriteReg(0x00A4,0x0001);
|
||||
lcdWriteReg(0x0008,0x000F);
|
||||
lcdWriteReg(0x000A,0x0008);
|
||||
lcdWriteReg(0x000D,0x0008);
|
||||
lcdWriteReg(0x0030,0x0707);
|
||||
lcdWriteReg(0x0031,0x0007);
|
||||
lcdWriteReg(0x0032,0x0603);
|
||||
lcdWriteReg(0x0033,0x0700);
|
||||
lcdWriteReg(0x0034,0x0202);
|
||||
lcdWriteReg(0x0035,0x0002);
|
||||
lcdWriteReg(0x0036,0x1F0F);
|
||||
lcdWriteReg(0x0037,0x0707);
|
||||
lcdWriteReg(0x0038,0x0000);
|
||||
lcdWriteReg(0x0039,0x0000);
|
||||
lcdWriteReg(0x003A,0x0707);
|
||||
lcdWriteReg(0x003B,0x0000);
|
||||
lcdWriteReg(0x003C,0x0007);
|
||||
lcdWriteReg(0x003D,0x0000);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0007,0x0001);
|
||||
lcdWriteReg(0x0017,0x0001);
|
||||
lcdDelay(5);
|
||||
lcdWriteReg(0x0010,0x17A0);
|
||||
lcdWriteReg(0x0011,0x0217);
|
||||
lcdWriteReg(0x0012,0x011E);
|
||||
lcdWriteReg(0x0013,0x0F00);
|
||||
lcdWriteReg(0x002A,0x0000);
|
||||
lcdWriteReg(0x0029,0x000A);
|
||||
lcdWriteReg(0x0012,0x013E);
|
||||
lcdWriteReg(0x0050,0x0000);
|
||||
lcdWriteReg(0x0051,0x00EF);
|
||||
lcdWriteReg(0x0052,0x0000);
|
||||
lcdWriteReg(0x0053,0x013F);
|
||||
lcdWriteReg(0x0060,0x2700);
|
||||
lcdWriteReg(0x0061,0x0001);
|
||||
lcdWriteReg(0x006A,0x0000);
|
||||
lcdWriteReg(0x0080,0x0000);
|
||||
lcdWriteReg(0x0081,0x0000);
|
||||
lcdWriteReg(0x0082,0x0000);
|
||||
lcdWriteReg(0x0083,0x0000);
|
||||
lcdWriteReg(0x0084,0x0000);
|
||||
lcdWriteReg(0x0085,0x0000);
|
||||
lcdWriteReg(0x0090,0x0013);
|
||||
lcdWriteReg(0x0092,0x0300);
|
||||
lcdWriteReg(0x0093,0x0005);
|
||||
lcdWriteReg(0x0095,0x0000);
|
||||
lcdWriteReg(0x0097,0x0000);
|
||||
lcdWriteReg(0x0098,0x0000);
|
||||
|
||||
lcdWriteReg(0x0001,0x0100);
|
||||
lcdWriteReg(0x0002,0x0700);
|
||||
lcdWriteReg(0x0003,0x1030);
|
||||
lcdWriteReg(0x0004,0x0000);
|
||||
lcdWriteReg(0x000C,0x0000);
|
||||
lcdWriteReg(0x000F,0x0000);
|
||||
lcdWriteReg(0x0020,0x0000);
|
||||
lcdWriteReg(0x0021,0x0000);
|
||||
lcdWriteReg(0x0007,0x0021);
|
||||
lcdDelay(20);
|
||||
lcdWriteReg(0x0007,0x0061);
|
||||
lcdDelay(20);
|
||||
lcdWriteReg(0x0007,0x0173);
|
||||
lcdDelay(20);
|
||||
}
|
||||
else if(DeviceCode==0x8989)
|
||||
{
|
||||
lcdWriteReg(0x0000,0x0001); lcdDelay(5);
|
||||
lcdWriteReg(0x0003,0xA8A4); lcdDelay(5);
|
||||
lcdWriteReg(0x000C,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x000D,0x080C); lcdDelay(5);
|
||||
lcdWriteReg(0x000E,0x2B00); lcdDelay(5);
|
||||
lcdWriteReg(0x001E,0x00B0); lcdDelay(5);
|
||||
lcdWriteReg(0x0001,0x2B3F); lcdDelay(5);
|
||||
lcdWriteReg(0x0002,0x0600); lcdDelay(5);
|
||||
lcdWriteReg(0x0010,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0011,0x6070); lcdDelay(5);
|
||||
lcdWriteReg(0x0005,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0006,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0016,0xEF1C); lcdDelay(5);
|
||||
lcdWriteReg(0x0017,0x0003); lcdDelay(5);
|
||||
lcdWriteReg(0x0007,0x0133); lcdDelay(5);
|
||||
lcdWriteReg(0x000B,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x000F,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0041,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0042,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0048,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0049,0x013F); lcdDelay(5);
|
||||
lcdWriteReg(0x004A,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x004B,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0044,0xEF00); lcdDelay(5);
|
||||
lcdWriteReg(0x0045,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0046,0x013F); lcdDelay(5);
|
||||
lcdWriteReg(0x0030,0x0707); lcdDelay(5);
|
||||
lcdWriteReg(0x0031,0x0204); lcdDelay(5);
|
||||
lcdWriteReg(0x0032,0x0204); lcdDelay(5);
|
||||
lcdWriteReg(0x0033,0x0502); lcdDelay(5);
|
||||
lcdWriteReg(0x0034,0x0507); lcdDelay(5);
|
||||
lcdWriteReg(0x0035,0x0204); lcdDelay(5);
|
||||
lcdWriteReg(0x0036,0x0204); lcdDelay(5);
|
||||
lcdWriteReg(0x0037,0x0502); lcdDelay(5);
|
||||
lcdWriteReg(0x003A,0x0302); lcdDelay(5);
|
||||
lcdWriteReg(0x003B,0x0302); lcdDelay(5);
|
||||
lcdWriteReg(0x0023,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0024,0x0000); lcdDelay(5);
|
||||
lcdWriteReg(0x0025,0x8000); lcdDelay(5);
|
||||
lcdWriteReg(0x004f,0);
|
||||
lcdWriteReg(0x004e,0);
|
||||
}
|
||||
lcdDelay(5);
|
||||
}
|
||||
|
51
glcd.h
Executable file
51
glcd.h
Executable file
@ -0,0 +1,51 @@
|
||||
#ifndef GLCD_H
|
||||
#define GLCD_H
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
|
||||
#define Set_Cs palSetPad(GPIOD, GPIOD_LCD_CS);
|
||||
#define Clr_Cs palClearPad(GPIOD, GPIOD_LCD_CS);
|
||||
#define Set_Rs palSetPad(GPIOD, GPIOD_LCD_RS);
|
||||
#define Clr_Rs palClearPad(GPIOD, GPIOD_LCD_RS);
|
||||
#define Set_nWr palSetPad(GPIOD, GPIOD_LCD_WR);
|
||||
#define Clr_nWr palClearPad(GPIOD, GPIOD_LCD_WR);
|
||||
#define Set_nRd palSetPad(GPIOD, GPIOD_LCD_RD);
|
||||
#define Clr_nRd palClearPad(GPIOD, GPIOD_LCD_RD);
|
||||
|
||||
/* LCD color */
|
||||
#define White 0xFFFF
|
||||
#define Black 0x0000
|
||||
#define Grey 0xF7DE
|
||||
#define Blue 0x001F
|
||||
#define Blue2 0x051F
|
||||
#define Red 0xF800
|
||||
#define Magenta 0xF81F
|
||||
#define Green 0x07E0
|
||||
#define Cyan 0x7FFF
|
||||
#define Yellow 0xFFE0
|
||||
|
||||
#define RGB565CONVERT(red, green, blue)\
|
||||
(uint16_t)( (( red >> 3 ) << 11 ) | \
|
||||
(( green >> 2 ) << 5 ) | \
|
||||
( blue >> 3 ))
|
||||
|
||||
void lcdInit(void);
|
||||
void lcdClear(uint16_t Color);
|
||||
void lcdTest(void);
|
||||
uint16_t lcdBGR2RGB(uint16_t color);
|
||||
uint16_t lcdGetPoint(uint16_t Xpos,uint16_t Ypos);
|
||||
void lcdDrawPixel(uint16_t Xpos,uint16_t Ypos,uint16_t point);
|
||||
void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
|
||||
void lcdDrawRect(uint8_t x0, uint16_t y0, uint8_t x1, uint16_t y1, uint8_t filled, uint16_t color);
|
||||
void lcdDrawCircle(uint8_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color);
|
||||
void lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
|
||||
void lcdFillArea2(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
|
||||
void lcdSetWindows(uint16_t xStart,uint16_t yStart,uint16_t xLong,uint16_t yLong);
|
||||
void lcdString(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor);
|
||||
void lcdChar(unsigned short Xpos,unsigned short Ypos,unsigned char c,unsigned short charColor,unsigned short bkColor);
|
||||
|
||||
#endif
|
5
lcd.mk
Normal file
5
lcd.mk
Normal file
@ -0,0 +1,5 @@
|
||||
# LCD files.
|
||||
LCDSRC = ${CHIBIOS}/ext/lcd/glcd.c \
|
||||
${CHIBIOS}/ext/fonts.c \
|
||||
|
||||
LCDINC = ${CHIBIOS}/ext/lcd
|
30
readme
Normal file
30
readme
Normal file
@ -0,0 +1,30 @@
|
||||
Chibios LCD Driver
|
||||
|
||||
### checkout Driver code into ext/
|
||||
cd chibios/ext
|
||||
git clone https://github.com/tectu/Chibios-LCD-Driver lcd
|
||||
|
||||
### Edit Makefile:
|
||||
include lcd.mk:
|
||||
include $(CHIBIOS)/ext/lcd/lcd.mk
|
||||
|
||||
Add $(LCDSRC) to CSRC:
|
||||
CSRC = $(PORTSRC) \
|
||||
$(KERNSRC) \
|
||||
$(TESTSRC) \
|
||||
$(HALSRC) \
|
||||
$(PLATFORMSRC) \
|
||||
$(BOARDSRC) \
|
||||
$(FATFSSRC) \
|
||||
$(LCDSRC) \
|
||||
$(CHIBIOS)/os/various/evtimer.c \
|
||||
$(CHIBIOS)/os/various/syscalls.c
|
||||
|
||||
Add $(LCDINC) to INCDIR:
|
||||
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
||||
$(HALINC) $(PLATFORMINC) $(BOARDINC) \
|
||||
$(FATFSINC) \
|
||||
$(LCDINC) \
|
||||
$(CHIBIOS)/os/various ../common
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user