本帖最后由 玩转STM32001 于 2016-3-31 11:11 编辑
#include "TFT.h"
#include "stm32f10x.h"
#include "delay.h"
//LCDµÄ» ±ÊÑÕÉ«ºÍ±³¾°É«
u16 POINT_COLOR=0x0000; //» ±ÊÑÕÉ«
u16 BACK_COLOR=0xFFFF; //±³¾°É«
//¹ÜÀíLCDÖØÒª²ÎÊý
//ĬÈÏΪÊúÆÁ
_lcd_dev lcddev;
//³£ÓÃASCII±í
//Æ«ÒÆÁ¿32
//ASCII×Ö·û¼¯
//Æ«ÒÆÁ¿32
//´óС:12*6
const unsigned char asc2_1206[95][12]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x3F,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x40,0x00,0x00,0x00},/*""",2*/
{0x09,0x00,0x0B,0xC0,0x3D,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00},/*"#",3*/
{0x18,0xC0,0x24,0x40,0x7F,0xE0,0x22,0x40,0x31,0x80,0x00,0x00},/*"$",4*/
{0x18,0x00,0x24,0xC0,0x1B,0x00,0x0D,0x80,0x32,0x40,0x01,0x80},/*"%",5*/
{0x03,0x80,0x1C,0x40,0x27,0x40,0x1C,0x80,0x07,0x40,0x00,0x40},/*"&",6*/
{0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x40,0x20},/*"(",8*/
{0x00,0x00,0x40,0x20,0x20,0x40,0x1F,0x80,0x00,0x00,0x00,0x00},/*")",9*/
{0x09,0x00,0x06,0x00,0x1F,0x80,0x06,0x00,0x09,0x00,0x00,0x00},/*"*",10*/
{0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x00,0x00},/*"+",11*/
{0x00,0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x20,0x01,0xC0,0x06,0x00,0x38,0x00,0x40,0x00,0x00,0x00},/*"/",15*/
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"0",16*/
{0x00,0x00,0x10,0x40,0x3F,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"1",17*/
{0x18,0xC0,0x21,0x40,0x22,0x40,0x24,0x40,0x18,0x40,0x00,0x00},/*"2",18*/
{0x10,0x80,0x20,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"3",19*/
{0x02,0x00,0x0D,0x00,0x11,0x00,0x3F,0xC0,0x01,0x40,0x00,0x00},/*"4",20*/
{0x3C,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x23,0x80,0x00,0x00},/*"5",21*/
{0x1F,0x80,0x24,0x40,0x24,0x40,0x34,0x40,0x03,0x80,0x00,0x00},/*"6",22*/
{0x30,0x00,0x20,0x00,0x27,0xC0,0x38,0x00,0x20,0x00,0x00,0x00},/*"7",23*/
{0x1B,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"8",24*/
{0x1C,0x00,0x22,0xC0,0x22,0x40,0x22,0x40,0x1F,0x80,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x04,0x60,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40},/*"<",28*/
{0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x00,0x00},/*"=",29*/
{0x00,0x00,0x40,0x40,0x20,0x80,0x11,0x00,0x0A,0x00,0x04,0x00},/*">",30*/
{0x18,0x00,0x20,0x00,0x23,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"?",31*/
{0x1F,0x80,0x20,0x40,0x27,0x40,0x29,0x40,0x1F,0x40,0x00,0x00},/*"@",32*/
{0x00,0x40,0x07,0xC0,0x39,0x00,0x0F,0x00,0x01,0xC0,0x00,0x40},/*"A",33*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"B",34*/
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0x80,0x00,0x00},/*"C",35*/
{0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"D",36*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x40,0x30,0xC0,0x00,0x00},/*"E",37*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x00,0x30,0x00,0x00,0x00},/*"F",38*/
{0x0F,0x00,0x10,0x80,0x20,0x40,0x22,0x40,0x33,0x80,0x02,0x00},/*"G",39*/
{0x20,0x40,0x3F,0xC0,0x04,0x00,0x04,0x00,0x3F,0xC0,0x20,0x40},/*"H",40*/
{0x20,0x40,0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x00,0x00},/*"I",41*/
{0x00,0x60,0x20,0x20,0x20,0x20,0x3F,0xC0,0x20,0x00,0x20,0x00},/*"J",42*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x0B,0x00,0x30,0xC0,0x20,0x40},/*"K",43*/
{0x20,0x40,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0xC0},/*"L",44*/
{0x3F,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x3F,0xC0,0x00,0x00},/*"M",45*/
{0x20,0x40,0x3F,0xC0,0x0C,0x40,0x23,0x00,0x3F,0xC0,0x20,0x00},/*"N",46*/
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"O",47*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"
",48*/
{0x1F,0x80,0x21,0x40,0x21,0x40,0x20,0xE0,0x1F,0xA0,0x00,0x00},/*"Q",49*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x26,0x00,0x19,0xC0,0x00,0x40},/*"R",50*/
{0x18,0xC0,0x24,0x40,0x24,0x40,0x22,0x40,0x31,0x80,0x00,0x00},/*"S",51*/
{0x30,0x00,0x20,0x40,0x3F,0xC0,0x20,0x40,0x30,0x00,0x00,0x00},/*"T",52*/
{0x20,0x00,0x3F,0x80,0x00,0x40,0x00,0x40,0x3F,0x80,0x20,0x00},/*"U",53*/
{0x20,0x00,0x3E,0x00,0x01,0xC0,0x07,0x00,0x38,0x00,0x20,0x00},/*"V",54*/
{0x38,0x00,0x07,0xC0,0x3C,0x00,0x07,0xC0,0x38,0x00,0x00,0x00},/*"W",55*/
{0x20,0x40,0x39,0xC0,0x06,0x00,0x39,0xC0,0x20,0x40,0x00,0x00},/*"X",56*/
{0x20,0x00,0x38,0x40,0x07,0xC0,0x38,0x40,0x20,0x00,0x00,0x00},/*"Y",57*/
{0x30,0x40,0x21,0xC0,0x26,0x40,0x38,0x40,0x20,0xC0,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x7F,0xE0,0x40,0x20,0x40,0x20,0x00,0x00},/*"[",59*/
{0x00,0x00,0x70,0x00,0x0C,0x00,0x03,0x80,0x00,0x40,0x00,0x00},/*"",60*/
{0x00,0x00,0x40,0x20,0x40,0x20,0x7F,0xE0,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x20,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10},/*"_",63*/
{0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x02,0x80,0x05,0x40,0x05,0x40,0x03,0xC0,0x00,0x40},/*"a",65*/
{0x20,0x00,0x3F,0xC0,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"b",66*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x06,0x40,0x00,0x00},/*"c",67*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x24,0x40,0x3F,0xC0,0x00,0x40},/*"d",68*/
{0x00,0x00,0x03,0x80,0x05,0x40,0x05,0x40,0x03,0x40,0x00,0x00},/*"e",69*/
{0x00,0x00,0x04,0x40,0x1F,0xC0,0x24,0x40,0x24,0x40,0x20,0x00},/*"f",70*/
{0x00,0x00,0x02,0xE0,0x05,0x50,0x05,0x50,0x06,0x50,0x04,0x20},/*"g",71*/
{0x20,0x40,0x3F,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"h",72*/
{0x00,0x00,0x04,0x40,0x27,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"i",73*/
{0x00,0x10,0x00,0x10,0x04,0x10,0x27,0xE0,0x00,0x00,0x00,0x00},/*"j",74*/
{0x20,0x40,0x3F,0xC0,0x01,0x40,0x07,0x00,0x04,0xC0,0x04,0x40},/*"k",75*/
{0x20,0x40,0x20,0x40,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x00},/*"l",76*/
{0x07,0xC0,0x04,0x00,0x07,0xC0,0x04,0x00,0x03,0xC0,0x00,0x00},/*"m",77*/
{0x04,0x40,0x07,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"n",78*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"o",79*/
{0x04,0x10,0x07,0xF0,0x04,0x50,0x04,0x40,0x03,0x80,0x00,0x00},/*"p",80*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x50,0x07,0xF0,0x00,0x10},/*"q",81*/
{0x04,0x40,0x07,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x00,0x00},/*"r",82*/
{0x00,0x00,0x06,0x40,0x05,0x40,0x05,0x40,0x04,0xC0,0x00,0x00},/*"s",83*/
{0x00,0x00,0x04,0x00,0x1F,0x80,0x04,0x40,0x00,0x40,0x00,0x00},/*"t",84*/
{0x04,0x00,0x07,0x80,0x00,0x40,0x04,0x40,0x07,0xC0,0x00,0x40},/*"u",85*/
{0x04,0x00,0x07,0x00,0x04,0xC0,0x01,0x80,0x06,0x00,0x04,0x00},/*"v",86*/
{0x06,0x00,0x01,0xC0,0x07,0x00,0x01,0xC0,0x06,0x00,0x00,0x00},/*"w",87*/
{0x04,0x40,0x06,0xC0,0x01,0x00,0x06,0xC0,0x04,0x40,0x00,0x00},/*"x",88*/
{0x04,0x10,0x07,0x10,0x04,0xE0,0x01,0x80,0x06,0x00,0x04,0x00},/*"y",89*/
{0x00,0x00,0x04,0x40,0x05,0xC0,0x06,0x40,0x04,0x40,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x04,0x00,0x7B,0xE0,0x40,0x20,0x00,0x00},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x40,0x20,0x7B,0xE0,0x04,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x40,0x00},/*"~",94*/
};
const unsigned char asc2_1608[95][16]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCC,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x00,0x00},/*""",2*/
{0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x00,0x00},/*"#",3*/
{0x00,0x00,0x0E,0x18,0x11,0x04,0x3F,0xFF,0x10,0x84,0x0C,0x78,0x00,0x00,0x00,0x00},/*"$",4*/
{0x0F,0x00,0x10,0x84,0x0F,0x38,0x00,0xC0,0x07,0x78,0x18,0x84,0x00,0x78,0x00,0x00},/*"%",5*/
{0x00,0x78,0x0F,0x84,0x10,0xC4,0x11,0x24,0x0E,0x98,0x00,0xE4,0x00,0x84,0x00,0x08},/*"&",6*/
{0x08,0x00,0x68,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x18,0x18,0x20,0x04,0x40,0x02,0x00,0x00},/*"(",8*/
{0x00,0x00,0x40,0x02,0x20,0x04,0x18,0x18,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
{0x02,0x40,0x02,0x40,0x01,0x80,0x0F,0xF0,0x01,0x80,0x02,0x40,0x02,0x40,0x00,0x00},/*"*",10*/
{0x00,0x80,0x00,0x80,0x00,0x80,0x0F,0xF8,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00},/*"+",11*/
{0x00,0x01,0x00,0x0D,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80},/*"-",13*/
{0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00},/*"/",15*/
{0x00,0x00,0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"0",16*/
{0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"1",17*/
{0x00,0x00,0x0E,0x0C,0x10,0x14,0x10,0x24,0x10,0x44,0x11,0x84,0x0E,0x0C,0x00,0x00},/*"2",18*/
{0x00,0x00,0x0C,0x18,0x10,0x04,0x11,0x04,0x11,0x04,0x12,0x88,0x0C,0x70,0x00,0x00},/*"3",19*/
{0x00,0x00,0x00,0xE0,0x03,0x20,0x04,0x24,0x08,0x24,0x1F,0xFC,0x00,0x24,0x00,0x00},/*"4",20*/
{0x00,0x00,0x1F,0x98,0x10,0x84,0x11,0x04,0x11,0x04,0x10,0x88,0x10,0x70,0x00,0x00},/*"5",21*/
{0x00,0x00,0x07,0xF0,0x08,0x88,0x11,0x04,0x11,0x04,0x18,0x88,0x00,0x70,0x00,0x00},/*"6",22*/
{0x00,0x00,0x1C,0x00,0x10,0x00,0x10,0xFC,0x13,0x00,0x1C,0x00,0x10,0x00,0x00,0x00},/*"7",23*/
{0x00,0x00,0x0E,0x38,0x11,0x44,0x10,0x84,0x10,0x84,0x11,0x44,0x0E,0x38,0x00,0x00},/*"8",24*/
{0x00,0x00,0x07,0x00,0x08,0x8C,0x10,0x44,0x10,0x44,0x08,0x88,0x07,0xF0,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x03,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x00,0x80,0x01,0x40,0x02,0x20,0x04,0x10,0x08,0x08,0x10,0x04,0x00,0x00},/*"<",28*/
{0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x00,0x00},/*"=",29*/
{0x00,0x00,0x10,0x04,0x08,0x08,0x04,0x10,0x02,0x20,0x01,0x40,0x00,0x80,0x00,0x00},/*">",30*/
{0x00,0x00,0x0E,0x00,0x12,0x00,0x10,0x0C,0x10,0x6C,0x10,0x80,0x0F,0x00,0x00,0x00},/*"?",31*/
{0x03,0xE0,0x0C,0x18,0x13,0xE4,0x14,0x24,0x17,0xC4,0x08,0x28,0x07,0xD0,0x00,0x00},/*"@",32*/
{0x00,0x04,0x00,0x3C,0x03,0xC4,0x1C,0x40,0x07,0x40,0x00,0xE4,0x00,0x1C,0x00,0x04},/*"A",33*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x11,0x04,0x0E,0x88,0x00,0x70,0x00,0x00},/*"B",34*/
{0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x08,0x1C,0x10,0x00,0x00},/*"C",35*/
{0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"D",36*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x17,0xC4,0x10,0x04,0x08,0x18,0x00,0x00},/*"E",37*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x17,0xC0,0x10,0x00,0x08,0x00,0x00,0x00},/*"F",38*/
{0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x44,0x1C,0x78,0x00,0x40,0x00,0x00},/*"G",39*/
{0x10,0x04,0x1F,0xFC,0x10,0x84,0x00,0x80,0x00,0x80,0x10,0x84,0x1F,0xFC,0x10,0x04},/*"H",40*/
{0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x00,0x00,0x00,0x00},/*"I",41*/
{0x00,0x03,0x00,0x01,0x10,0x01,0x10,0x01,0x1F,0xFE,0x10,0x00,0x10,0x00,0x00,0x00},/*"J",42*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x03,0x80,0x14,0x64,0x18,0x1C,0x10,0x04,0x00,0x00},/*"K",43*/
{0x10,0x04,0x1F,0xFC,0x10,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x0C,0x00,0x00},/*"L",44*/
{0x10,0x04,0x1F,0xFC,0x1F,0x00,0x00,0xFC,0x1F,0x00,0x1F,0xFC,0x10,0x04,0x00,0x00},/*"M",45*/
{0x10,0x04,0x1F,0xFC,0x0C,0x04,0x03,0x00,0x00,0xE0,0x10,0x18,0x1F,0xFC,0x10,0x00},/*"N",46*/
{0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"O",47*/
{0x10,0x04,0x1F,0xFC,0x10,0x84,0x10,0x80,0x10,0x80,0x10,0x80,0x0F,0x00,0x00,0x00},/*"
",48*/
{0x07,0xF0,0x08,0x18,0x10,0x24,0x10,0x24,0x10,0x1C,0x08,0x0A,0x07,0xF2,0x00,0x00},/*"Q",49*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x11,0xC0,0x11,0x30,0x0E,0x0C,0x00,0x04},/*"R",50*/
{0x00,0x00,0x0E,0x1C,0x11,0x04,0x10,0x84,0x10,0x84,0x10,0x44,0x1C,0x38,0x00,0x00},/*"S",51*/
{0x18,0x00,0x10,0x00,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x00,0x18,0x00,0x00,0x00},/*"T",52*/
{0x10,0x00,0x1F,0xF8,0x10,0x04,0x00,0x04,0x00,0x04,0x10,0x04,0x1F,0xF8,0x10,0x00},/*"U",53*/
{0x10,0x00,0x1E,0x00,0x11,0xE0,0x00,0x1C,0x00,0x70,0x13,0x80,0x1C,0x00,0x10,0x00},/*"V",54*/
{0x1F,0xC0,0x10,0x3C,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x10,0x3C,0x1F,0xC0,0x00,0x00},/*"W",55*/
{0x10,0x04,0x18,0x0C,0x16,0x34,0x01,0xC0,0x01,0xC0,0x16,0x34,0x18,0x0C,0x10,0x04},/*"X",56*/
{0x10,0x00,0x1C,0x00,0x13,0x04,0x00,0xFC,0x13,0x04,0x1C,0x00,0x10,0x00,0x00,0x00},/*"Y",57*/
{0x08,0x04,0x10,0x1C,0x10,0x64,0x10,0x84,0x13,0x04,0x1C,0x04,0x10,0x18,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x40,0x02,0x40,0x02,0x40,0x02,0x00,0x00},/*"[",59*/
{0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x80,0x00,0x60,0x00,0x1C,0x00,0x03,0x00,0x00},/*"",60*/
{0x00,0x00,0x40,0x02,0x40,0x02,0x40,0x02,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00},/*"^",62*/
{0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01},/*"_",63*/
{0x00,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x00,0x98,0x01,0x24,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xFC,0x00,0x04},/*"a",65*/
{0x10,0x00,0x1F,0xFC,0x00,0x88,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00},/*"b",66*/
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x00},/*"c",67*/
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x11,0x08,0x1F,0xFC,0x00,0x04},/*"d",68*/
{0x00,0x00,0x00,0xF8,0x01,0x44,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xC8,0x00,0x00},/*"e",69*/
{0x00,0x00,0x01,0x04,0x01,0x04,0x0F,0xFC,0x11,0x04,0x11,0x04,0x11,0x00,0x18,0x00},/*"f",70*/
{0x00,0x00,0x00,0xD6,0x01,0x29,0x01,0x29,0x01,0x29,0x01,0xC9,0x01,0x06,0x00,0x00},/*"g",71*/
{0x10,0x04,0x1F,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04},/*"h",72*/
{0x00,0x00,0x01,0x04,0x19,0x04,0x19,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x03,0x00,0x01,0x01,0x01,0x19,0x01,0x19,0xFE,0x00,0x00,0x00,0x00},/*"j",74*/
{0x10,0x04,0x1F,0xFC,0x00,0x24,0x00,0x40,0x01,0xB4,0x01,0x0C,0x01,0x04,0x00,0x00},/*"k",75*/
{0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"l",76*/
{0x01,0x04,0x01,0xFC,0x01,0x04,0x01,0x00,0x01,0xFC,0x01,0x04,0x01,0x00,0x00,0xFC},/*"m",77*/
{0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04},/*"n",78*/
{0x00,0x00,0x00,0xF8,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0xF8,0x00,0x00},/*"o",79*/
{0x01,0x01,0x01,0xFF,0x00,0x85,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00},/*"p",80*/
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x05,0x01,0xFF,0x00,0x01},/*"q",81*/
{0x01,0x04,0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x04,0x01,0x00,0x01,0x80,0x00,0x00},/*"r",82*/
{0x00,0x00,0x00,0xCC,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x98,0x00,0x00},/*"s",83*/
{0x00,0x00,0x01,0x00,0x01,0x00,0x07,0xF8,0x01,0x04,0x01,0x04,0x00,0x00,0x00,0x00},/*"t",84*/
{0x01,0x00,0x01,0xF8,0x00,0x04,0x00,0x04,0x00,0x04,0x01,0x08,0x01,0xFC,0x00,0x04},/*"u",85*/
{0x01,0x00,0x01,0x80,0x01,0x70,0x00,0x0C,0x00,0x10,0x01,0x60,0x01,0x80,0x01,0x00},/*"v",86*/
{0x01,0xF0,0x01,0x0C,0x00,0x30,0x01,0xC0,0x00,0x30,0x01,0x0C,0x01,0xF0,0x01,0x00},/*"w",87*/
{0x00,0x00,0x01,0x04,0x01,0x8C,0x00,0x74,0x01,0x70,0x01,0x8C,0x01,0x04,0x00,0x00},/*"x",88*/
{0x01,0x01,0x01,0x81,0x01,0x71,0x00,0x0E,0x00,0x18,0x01,0x60,0x01,0x80,0x01,0x00},/*"y",89*/
{0x00,0x00,0x01,0x84,0x01,0x0C,0x01,0x34,0x01,0x44,0x01,0x84,0x01,0x0C,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x3E,0xFC,0x40,0x02,0x40,0x02},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x40,0x02,0x40,0x02,0x3E,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x60,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00},/*"~",94*/
};
//д¼Ä´æÆ÷º¯Êý
//regval:¼Ä´æÆ÷Öµ
void LCD_WR_REG(u16 regval)
{
LCD->LCD_REG=regval;//дÈëҪдµÄ¼Ä´æÆ÷ÐòºÅ
}
//дLCDÊý¾Ý
//data:ҪдÈëµÄÖµ
void LCD_WR_DATA(u16 data)
{
LCD->LCD_RAM=data;
}
//¶ÁLCDÊý¾Ý
//·µ»ØÖµ:¶Áµ½µÄÖµ
u16 LCD_RD_DATA(void)
{
return LCD->LCD_RAM;
}
//д¼Ä´æÆ÷
//LCD_WR_REG:¼Ä´æÆ÷µØÖ·
//LCD_WR_REGValue:ҪдÈëµÄÊý¾Ý
void LCD_WriteReg(u16 LCD_WR_REG, u16 LCD_WR_REGValue)
{
LCD->LCD_REG = LCD_WR_REG; //дÈëҪдµÄ¼Ä´æÆ÷ÐòºÅ
LCD->LCD_RAM = LCD_WR_REGValue;//дÈëÊý¾
}
//¶Á¼Ä´æÆ÷
//LCD_Reg:¼Ä´æÆ÷µØÖ·
//·µ»ØÖµ:¶Áµ½µÄÊý¾Ý
u16 LCD_ReadReg(u8 LCD_Reg)
{
LCD_WR_REG(LCD_Reg); //дÈëÒª¶ÁµÄ¼Ä´æÆ÷ÐòºÅ
delay_us(5);
return LCD_RD_DATA(); //·µ»Ø¶Áµ½µÄÖµ
}
//¿ªÊ¼Ð´GRAM
void LCD_WriteRAM_Prepare(void)
{
LCD->LCD_REG=lcddev.wramcmd;
}
//LCDдGRAM
//RGB_Code:ÑÕÉ«Öµ
void LCD_WriteRAM(u16 RGB_Code)
{
LCD->LCD_RAM = RGB_Code;//дʮÁùλGRAM
}
//´ÓILI93xx¶Á³öµÄÊý¾ÝΪGBR¸ñʽ£¬¶øÎÒÃÇдÈëµÄʱºòΪRGB¸ñʽ¡£
//ͨ¹ý¸Ãº¯Êýת»»
//c:GBR¸ñʽµÄÑÕÉ«Öµ
//·µ»ØÖµ£ºRGB¸ñʽµÄÑÕÉ«Öµ
u16 LCD_BGR2RGB(u16 c)
{
u16 r,g,b,rgb;
b=(c>>0)&0x1f;
g=(c>>5)&0x3f;
r=(c>>11)&0x1f;
rgb=(b<<11)+(g<<5)+(r<<0);
return(rgb);
}
//µ±mdk -O1ʱ¼äÓÅ»¯Ê±ÐèÒªÉèÖÃ
//ÑÓʱi
void opt_delay(u8 i)
{
while(i--);
}
//¶ÁÈ¡¸öijµãµÄÑÕÉ«Öµ
//x,y:×ø±ê
//·µ»ØÖµ:´ËµãµÄÑÕÉ«
u16 LCD_ReadPoint(u16 x,u16 y)
{
u16 r=0,g=0,b=0;
if(x>=lcddev.width||y>=lcddev.height)return 0; //³¬¹ýÁË·¶Î§,Ö±½Ó·µ»Ø
LCD_SetCursor(x,y);
if(lcddev.id==0X9341||lcddev.id==0X1529||lcddev.id==0X9342||lcddev.id==0X9338||lcddev.id==0X6804||lcddev.id==0X8009||lcddev.id==0X9486||lcddev.id==0X9481||lcddev.id==0X9487||lcddev.id==0X1581||lcddev.id==0X9327)LCD_WR_REG(0X2E);//9341/6804 ·¢ËͶÁGRAMÖ¸Áî
else LCD_WR_REG(R34); //ÆäËûIC·¢ËͶÁGRAMÖ¸Áî
if(lcddev.id==0X9320)opt_delay(2); //FOR 9320,ÑÓʱ2us
if(LCD->LCD_RAM)r=0; //dummy Read
opt_delay(2);
r=LCD->LCD_RAM; //ʵ¼Ê×ø±êÑÕÉ«
if(lcddev.id==0X9341||lcddev.id==0X9342||lcddev.id==0X9338)//9341Òª·Ö2´Î¶Á³ö
{
opt_delay(2);
b=LCD->LCD_RAM;
g=r&0XFF;//¶ÔÓÚ9341,µÚÒ»´Î¶ÁÈ¡µÄÊÇRGµÄÖµ,RÔÚÇ°,GÔÚºó,¸÷Õ¼8λ
g<<=8;
}else if(lcddev.id==0X6804||lcddev.id==0X8357||lcddev.id==0X9486||lcddev.id==0X1529||lcddev.id==0X9481||lcddev.id==0X9487||lcddev.id==0X1581)r=LCD->LCD_RAM;//6804µÚ¶þ´Î¶ÁÈ¡µÄ²ÅÊÇÕæʵֵ
if(lcddev.id==0X9325||lcddev.id==0X4535||lcddev.id==0X4531||lcddev.id==0X8989||lcddev.id==0XB505)return r;//Õ⼸ÖÖICÖ±½Ó·µ»ØÑÕÉ«Öµ
else if(lcddev.id==0X9341||lcddev.id==0X9342||lcddev.id==0X9338)return (((r>>11)<<11)|((g>>10)<<5)|(b>>11)); //ILI9341ÐèÒª¹«Ê½×ª»»Ò»ÏÂ
else return LCD_BGR2RGB(r); //ÆäËûIC
}
//LCD¿ªÆôÏÔʾ
void LCD_DisplayOn(void)
{
LCD_WR_REG(0X2900); //¿ªÆôÏÔʾ//¿ªÆôÏÔʾ
}
//LCD¹Ø±ÕÏÔʾ
void LCD_DisplayOff(void)
{
LCD_WR_REG(0X2800); //¹Ø±ÕÏÔʾ//¹Ø±ÕÏÔʾ
}
//ÉèÖùâ±êλÖÃ
//Xpos:ºá×ø±ê
//Ypos:×Ý×ø±ê
void LCD_SetCursor(u16 Xpos, u16 Ypos)
{
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(Xpos>>8);
LCD_WR_REG(lcddev.setxcmd+1);
LCD_WR_DATA(Xpos&0XFF);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(Ypos>>8);
LCD_WR_REG(lcddev.setycmd+1);
LCD_WR_DATA(Ypos&0XFF);
}
void Set_windows(u16 xs,u16 xe,u16 ys,u16 ye)
{
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(xs>>8);
LCD_WR_REG(lcddev.setxcmd+1);
LCD_WR_DATA(xs&0x00ff);
LCD_WR_REG(lcddev.setxcmd+2);
LCD_WR_DATA(xe>>8);
LCD_WR_REG(lcddev.setxcmd+3);
LCD_WR_DATA(xe&0x00ff);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(ys>>8);
LCD_WR_REG(lcddev.setycmd+1);
LCD_WR_DATA(ys&0x00ff);
LCD_WR_REG(lcddev.setycmd+2);
LCD_WR_DATA(ye>>8);
LCD_WR_REG(lcddev.setycmd+3);
LCD_WR_DATA(ye&0x00ff);
}
//ÉèÖÃLCDµÄ×Ô¶¯É¨Ãè·½Ïò
//×¢Òâ:ÆäËûº¯Êý¿ÉÄÜ»áÊܵ½´Ëº¯ÊýÉèÖõÄÓ°Ïì(ÓÈÆäÊÇ9341/6804ÕâÁ½¸öÆæÝâ),
//ËùÒÔ,Ò»°ãÉèÖÃΪL2R_U2D¼´¿É,Èç¹ûÉèÖÃΪÆäËûɨÃ跽ʽ,¿ÉÄܵ¼ÖÂÏÔʾ²»Õý³£.
//dir:0~7,´ú±í8¸ö·½Ïò(¾ßÌ嶨Òå¼ûlcd.h)
//9320/9325/9328/4531/4535/1505/b505/8989/5408/9341µÈICÒѾ ʵ¼Ê²âÊÔ
void LCD_Scan_Dir(u8 dir)
{
u16 regval=0;
u16 dirreg=0;
u16 temp;
switch(dir)
{
case L2R_U2D://´Ó×óµ½ÓÒ,´ÓÉϵ½ÏÂ
regval|=(0<<7)|(0<<6)|(0<<5);
break;
case L2R_D2U://´Ó×óµ½ÓÒ,´Óϵ½ÉÏ
regval|=(1<<7)|(0<<6)|(0<<5);
break;
case R2L_U2D://´ÓÓÒµ½×ó,´ÓÉϵ½ÏÂ
regval|=(0<<7)|(1<<6)|(0<<5);
break;
case R2L_D2U://´ÓÓÒµ½×ó,´Óϵ½ÉÏ
regval|=(1<<7)|(1<<6)|(0<<5);
break;
case U2D_L2R://´ÓÉϵ½ÏÂ,´Ó×óµ½ÓÒ
regval|=(0<<7)|(0<<6)|(1<<5);
break;
case U2D_R2L://´ÓÉϵ½ÏÂ,´ÓÓÒµ½×ó
regval|=(0<<7)|(1<<6)|(1<<5);
break;
case D2U_L2R://´Óϵ½ÉÏ,´Ó×óµ½ÓÒ
regval|=(1<<7)|(0<<6)|(1<<5);
break;
case D2U_R2L://´Óϵ½ÉÏ,´ÓÓÒµ½×ó
regval|=(1<<7)|(1<<6)|(1<<5);
break;
}
dirreg=0X3A00;
//regval|=0X08;//BGR
LCD_WriteReg(dirreg,regval);
if((regval&0X20)||lcddev.dir==1)
{
if(lcddev.width<lcddev.height)//½»»»X,Y
{
temp=lcddev.width;
lcddev.width=lcddev.height;
lcddev.height=temp;
}
}else
{
if(lcddev.width>lcddev.height)//½»»»X,Y
{
temp=lcddev.width;
lcddev.width=lcddev.height;
lcddev.height=temp;
}
}
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(0);
LCD_WR_REG(lcddev.setxcmd+1);
LCD_WR_DATA(0);
LCD_WR_REG(lcddev.setxcmd+2);
LCD_WR_DATA((lcddev.width-1)>>8);
LCD_WR_REG(lcddev.setxcmd+3);
LCD_WR_DATA((lcddev.width-1)&0XFF);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(0);
LCD_WR_REG(lcddev.setycmd+1);
LCD_WR_DATA(0);
LCD_WR_REG(lcddev.setycmd+2);
LCD_WR_DATA((lcddev.height-1)>>8);
LCD_WR_REG(lcddev.setycmd+3);
LCD_WR_DATA((lcddev.height-1)&0XFF);
}
//» µã
//x,y:×ø±ê
//POINT_COLOR:´ËµãµÄÑÕÉ«
void LCD_DrawPoint(u16 x,u16 y)
{
Set_windows(x,x+1,y,y+1);//LCD_SetCursor(x,y); //ÉèÖùâ±êλÖÃ
LCD_WriteRAM_Prepare(); //¿ªÊ¼Ð´ÈëGRAM
LCD->LCD_RAM=POINT_COLOR;
}
//¿ìËÙ» µã
//x,y:×ø±ê
//color:ÑÕÉ«
void LCD_Fast_DrawPoint(u16 x,u16 y,u16 color)
{
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(x>>8);
LCD_WR_DATA(x&0XFF);
LCD_WR_DATA((lcddev.width-1)>>8);
LCD_WR_DATA((lcddev.width-1)&0XFF);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(y>>8);
LCD_WR_DATA(y&0XFF);
LCD_WR_DATA((lcddev.height-1)>>8);
LCD_WR_DATA((lcddev.height-1)&0XFF);
LCD->LCD_REG=lcddev.wramcmd;
LCD->LCD_RAM=color;
}
//ÉèÖÃLCDÏÔʾ·½Ïò
//dir:0,ÊúÆÁ£»1,ºáÆÁ
void LCD_Display_Dir(u8 dir)
{
if(dir==0)//ÊúÆÁ
{
lcddev.dir=0;//ÊúÆÁ
lcddev.wramcmd=0X2C00;
lcddev.setxcmd=0X2A00;
lcddev.setycmd=0X2B00;
lcddev.width=480;
lcddev.height=854;
}else //ºáÆÁ
{
lcddev.dir=1; //ºáÆÁ
lcddev.wramcmd=0X2C00;
lcddev.setxcmd=0X2A00;
lcddev.setycmd=0X2B00;
lcddev.width=854;
lcddev.height=480;
}
LCD_Scan_Dir(DFT_SCAN_DIR); //ĬÈÏɨÃè·½Ïò
}
//³õʼ»¯lcd
//¸Ã³õʼ»¯º¯Êý¿ÉÒÔ³õʼ»¯¸÷ÖÖILI93XXÒº¾§,µ«ÊÇÆäËûº¯ÊýÊÇ»ùÓÚILI9320µÄ!!!
//ÔÚÆäËûÐͺŵÄÇý¶¯Ð¾Æ¬ÉÏûÓвâÊÔ!
void LCD_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
FSMC_NORSRAMTimingInitTypeDef readWriteTiming;
FSMC_NORSRAMTimingInitTypeDef writeTiming;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC,ENABLE); //ʹÄÜFSMCʱÖÓ
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOE|RCC_APB2Periph_GPIOG|RCC_APB2Periph_AFIO,ENABLE);//ʹÄÜ
ORTB,D,E,GÒÔ¼°AFIO¸´Óù¦ÄÜʱÖÓ
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; //PB0 ÍÆÍìÊä³ö ±³¹â
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //ÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
//PORTD¸´ÓÃÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_14|GPIO_Pin_15; // //PORTD¸´ÓÃÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //¸´ÓÃÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure);
//PORTE¸´ÓÃÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15; // //PORTD¸´ÓÃÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //¸´ÓÃÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
// //PORTG12¸´ÓÃÍÆÍìÊä³ö A0
//GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_12; // //PORTD¸´ÓÃÍÆÍìÊä³ö
//GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //¸´ÓÃÍÆÍìÊä³ö
//GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//GPIO_Init(GPIOG, &GPIO_InitStructure);
readWriteTiming.FSMC_AddressSetupTime = 0x05; //µØÖ·½¨Á¢Ê±¼ä£¨ADDSET£©Îª2¸öHCLK 1/36M=27ns
readWriteTiming.FSMC_AddressHoldTime = 0x00; //µØÖ·±£³Öʱ¼ä£¨ADDHLD£©Ä£Ê½AδÓõ½
readWriteTiming.FSMC_DataSetupTime = 0x09; // Êý¾Ý±£´æʱ¼äΪ16¸öHCLK,ÒòΪҺ¾§Çý¶¯ICµÄ¶ÁÊý¾ÝµÄʱºò£¬ËٶȲ»ÄÜÌ«¿ì£¬ÓÈÆä¶Ô1289Õâ¸öIC¡£
readWriteTiming.FSMC_BusTurnAroundDuration = 0x00;
readWriteTiming.FSMC_CLKDivision = 0x00;
readWriteTiming.FSMC_DataLatency = 0x00;
readWriteTiming.FSMC_AccessMode = FSMC_AccessMode_A; //ģʽA
writeTiming.FSMC_AddressSetupTime = 0X1f; //µØÖ·½¨Á¢Ê±¼ä£¨ADDSET£©Îª1¸öHCLK
writeTiming.FSMC_AddressHoldTime = 0X00; //µØÖ·±£³Öʱ¼ä£¨A
writeTiming.FSMC_DataSetupTime = 0X1f; ////Êý¾Ý±£´æʱ¼äΪ4¸öHCLK
writeTiming.FSMC_BusTurnAroundDuration = 0x00;
writeTiming.FSMC_CLKDivision = 0x00;
writeTiming.FSMC_DataLatency = 0x00;
writeTiming.FSMC_AccessMode = FSMC_AccessMode_A; //ģʽA
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;// ÕâÀïÎÒÃÇʹÓÃNE4 £¬Ò²¾Í¶ÔÓ¦BTCR[6],[7]¡£
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; // ²»¸´ÓÃÊý¾ÝµØÖ·
FSMC_NORSRAMInitStructure.FSMC_MemoryType =FSMC_MemoryType_SRAM;// FSMC_MemoryType_SRAM; //SRAM
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;//´æ´¢Æ÷Êý¾Ý¿í¶ÈΪ16bit
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode =FSMC_BurstAccessMode_Disable;// FSMC_BurstAccessMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait=FSMC_AsynchronousWait_Disable;
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; // ´æ´¢Æ÷дʹÄÜ
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Enable; // ¶ÁдʹÓò»Í¬µÄʱÐò
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &readWriteTiming; //¶ÁдʱÐò
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &writeTiming; //дʱÐò
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); //³õʼ»¯FSMCÅäÖÃ
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE); // ʹÄÜBANK1
delay_ms(50); // delay 50 ms
//OTM8009A_for_HSD5'_InitialCode_20120426.txt 480x854
LCD_WR_REG(0xff00); //
LCD_WR_DATA(0x80);
LCD_WR_REG(0xff01); // enable EXTC
LCD_WR_DATA(0x09);
LCD_WR_REG(0xff02); //
LCD_WR_DATA(0x01);
LCD_WR_REG(0xff80); // enable Orise mode
LCD_WR_DATA(0x80);
LCD_WR_REG(0xff81); //
LCD_WR_DATA(0x09);
LCD_WR_REG(0xff03); // enable SPI+I2C cmd2 read
LCD_WR_DATA(0x01);
//gamma DC
LCD_WR_REG(0xc0b4); //1+2dot inversion
LCD_WR_DATA(0x10);
LCD_WR_REG(0xC582); //REG-pump23
LCD_WR_DATA(0xA3);
LCD_WR_REG(0xC590); //Pump setting (3x=D6) (2x=96)//04/30
LCD_WR_DATA(0x96); //2x
LCD_WR_REG(0xC591); //Pump setting(VGH/VGL)
LCD_WR_DATA(0x76); //8F +15.5 / -15.5 //04/30
LCD_WR_REG(0xD800); //GVDD=4.5V
LCD_WR_DATA(0x70); //C0404 +4.8 =
LCD_WR_REG(0xD801); //NGVDD=4.5V
LCD_WR_DATA(0x75);
//VCOMDC
LCD_WR_REG(0xd900); // VCOMDC=
//LCD_WR_DATA(0x49); //61->5F 0620/49
LCD_WR_DATA(0x45); //0730 New LC C0404
//Gamma Setting
//Gamma_W16P(0xE1,9,10,14,14,8,27,14,15,0,4,2,5,13,40,36,15); //2.2+ c0405 HSD
//Gamma_W16P(0xE2,9,10,14,14,8,27,14,15,0,4,2,5,13,40,36,15); //2.2- c0405 HSD
LCD_WR_REG(0xC181); //Frame rate 65Hz//V02
LCD_WR_DATA(0x66); //8018 default = 60hz
// RGB I/F setting VSYNC for OTM8018 0x0e
LCD_WR_REG(0xC1a1); //external Vsync(08) /Vsync,Hsync(0c) /Vsync,Hsync,DE(0e) //V02(0e) / all included clk(0f)
LCD_WR_DATA(0x0e);
//-----------------------------------------------
LCD_WR_REG(0xC489); //pre-charge Enable
LCD_WR_DATA(0x08); //04/30 08->00 P-CH ON
LCD_WR_REG(0xC0a2); //pre-charge //PULL-LOW 04/30
LCD_WR_DATA(0x04);
LCD_WR_REG(0xC0a3); //pre-charge //P-CH 04/30
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC0a4); //pre-charge //P-CH 04/30
LCD_WR_DATA(0x02);
LCD_WR_REG(0xC480); //Proch Source Output level
LCD_WR_DATA(0x30);
//------For OTM8018 ---------
LCD_WR_REG(0xC1A6); //Display On Pump
LCD_WR_DATA(0x01);
LCD_WR_REG(0xC5C0); //
LCD_WR_DATA(0x00);
LCD_WR_REG(0xB08B); //
LCD_WR_DATA(0x40);
LCD_WR_REG(0xF5B2); //VRGH Disable
LCD_WR_DATA(0x15);
LCD_WR_REG(0xF5B3); //
LCD_WR_DATA(0x00);
LCD_WR_REG(0xF5B4); //
LCD_WR_DATA(0x15);
LCD_WR_REG(0xF5B5); //
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC593); //VRGH minimum,
LCD_WR_DATA(0x03);
//------For OTM8018 ---------
//-----------------------------------------------
LCD_WR_REG(0xC481); //source bias //V02
LCD_WR_DATA(0x83);
LCD_WR_REG(0xC592); //Pump45
LCD_WR_DATA(0x01);//(01)
LCD_WR_REG(0xC5B1); //DC voltage setting ;[0]GVDD output, default: 0xa8
LCD_WR_DATA(0xA9);
//--------------------854x480---------------------------------
LCD_WR_REG(0xb392); // Enable SW_GM
LCD_WR_DATA(0x45);
LCD_WR_REG(0xb390); // SW_GM 480X854
LCD_WR_DATA(0x02);
LCD_WR_REG(0xC080); //RTN
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC081); //RTN
LCD_WR_DATA(0x58);
LCD_WR_REG(0xC082); //RTN
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC083); //RTN
LCD_WR_DATA(0x14);
LCD_WR_REG(0xC084); //RTN
LCD_WR_DATA(0x16);
//--------------------854x480---------------------------------
///============================================================================
///============================================================================
//--------------------------------------------------------------------------------
// initial setting 2 < tcon_goa_wave > 480x854
//--------------------------------------------------------------------------------
// C09x : mck_shift1/mck_shift2/mck_shift3
LCD_WR_REG(0xC090); // c091[7:0] : mck_shift1_hi[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC091); // c092[7:0] : mck_shift1_lo[7:0]
LCD_WR_DATA(0x56); //
LCD_WR_REG(0xC092); // c093[7:0] : mck_shift2_hi[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC093); // c094[7:0] : mck_shift2_lo[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC094); // c095[7:0] : mck_shift3_hi[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC095); // c096[7:0] : mck_shift3_lo[7:0]
LCD_WR_DATA(0x03);
// C1Ax : hs_shift/vs_shift
LCD_WR_REG(0xC1a6); // c1a6[7:0] : hs_shift[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC1a7); // c1a7[7:0] : vs_shift_hi[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xC1a8); // c1a8[7:0] : vs_shift_lo[7:0]
LCD_WR_DATA(0x00);
//--------------------------------------------------------------------------------
// initial setting 2 < tcon_goa_wave >
//--------------------------------------------------------------------------------
// CE8x : vst1, vst2, vst3, vst4
LCD_WR_REG(0xCE80); // ce81[7:0] : vst1_shift[7:0]
LCD_WR_DATA(0x87);
LCD_WR_REG(0xCE81); // ce82[7:0] : 0000, vst1_width[3:0]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCE82); // ce83[7:0] : vst1_tchop[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCE83); // ce84[7:0] : vst2_shift[7:0]
LCD_WR_DATA(0x85);
LCD_WR_REG(0xCE84); // ce85[7:0] : 0000, vst2_width[3:0]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCE85); // ce86[7:0] : vst2_tchop[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCE86); // ce87[7:0] : vst3_shift[7:0]
LCD_WR_DATA(0x86);
LCD_WR_REG(0xCE87); // ce88[7:0] : 0000, vst3_width[3:0]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCE88); // ce89[7:0] : vst3_tchop[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCE89); // ce8a[7:0] : vst4_shift[7:0]
LCD_WR_DATA(0x84);
LCD_WR_REG(0xCE8a); // ce8b[7:0] : 0000, vst4_width[3:0]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCE8b); // ce8c[7:0] : vst4_tchop[7:0]
LCD_WR_DATA(0x00);
//CEAx : clka1, clka2
LCD_WR_REG(0xCEa0); // cea1[7:0] : clka1_width[3:0], clka1_shift[11:8]
LCD_WR_DATA(0x38);
LCD_WR_REG(0xCEa1); // cea2[7:0] : clka1_shift[7:0]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCEa2); // cea3[7:0] : clka1_sw_tg, odd_high, flat_head, flat_tail, switch[11:8]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCEa3); // cea4[7:0] : clka1_switch[7:0]
LCD_WR_DATA(0x58);
LCD_WR_REG(0xCEa4); // cea5[7:0] : clka1_extend[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEa5); // cea6[7:0] : clka1_tchop[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEa6); // cea7[7:0] : clka1_tglue[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEa7); // cea8[7:0] : clka2_width[3:0], clka2_shift[11:8]
LCD_WR_DATA(0x38);
LCD_WR_REG(0xCEa8); // cea9[7:0] : clka2_shift[7:0]
LCD_WR_DATA(0x02);
LCD_WR_REG(0xCEa9); // ceaa[7:0] : clka2_sw_tg, odd_high, flat_head, flat_tail, switch[11:8]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCEaa); // ceab[7:0] : clka2_switch[7:0]
LCD_WR_DATA(0x59);
LCD_WR_REG(0xCEab); // ceac[7:0] : clka2_extend
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEac); // cead[7:0] : clka2_tchop
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEad); // ceae[7:0] : clka2_tglue
LCD_WR_DATA(0x00);
//CEBx : clka3, clka4
LCD_WR_REG(0xCEb0); // ceb1[7:0] : clka3_width[3:0], clka3_shift[11:8]
LCD_WR_DATA(0x38);
LCD_WR_REG(0xCEb1); // ceb2[7:0] : clka3_shift[7:0]
LCD_WR_DATA(0x01);
LCD_WR_REG(0xCEb2); // ceb3[7:0] : clka3_sw_tg, odd_high, flat_head, flat_tail, switch[11:8]
LCD_WR_DATA(0x03);
LCD_WR_REG(0xCEb3); // ceb4[7:0] : clka3_switch[7:0]
LCD_WR_DATA(0x5a);
LCD_WR_REG(0xCEb4); // ceb5[7:0] : clka3_extend[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEb5); // ceb6[7:0] : clka3_tchop[7:0]
LCD_WR_DATA(0x00);
LCD_WR_REG(0xCEb6); // ceb7[7:0] : cl
一周热门 更多>