*
This commit is contained in:
@@ -0,0 +1,417 @@
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "AsciiLib.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
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GetASCIICode
|
||||
* Description :
|
||||
* Input :
|
||||
* Output :
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void GetASCIICode(unsigned char* pBuffer,unsigned char ASCII)
|
||||
{
|
||||
memcpy(pBuffer,AsciiLib[(ASCII - 32)] ,16);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
#ifndef __AsciiLib_H
|
||||
#define __AsciiLib_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <string.h>
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
//#define ASCII_8X16_MS_Gothic
|
||||
#define ASCII_8X16_System
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
void GetASCIICode(unsigned char* pBuffer,unsigned char ASCII);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
/*********************************************************************************************************
|
||||
*
|
||||
* File : LCD.h
|
||||
* Hardware Environment:
|
||||
* Build Environment : RealView MDK-ARM Version: 4.20
|
||||
* Version : V1.0
|
||||
* By :
|
||||
*
|
||||
* (c) Copyright 2005-2011, WaveShare
|
||||
* http://www.waveshare.net
|
||||
* All Rights Reserved
|
||||
*
|
||||
*********************************************************************************************************/
|
||||
|
||||
#ifndef __GLCD_H
|
||||
#define __GLCD_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <math.h>
|
||||
#include "stm32f4xx.h"
|
||||
#include "LCD/AsciiLib.h"
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define USE_16BIT_PMP
|
||||
|
||||
/*********************************************************************
|
||||
* Overview: Horizontal and vertical display resolution
|
||||
* (from the glass datasheet).
|
||||
*********************************************************************/
|
||||
//#define DISP_HOR_RESOLUTION 320
|
||||
//#define DISP_VER_RESOLUTION 240
|
||||
|
||||
//#define DISP_ORIENTATION 0
|
||||
//#define DISP_ORIENTATION 90
|
||||
//#define DISP_ORIENTATION 180
|
||||
#define DISP_ORIENTATION 270
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
#if ( DISP_ORIENTATION == 90 ) || ( DISP_ORIENTATION == 270 )
|
||||
|
||||
#define MAX_X 320
|
||||
#define MAX_Y 240
|
||||
|
||||
#elif ( DISP_ORIENTATION == 0 ) || ( DISP_ORIENTATION == 180 )
|
||||
|
||||
#define MAX_X 240
|
||||
#define MAX_Y 320
|
||||
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* Overview: Horizontal synchronization timing in pixels
|
||||
* (from the glass datasheet).
|
||||
*********************************************************************/
|
||||
//#define DISP_HOR_PULSE_WIDTH 20 /* 20 */
|
||||
//#define DISP_HOR_BACK_PORCH 51 /* 48 */
|
||||
//#define DISP_HOR_FRONT_PORCH 20 /* 20 */
|
||||
|
||||
/*********************************************************************
|
||||
* Overview: Vertical synchronization timing in lines
|
||||
* (from the glass datasheet).
|
||||
*********************************************************************/
|
||||
//#define DISP_VER_PULSE_WIDTH 2 /* 2 */
|
||||
//#define DISP_VER_BACK_PORCH 12 /* 16 */
|
||||
//#define DISP_VER_FRONT_PORCH 4 /* 4 */
|
||||
|
||||
/*********************************************************************
|
||||
* Definition for SPI interface for HIMAX 8238-A relevant to hardware
|
||||
* layout; Hardware dependent!
|
||||
*********************************************************************/
|
||||
#define GPIO3 3
|
||||
#define GPIO2 2
|
||||
#define GPIO1 1
|
||||
#define GPIO0 0
|
||||
#define LCD_RESET (1<<GPIO3) /* LCD Reset signal (Reset for display panel, NOT ssd1963) */
|
||||
#define LCD_SPENA (1<<GPIO0) /* SPI EN signal */
|
||||
#define LCD_SPCLK (1<<GPIO1) /* SPI CLK */
|
||||
#define LCD_SPDAT (1<<GPIO2) /* SPI DATA */
|
||||
|
||||
/* 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) (int) (((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3))
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
void LCD_Initializtion(void);
|
||||
void LCD_Clear(uint16_t Color);
|
||||
//void LCD_SetBacklight(uint8_t intensity);
|
||||
uint16_t LCD_GetPoint(uint16_t Xpos,uint16_t Ypos);
|
||||
void LCD_SetPoint(uint16_t Xpos,uint16_t Ypos,uint16_t point);
|
||||
void PutChar(uint16_t Xpos,uint16_t Ypos,uint8_t c,uint16_t charColor,uint16_t bkColor);
|
||||
void LCD_DrawLine( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1 , uint16_t color );
|
||||
void PutChinese(uint16_t Xpos,uint16_t Ypos,uint8_t *str,uint16_t Color,uint16_t bkColor);
|
||||
void GUI_Text(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor);
|
||||
void GUI_Chinese(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor);
|
||||
void LCD_DrawPicture(uint16_t StartX,uint16_t StartY,uint16_t EndX,uint16_t EndY,uint16_t *pic);
|
||||
|
||||
|
||||
__inline void LCD_WriteIndex(uint16_t index);
|
||||
__inline void LCD_WriteData(uint16_t data);
|
||||
__inline uint16_t LCD_ReadData(void);
|
||||
__inline uint16_t LCD_ReadReg(uint16_t LCD_Reg);
|
||||
__inline void LCD_WriteReg(uint16_t LCD_Reg,uint16_t LCD_RegValue);
|
||||
static void LCD_SetCursor( uint16_t Xpos, uint16_t Ypos );
|
||||
void delay_ms(uint16_t ms);
|
||||
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,528 @@
|
||||
/*********************************************************************************************************
|
||||
*
|
||||
* File : TouchPanel.c
|
||||
* Hardware Environment:
|
||||
* Build Environment : RealView MDK-ARM Version: 4.20
|
||||
* Version : V1.0
|
||||
* By :
|
||||
*
|
||||
* (c) Copyright 2005-2011, WaveShare
|
||||
* http://www.waveshare.net
|
||||
* All Rights Reserved
|
||||
*
|
||||
*********************************************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TouchPanel/TouchPanel.h"
|
||||
#include "TouchPanel/config.h"
|
||||
#include "LCD/LCD.h"
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
Matrix matrix ;
|
||||
Coordinate display ;
|
||||
|
||||
|
||||
Coordinate ScreenSample[3];
|
||||
|
||||
Coordinate DisplaySample[3] = {
|
||||
{ 30, 45 },
|
||||
{ 250, 70},
|
||||
{ 160,210}
|
||||
};
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define THRESHOLD 2
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : ADS7843_SPI_Init
|
||||
* Description :
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
static void ADS7843_SPI_Init(void)
|
||||
{
|
||||
SPI_InitTypeDef SPI_InitStruct;
|
||||
|
||||
RCC_APB1PeriphClockCmd(Open_RCC_SPI,ENABLE);
|
||||
|
||||
SPI_I2S_DeInit(Open_SPI);
|
||||
/* Open_SPI Config -------------------------------------------------------------*/
|
||||
SPI_InitStruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
|
||||
SPI_InitStruct.SPI_Mode = SPI_Mode_Master;
|
||||
SPI_InitStruct.SPI_DataSize = SPI_DataSize_8b;
|
||||
SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low;
|
||||
SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;
|
||||
SPI_InitStruct.SPI_NSS = SPI_NSS_Soft;
|
||||
SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32;
|
||||
SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;
|
||||
SPI_InitStruct.SPI_CRCPolynomial = 7;
|
||||
|
||||
SPI_Init(Open_SPI, &SPI_InitStruct);
|
||||
|
||||
SPI_Cmd(Open_SPI, ENABLE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TP_Init
|
||||
* Description :
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void TP_Init(void)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(Open_SPI_SCK_GPIO_CLK | Open_SPI_MISO_GPIO_CLK | Open_SPI_MOSI_GPIO_CLK,ENABLE);
|
||||
|
||||
RCC_AHB1PeriphClockCmd(Open_TP_CS_CLK | Open_TP_IRQ_CLK,ENABLE);
|
||||
Open_SPI_CLK_INIT(Open_RCC_SPI,ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(Open_SPI_SCK_GPIO_PORT, Open_SPI_SCK_SOURCE, Open_GPIO_AF_SPI);
|
||||
GPIO_PinAFConfig(Open_SPI_MISO_GPIO_PORT, Open_SPI_MISO_SOURCE, Open_GPIO_AF_SPI);
|
||||
GPIO_PinAFConfig(Open_SPI_MOSI_GPIO_PORT, Open_SPI_MOSI_SOURCE, Open_GPIO_AF_SPI);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = Open_SPI_SCK_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(Open_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = Open_SPI_MISO_PIN;
|
||||
GPIO_Init(Open_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = Open_SPI_MOSI_PIN;
|
||||
GPIO_Init(Open_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
|
||||
|
||||
|
||||
/* TP_CS */
|
||||
GPIO_InitStructure.GPIO_Pin = Open_TP_CS_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(Open_TP_CS_PORT, &GPIO_InitStructure);
|
||||
|
||||
|
||||
/*TP_IRQ */
|
||||
GPIO_InitStructure.GPIO_Pin = Open_TP_IRQ_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN ;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(Open_TP_IRQ_PORT, &GPIO_InitStructure);
|
||||
|
||||
|
||||
TP_CS(1);
|
||||
ADS7843_SPI_Init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DelayUS
|
||||
* Description :
|
||||
* Input : - cnt:
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
|
||||
static void DelayUS(vu32 cnt)
|
||||
{
|
||||
uint16_t i;
|
||||
for(i = 0;i<cnt;i++)
|
||||
{
|
||||
uint8_t us = 12;
|
||||
while (us--)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WR_CMD
|
||||
* Description :
|
||||
* Input : - cmd:
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
static void WR_CMD (uint8_t cmd)
|
||||
{
|
||||
/* Wait for SPI3 Tx buffer empty */
|
||||
while (SPI_I2S_GetFlagStatus(Open_SPI, SPI_I2S_FLAG_TXE) == RESET);
|
||||
/* Send SPI3 data */
|
||||
SPI_I2S_SendData(Open_SPI,cmd);
|
||||
/* Wait for SPI3 data reception */
|
||||
while (SPI_I2S_GetFlagStatus(Open_SPI, SPI_I2S_FLAG_RXNE) == RESET);
|
||||
/* Read Open_SPI received data */
|
||||
SPI_I2S_ReceiveData(Open_SPI);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : RD_AD
|
||||
* Description :
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return :
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
static int RD_AD(void)
|
||||
{
|
||||
unsigned short buf,temp;
|
||||
/* Wait for Open_SPI Tx buffer empty */
|
||||
while (SPI_I2S_GetFlagStatus(Open_SPI, SPI_I2S_FLAG_TXE) == RESET);
|
||||
/* Send Open_SPI data */
|
||||
SPI_I2S_SendData(Open_SPI,0x0000);
|
||||
/* Wait for SPI3 data reception */
|
||||
while (SPI_I2S_GetFlagStatus(Open_SPI, SPI_I2S_FLAG_RXNE) == RESET);
|
||||
/* Read Open_SPI received data */
|
||||
temp=SPI_I2S_ReceiveData(Open_SPI);
|
||||
buf=temp<<8;
|
||||
DelayUS(1);
|
||||
while (SPI_I2S_GetFlagStatus(Open_SPI, SPI_I2S_FLAG_TXE) == RESET);
|
||||
/* Send Open_SPI data */
|
||||
SPI_I2S_SendData(Open_SPI,0x0000);
|
||||
/* Wait for Open_SPI data reception */
|
||||
while (SPI_I2S_GetFlagStatus(Open_SPI, SPI_I2S_FLAG_RXNE) == RESET);
|
||||
/* Read Open_SPI received data */
|
||||
temp=SPI_I2S_ReceiveData(Open_SPI);
|
||||
buf |= temp;
|
||||
buf>>=3;
|
||||
buf&=0xfff;
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Read_X
|
||||
* Description : Read ADS7843 ADC X
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return :
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
int Read_X(void)
|
||||
{
|
||||
int i;
|
||||
TP_CS(0);
|
||||
DelayUS(1);
|
||||
WR_CMD(CHX);
|
||||
DelayUS(1);
|
||||
i=RD_AD();
|
||||
TP_CS(1);
|
||||
return i;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Read_Y
|
||||
* Description : Read ADS7843 ADC Y
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return :
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
int Read_Y(void)
|
||||
{
|
||||
int i;
|
||||
TP_CS(0);
|
||||
DelayUS(1);
|
||||
WR_CMD(CHY);
|
||||
DelayUS(1);
|
||||
i=RD_AD();
|
||||
TP_CS(1);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TP_GetAdXY
|
||||
* Description : Read ADS7843
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return :
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void TP_GetAdXY(int *x,int *y)
|
||||
{
|
||||
int adx,ady;
|
||||
adx=Read_X();
|
||||
DelayUS(1);
|
||||
ady=Read_Y();
|
||||
*x=adx;
|
||||
*y=ady;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TP_DrawPoint
|
||||
* Description :
|
||||
* Input : - Xpos: Row Coordinate
|
||||
* - Ypos: Line Coordinate
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void TP_DrawPoint(uint16_t Xpos,uint16_t Ypos)
|
||||
{
|
||||
LCD_SetPoint(Xpos,Ypos,Blue); /* Center point */
|
||||
//LCD_SetPoint(Xpos+1,Ypos,Blue);
|
||||
//LCD_SetPoint(Xpos,Ypos+1,Blue);
|
||||
//LCD_SetPoint(Xpos+1,Ypos+1,Blue);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DrawCross
|
||||
* Description :
|
||||
* Input : - Xpos: Row Coordinate
|
||||
* - Ypos: Line Coordinate
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void DrawCross(uint16_t Xpos,uint16_t Ypos)
|
||||
{
|
||||
LCD_DrawLine(Xpos-15,Ypos,Xpos-2,Ypos,0xffff);
|
||||
LCD_DrawLine(Xpos+2,Ypos,Xpos+15,Ypos,0xffff);
|
||||
LCD_DrawLine(Xpos,Ypos-15,Xpos,Ypos-2,0xffff);
|
||||
LCD_DrawLine(Xpos,Ypos+2,Xpos,Ypos+15,0xffff);
|
||||
|
||||
LCD_DrawLine(Xpos-15,Ypos+15,Xpos-7,Ypos+15,RGB565CONVERT(184,158,131));
|
||||
LCD_DrawLine(Xpos-15,Ypos+7,Xpos-15,Ypos+15,RGB565CONVERT(184,158,131));
|
||||
|
||||
LCD_DrawLine(Xpos-15,Ypos-15,Xpos-7,Ypos-15,RGB565CONVERT(184,158,131));
|
||||
LCD_DrawLine(Xpos-15,Ypos-7,Xpos-15,Ypos-15,RGB565CONVERT(184,158,131));
|
||||
|
||||
LCD_DrawLine(Xpos+7,Ypos+15,Xpos+15,Ypos+15,RGB565CONVERT(184,158,131));
|
||||
LCD_DrawLine(Xpos+15,Ypos+7,Xpos+15,Ypos+15,RGB565CONVERT(184,158,131));
|
||||
|
||||
LCD_DrawLine(Xpos+7,Ypos-15,Xpos+15,Ypos-15,RGB565CONVERT(184,158,131));
|
||||
LCD_DrawLine(Xpos+15,Ypos-15,Xpos+15,Ypos-7,RGB565CONVERT(184,158,131));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Read_Ads7846
|
||||
* Description : Get TouchPanel X Y
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Coordinate *
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
Coordinate *Read_Ads7846(void)
|
||||
{
|
||||
static Coordinate screen;
|
||||
int m0,m1,m2,TP_X[1],TP_Y[1],temp[3];
|
||||
uint8_t count=0;
|
||||
int buffer[2][9]={{0},{0}};
|
||||
|
||||
do
|
||||
{
|
||||
TP_GetAdXY(TP_X,TP_Y);
|
||||
buffer[0][count]=TP_X[0];
|
||||
buffer[1][count]=TP_Y[0];
|
||||
count++;
|
||||
}
|
||||
while(!TP_INT_IN&& count<9); /* TP_INT_IN */
|
||||
if(count==9) /* Average X Y */
|
||||
{
|
||||
/* Average X */
|
||||
temp[0]=(buffer[0][0]+buffer[0][1]+buffer[0][2])/3;
|
||||
temp[1]=(buffer[0][3]+buffer[0][4]+buffer[0][5])/3;
|
||||
temp[2]=(buffer[0][6]+buffer[0][7]+buffer[0][8])/3;
|
||||
|
||||
m0=temp[0]-temp[1];
|
||||
m1=temp[1]-temp[2];
|
||||
m2=temp[2]-temp[0];
|
||||
|
||||
m0=m0>0?m0:(-m0);
|
||||
m1=m1>0?m1:(-m1);
|
||||
m2=m2>0?m2:(-m2);
|
||||
|
||||
if( m0>THRESHOLD && m1>THRESHOLD && m2>THRESHOLD ) return 0;
|
||||
|
||||
if(m0<m1)
|
||||
{
|
||||
if(m2<m0)
|
||||
screen.x=(temp[0]+temp[2])/2;
|
||||
else
|
||||
screen.x=(temp[0]+temp[1])/2;
|
||||
}
|
||||
else if(m2<m1)
|
||||
screen.x=(temp[0]+temp[2])/2;
|
||||
else
|
||||
screen.x=(temp[1]+temp[2])/2;
|
||||
|
||||
/* Average Y */
|
||||
temp[0]=(buffer[1][0]+buffer[1][1]+buffer[1][2])/3;
|
||||
temp[1]=(buffer[1][3]+buffer[1][4]+buffer[1][5])/3;
|
||||
temp[2]=(buffer[1][6]+buffer[1][7]+buffer[1][8])/3;
|
||||
m0=temp[0]-temp[1];
|
||||
m1=temp[1]-temp[2];
|
||||
m2=temp[2]-temp[0];
|
||||
m0=m0>0?m0:(-m0);
|
||||
m1=m1>0?m1:(-m1);
|
||||
m2=m2>0?m2:(-m2);
|
||||
if(m0>THRESHOLD&&m1>THRESHOLD&&m2>THRESHOLD) return 0;
|
||||
|
||||
if(m0<m1)
|
||||
{
|
||||
if(m2<m0)
|
||||
screen.y=(temp[0]+temp[2])/2;
|
||||
else
|
||||
screen.y=(temp[0]+temp[1])/2;
|
||||
}
|
||||
else if(m2<m1)
|
||||
screen.y=(temp[0]+temp[2])/2;
|
||||
else
|
||||
screen.y=(temp[1]+temp[2])/2;
|
||||
|
||||
return &screen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : setCalibrationMatrix
|
||||
* Description : Calculate K A B C D E F
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return :
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
FunctionalState setCalibrationMatrix( Coordinate * displayPtr,
|
||||
Coordinate * screenPtr,
|
||||
Matrix * matrixPtr)
|
||||
{
|
||||
|
||||
FunctionalState retTHRESHOLD = ENABLE ;
|
||||
/* K£½(X0£X2) (Y1£Y2)£(X1£X2) (Y0£Y2) */
|
||||
matrixPtr->Divider = ((screenPtr[0].x - screenPtr[2].x) * (screenPtr[1].y - screenPtr[2].y)) -
|
||||
((screenPtr[1].x - screenPtr[2].x) * (screenPtr[0].y - screenPtr[2].y)) ;
|
||||
if( matrixPtr->Divider == 0 )
|
||||
{
|
||||
retTHRESHOLD = DISABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A£½((XD0£XD2) (Y1£Y2)£(XD1£XD2) (Y0£Y2))£¯K */
|
||||
matrixPtr->An = ((displayPtr[0].x - displayPtr[2].x) * (screenPtr[1].y - screenPtr[2].y)) -
|
||||
((displayPtr[1].x - displayPtr[2].x) * (screenPtr[0].y - screenPtr[2].y)) ;
|
||||
/* B£½((X0£X2) (XD1£XD2)£(XD0£XD2) (X1£X2))£¯K */
|
||||
matrixPtr->Bn = ((screenPtr[0].x - screenPtr[2].x) * (displayPtr[1].x - displayPtr[2].x)) -
|
||||
((displayPtr[0].x - displayPtr[2].x) * (screenPtr[1].x - screenPtr[2].x)) ;
|
||||
/* C£½(Y0(X2XD1£X1XD2)+Y1(X0XD2£X2XD0)+Y2(X1XD0£X0XD1))£¯K */
|
||||
matrixPtr->Cn = (screenPtr[2].x * displayPtr[1].x - screenPtr[1].x * displayPtr[2].x) * screenPtr[0].y +
|
||||
(screenPtr[0].x * displayPtr[2].x - screenPtr[2].x * displayPtr[0].x) * screenPtr[1].y +
|
||||
(screenPtr[1].x * displayPtr[0].x - screenPtr[0].x * displayPtr[1].x) * screenPtr[2].y ;
|
||||
/* D£½((YD0£YD2) (Y1£Y2)£(YD1£YD2) (Y0£Y2))£¯K */
|
||||
matrixPtr->Dn = ((displayPtr[0].y - displayPtr[2].y) * (screenPtr[1].y - screenPtr[2].y)) -
|
||||
((displayPtr[1].y - displayPtr[2].y) * (screenPtr[0].y - screenPtr[2].y)) ;
|
||||
/* E£½((X0£X2) (YD1£YD2)£(YD0£YD2) (X1£X2))£¯K */
|
||||
matrixPtr->En = ((screenPtr[0].x - screenPtr[2].x) * (displayPtr[1].y - displayPtr[2].y)) -
|
||||
((displayPtr[0].y - displayPtr[2].y) * (screenPtr[1].x - screenPtr[2].x)) ;
|
||||
/* F£½(Y0(X2YD1£X1YD2)+Y1(X0YD2£X2YD0)+Y2(X1YD0£X0YD1))£¯K */
|
||||
matrixPtr->Fn = (screenPtr[2].x * displayPtr[1].y - screenPtr[1].x * displayPtr[2].y) * screenPtr[0].y +
|
||||
(screenPtr[0].x * displayPtr[2].y - screenPtr[2].x * displayPtr[0].y) * screenPtr[1].y +
|
||||
(screenPtr[1].x * displayPtr[0].y - screenPtr[0].x * displayPtr[1].y) * screenPtr[2].y ;
|
||||
}
|
||||
return( retTHRESHOLD ) ;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : getDisplayPoint
|
||||
* Description : Touch panel X Y to display X Y
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return :
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
FunctionalState getDisplayPoint(Coordinate * displayPtr,
|
||||
Coordinate * screenPtr,
|
||||
Matrix * matrixPtr )
|
||||
{
|
||||
FunctionalState retTHRESHOLD =ENABLE ;
|
||||
|
||||
if( matrixPtr->Divider != 0 )
|
||||
{
|
||||
/* XD = AX+BY+C */
|
||||
displayPtr->x = ( (matrixPtr->An * screenPtr->x) +
|
||||
(matrixPtr->Bn * screenPtr->y) +
|
||||
matrixPtr->Cn
|
||||
) / matrixPtr->Divider ;
|
||||
/* YD = DX+EY+F */
|
||||
displayPtr->y = ( (matrixPtr->Dn * screenPtr->x) +
|
||||
(matrixPtr->En * screenPtr->y) +
|
||||
matrixPtr->Fn
|
||||
) / matrixPtr->Divider ;
|
||||
}
|
||||
else
|
||||
{
|
||||
retTHRESHOLD = DISABLE;
|
||||
}
|
||||
return(retTHRESHOLD);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : delay_ms
|
||||
* Description : Delay Time
|
||||
* Input : - cnt: Delay Time
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
static void delay_ms(uint16_t ms)
|
||||
{
|
||||
uint16_t i,j;
|
||||
for( i = 0; i < ms; i++ )
|
||||
{
|
||||
for( j = 0; j < 0xffff; j++ );
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchPanel_Calibrate
|
||||
* Description :
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void TouchPanel_Calibrate(void)
|
||||
{
|
||||
uint8_t i;
|
||||
Coordinate * Ptr;
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
LCD_Clear(Black);
|
||||
GUI_Text(44,10,"Touch crosshair to calibrate",White,Black);
|
||||
delay_ms(300);
|
||||
DrawCross(DisplaySample[i].x,DisplaySample[i].y);
|
||||
do
|
||||
{
|
||||
Ptr=Read_Ads7846();
|
||||
}
|
||||
while( Ptr == (void*)0 );
|
||||
ScreenSample[i].x= Ptr->x; ScreenSample[i].y= Ptr->y;
|
||||
}
|
||||
setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix );
|
||||
LCD_Clear(Black);
|
||||
}
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
@@ -0,0 +1,66 @@
|
||||
/*********************************************************************************************************
|
||||
*
|
||||
* File : TouchPanel.h
|
||||
* Hardware Environment:
|
||||
* Build Environment : RealView MDK-ARM Version: 4.20
|
||||
* Version : V1.0
|
||||
* By :
|
||||
*
|
||||
* (c) Copyright 2005-2011, WaveShare
|
||||
* http://www.waveshare.net
|
||||
* All Rights Reserved
|
||||
*
|
||||
*********************************************************************************************************/
|
||||
|
||||
#ifndef _TOUCHPANEL_H_
|
||||
#define _TOUCHPANEL_H_
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
typedef struct POINT
|
||||
{
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
}Coordinate;
|
||||
|
||||
|
||||
typedef struct Matrix
|
||||
{
|
||||
long double An,
|
||||
Bn,
|
||||
Cn,
|
||||
Dn,
|
||||
En,
|
||||
Fn,
|
||||
Divider ;
|
||||
} Matrix ;
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
extern Coordinate ScreenSample[3];
|
||||
extern Coordinate DisplaySample[3];
|
||||
extern Matrix matrix ;
|
||||
extern Coordinate display ;
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
#define CHX 0x90
|
||||
#define CHY 0xd0
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
void TP_Init(void);
|
||||
Coordinate *Read_Ads7846(void);
|
||||
void TouchPanel_Calibrate(void);
|
||||
void DrawCross(uint16_t Xpos,uint16_t Ypos);
|
||||
void TP_DrawPoint(uint16_t Xpos,uint16_t Ypos);
|
||||
FunctionalState setCalibrationMatrix( Coordinate * displayPtr,Coordinate * screenPtr,Matrix * matrixPtr);
|
||||
FunctionalState getDisplayPoint(Coordinate * displayPtr,Coordinate * screenPtr,Matrix * matrixPtr );
|
||||
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stm32f4xx.h"
|
||||
/**
|
||||
* @brief Definition for TouchPanel
|
||||
*/
|
||||
/* Configure TouchPanel pins: TP_CS-> PC4 and TP_IRQ-> PC5 */
|
||||
|
||||
|
||||
#define Open_TP_CS_PIN GPIO_Pin_0
|
||||
#define Open_TP_CS_PORT GPIOI
|
||||
#define Open_TP_CS_CLK RCC_AHB1Periph_GPIOI
|
||||
|
||||
#define Open_TP_IRQ_PIN GPIO_Pin_6
|
||||
#define Open_TP_IRQ_PORT GPIOC
|
||||
#define Open_TP_IRQ_CLK RCC_AHB1Periph_GPIOC
|
||||
|
||||
|
||||
#define TP_CS(x) x ? GPIO_SetBits(Open_TP_CS_PORT,Open_TP_CS_PIN): GPIO_ResetBits(Open_TP_CS_PORT,Open_TP_CS_PIN)
|
||||
|
||||
#define TP_INT_IN GPIO_ReadInputDataBit(Open_TP_IRQ_PORT,Open_TP_IRQ_PIN)
|
||||
|
||||
/**
|
||||
* @brief Definition for TouchPanel SPI
|
||||
*/
|
||||
/* Configure TouchPanel pins: TP_CLK-> PB13 and TP_MISO-> PB14 and TP_MOSI-> PB15 */
|
||||
|
||||
#define Open_RCC_SPI RCC_APB1Periph_SPI2
|
||||
#define Open_GPIO_AF_SPI GPIO_AF_SPI2
|
||||
|
||||
#define Open_SPI SPI2
|
||||
#define Open_SPI_CLK_INIT RCC_APB1PeriphClockCmd
|
||||
#define Open_SPI_IRQn SPI2_IRQn
|
||||
#define Open_SPI_IRQHANDLER SPI2_IRQHandler
|
||||
|
||||
#define Open_SPI_SCK_PIN GPIO_Pin_1
|
||||
#define Open_SPI_SCK_GPIO_PORT GPIOI
|
||||
#define Open_SPI_SCK_GPIO_CLK RCC_AHB1Periph_GPIOI
|
||||
#define Open_SPI_SCK_SOURCE GPIO_PinSource1
|
||||
|
||||
#define Open_SPI_MISO_PIN GPIO_Pin_2
|
||||
#define Open_SPI_MISO_GPIO_PORT GPIOI
|
||||
#define Open_SPI_MISO_GPIO_CLK RCC_AHB1Periph_GPIOI
|
||||
#define Open_SPI_MISO_SOURCE GPIO_PinSource2
|
||||
|
||||
#define Open_SPI_MOSI_PIN GPIO_Pin_3
|
||||
#define Open_SPI_MOSI_GPIO_PORT GPIOI
|
||||
#define Open_SPI_MOSI_GPIO_CLK RCC_AHB1Periph_GPIOI
|
||||
#define Open_SPI_MOSI_SOURCE GPIO_PinSource3
|
||||
|
||||
#endif /*_CONFIG_H*/
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*********************************************************************************************************
|
||||
*
|
||||
* File : main.c
|
||||
* Hardware Environment:
|
||||
* Build Environment : RealView MDK-ARM Version: 4.20
|
||||
* Version : V1.0
|
||||
* By :
|
||||
*
|
||||
* (c) Copyright 2005-2011, WaveShare
|
||||
* http://www.waveshare.net
|
||||
* All Rights Reserved
|
||||
*
|
||||
*********************************************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx.h"
|
||||
#include "LCD/LCD.h"
|
||||
#include "TouchPanel/TouchPanel.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Delay
|
||||
* Description : Delay Time
|
||||
* Input : - nCount: Delay Time
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
void Delay (uint32_t nCount)
|
||||
{
|
||||
for(; nCount != 0; nCount--);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : main
|
||||
* Description : Main program
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Attention : None
|
||||
*******************************************************************************/
|
||||
int main(void)
|
||||
{
|
||||
TP_Init();
|
||||
LCD_Initializtion();
|
||||
LCD_Clear(Black);
|
||||
TouchPanel_Calibrate();
|
||||
/* Infinite loop */
|
||||
while (1)
|
||||
{
|
||||
getDisplayPoint(&display, Read_Ads7846(), &matrix );
|
||||
TP_DrawPoint(display.x,display.y);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
||||
/**
|
||||
* @brief Reports the name of the source file and the source line number
|
||||
* where the assert_param error has occurred.
|
||||
* @param file: pointer to the source file name
|
||||
* @param line: assert_param error line source number
|
||||
* @retval None
|
||||
*/
|
||||
void assert_failed(uint8_t* file, uint32_t line)
|
||||
{
|
||||
/* User can add his own implementation to report the file name and line number,
|
||||
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
|
||||
/* Infinite loop */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file I2C/EEPROM/stm32f4xx_conf.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 30-September-2011
|
||||
* @brief Library configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F4xx_CONF_H
|
||||
#define __STM32F4xx_CONF_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Uncomment the line below to enable peripheral header file inclusion */
|
||||
#include "stm32f4xx_adc.h"
|
||||
#include "stm32f4xx_can.h"
|
||||
#include "stm32f4xx_crc.h"
|
||||
#include "stm32f4xx_cryp.h"
|
||||
#include "stm32f4xx_dac.h"
|
||||
#include "stm32f4xx_dbgmcu.h"
|
||||
#include "stm32f4xx_dcmi.h"
|
||||
#include "stm32f4xx_dma.h"
|
||||
#include "stm32f4xx_exti.h"
|
||||
#include "stm32f4xx_flash.h"
|
||||
#include "stm32f4xx_fsmc.h"
|
||||
#include "stm32f4xx_hash.h"
|
||||
#include "stm32f4xx_gpio.h"
|
||||
#include "stm32f4xx_i2c.h"
|
||||
#include "stm32f4xx_iwdg.h"
|
||||
#include "stm32f4xx_pwr.h"
|
||||
#include "stm32f4xx_rcc.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_rtc.h"
|
||||
#include "stm32f4xx_sdio.h"
|
||||
#include "stm32f4xx_spi.h"
|
||||
#include "stm32f4xx_syscfg.h"
|
||||
#include "stm32f4xx_tim.h"
|
||||
#include "stm32f4xx_usart.h"
|
||||
#include "stm32f4xx_wwdg.h"
|
||||
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* If an external clock source is used, then the value of the following define
|
||||
should be set to the value of the external clock source, else, if no external
|
||||
clock is used, keep this define commented */
|
||||
/*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */
|
||||
|
||||
|
||||
/* Uncomment the line below to expanse the "assert_param" macro in the
|
||||
Standard Peripheral Library drivers code */
|
||||
/* #define USE_FULL_ASSERT 1 */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#endif /* __STM32F4xx_CONF_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file I2C/EEPROM/stm32f4xx_it.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 30-September-2011
|
||||
* @brief Main Interrupt Service Routines.
|
||||
* This file provides template for all exceptions handler and
|
||||
* peripherals interrupt service routine.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_it.h"
|
||||
|
||||
/** @addtogroup STM32F4xx_StdPeriph_Examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I2C_EEPROM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M4 Processor Exceptions Handlers */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles NMI exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard Fault exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Hard Fault exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory Manage exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Memory Manage exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Bus Fault exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Bus Fault exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Usage Fault exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Usage Fault exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles SVCall exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug Monitor exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles PendSVC exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles SysTick Handler.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles PPP interrupt request.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
/*void PPP_IRQHandler(void)
|
||||
{
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file I2C/EEPROM/stm32f4xx_it.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 30-September-2011
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F4xx_IT_H
|
||||
#define __STM32F4xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F4xx_IT_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user