void drawline(UINT sx, UINT ex, UINT sy, UINT ey,UINT linecolor) { unsigned long int a,b; UINT diffx,diffy; diffx=ex-sx; diffy=ey-sy; if(diffx==0) { for(b=sy;b<=ey;b++) { BlockWrite(sx,sx,b,b); W_DATA(linecolor); } } else if(diffy==0) { for(a=sx;a<ex;a++) { BlockWrite(a,a,sy,sy); W_DATA(linecolor); } } else { for(a=sx;a<=ex;a++) { b=(a-sx)*diffy/diffx; BlockWrite(a,a,b,b); W_DATA(linecolor); } } }
//--------------------------------------------------------------------------- void Sleep_In(void) { W_COM(0x0007); W_DATA(0x0170); Delay(50); W_COM(0x0007); W_DATA(0x0000);//Display off Delay(50); W_COM(0x0100); W_DATA(0x16B2);//Set to sleep mode }
void Show(UINT sx, UINT ex, UINT sy, UINT ey, UINT dat) { UINT x, y, i, j; BlockWrite(sx, ex, sy, ey); x = ex - sx; y = ey - sy; for ( i = 0; i <= y; i++ ) for ( j = 0; j <= x; j++ ) W_DATA(dat); }
void show_pic(unsigned char * table,UINT x0,UINT y0,UINT width,UINT height) { UINT x; UINT temp; BlockWrite(x0,x0+width-1,y0,y0+height-1); for(x=0;x<width*height*2;x+=2) { temp=table[x]<<8; temp+=table[x+1]; W_DATA(temp); } }
/*******************kkk*****************/ void sin(void) { unsigned int x,y; for(y=0;y<4;y++) { for(x=0;x<400;x++) { BlockWrite(sintable[x]+119,sintable[x]+119,x+y,x+y); W_DATA(0xf800); } Delay(100); } }
void ShowCharWithColor(UCHAR sx, UINT sy, UCHAR index, UINT CharColor, UINT BkColor) { UCHAR i, j; UCHAR mask; if ( index > 95 ) return; BlockWrite(sx, sx+7, sy, sy+15); for ( i = 0; i < 16; i++ ) { mask = 0x80; for ( j = 0; j < 8; j++ ) { W_DATA((ascii_font[index][i] & mask) ? CharColor : BkColor); mask >>= 1; } } }
//--------------------------------------------------------------------------- void BlockWrite(UINT sx, UINT ex, UINT sy, UINT ey) { W_COM(0x0210); W_DATA(sx); W_COM(0x0211); W_DATA(ex); W_COM(0x0212); W_DATA(sy); W_COM(0x0213); W_DATA(ey); W_COM(0x0200); W_DATA(0); W_COM(0x0201); W_DATA(0); W_COM(0x0202); }
//--------------------------------------------------------------------------- void Sleep_Out(void) { W_COM(0x0100); W_DATA(0x16B0);//Release state W_COM(0x0007); W_DATA(0x0173); }
//--------------------------------------------------------------------------- void SPFD5420A_CPT30W_Initial(void) { W_COM(0x0606); W_DATA(0x0000); Delay(100); W_COM(0x0606); W_DATA(0x0000); Delay(5); W_COM(0x0007); W_DATA(0x0001); Delay(5); W_COM(0x0110); W_DATA(0x0001); Delay(5); W_COM(0x0100); W_DATA(0x17B0); W_COM(0x0101); W_DATA(0x0147); W_COM(0x0102); W_DATA(0x019D); W_COM(0x0103); W_DATA(0x2F00); W_COM(0x0281); W_DATA(0x0001); Delay(5); W_COM(0x0102); W_DATA(0x01BD); Delay(5); W_COM(0x0000); W_DATA(0x0000); W_COM(0x0001); W_DATA(0x0100); W_COM(0x0002); W_DATA(0x0100); W_COM(0x0003); W_DATA(0x10B0); W_COM(0x0008); W_DATA(0x0808); W_COM(0x0009); W_DATA(0x0001); W_COM(0x000B); W_DATA(0x0010); W_COM(0x000C); W_DATA(0x0000); W_COM(0x000F); W_DATA(0x0000); W_COM(0x0010); W_DATA(0x0014); W_COM(0x0011); W_DATA(0x0202); W_COM(0x0012); W_DATA(0x0300); W_COM(0x0020); W_DATA(0x021E); W_COM(0x0021); W_DATA(0x0202); W_COM(0x0022); W_DATA(0x0100); W_COM(0x0090); W_DATA(0x8000); W_COM(0x0092); W_DATA(0x0000); W_COM(0x0100); W_DATA(0x17B0); W_COM(0x0101); W_DATA(0x0147); W_COM(0x0102); W_DATA(0x01B8); W_COM(0x0103); W_DATA(0x2C00); W_COM(0x0107); W_DATA(0x0000); W_COM(0x0110); W_DATA(0x0001); W_COM(0x0210); W_DATA(0x0000); W_COM(0x0211); W_DATA(0x00EF); W_COM(0x0212); W_DATA(0x0000); W_COM(0x0213); W_DATA(0x018F); W_COM(0x0200); W_DATA(0x0000); W_COM(0x0201); W_DATA(0x0000); W_COM(0x0280); W_DATA(0x0000); W_COM(0x0281); W_DATA(0x0000); W_COM(0x0282); W_DATA(0x0000); W_COM(0x0300); W_DATA(0x0501); //GAMMA Control W_COM(0x0301); W_DATA(0x0C2F); W_COM(0x0302); W_DATA(0x0D33); W_COM(0x0303); W_DATA(0x330D); W_COM(0x0304); W_DATA(0x2F0C); W_COM(0x0305); W_DATA(0x0105); W_COM(0x0306); W_DATA(0x030A); W_COM(0x0307); W_DATA(0x0A03); W_COM(0x0308); W_DATA(0x0006); W_COM(0x0309); W_DATA(0x0004); W_COM(0x030A); W_DATA(0x0E05); W_COM(0x030B); W_DATA(0x0E01); W_COM(0x030C); W_DATA(0x010E); W_COM(0x030D); W_DATA(0x050E); W_COM(0x030E); W_DATA(0x0400); W_COM(0x030F); W_DATA(0x0600); W_COM(0x0400); W_DATA(0x3500); //Base Image Number of Line W_COM(0x0401); W_DATA(0x0001); //Base Image Display Control W_COM(0x0404); W_DATA(0x0000); //Base Image Vertical Scroll Control W_COM(0x0500); W_DATA(0x0000); W_COM(0x0501); W_DATA(0x0000); W_COM(0x0502); W_DATA(0x0000); W_COM(0x0503); W_DATA(0x0000); W_COM(0x0504); W_DATA(0x0000); W_COM(0x0505); W_DATA(0x0000); W_COM(0x0600); W_DATA(0x0000); // W_COM(0x0606); W_DATA(0x0000); // W_COM(0x06F0); W_DATA(0x0000); // W_COM(0x07F0); W_DATA(0x5420); W_COM(0x07F2); W_DATA(0x00DF); W_COM(0x07F3); W_DATA(0x2890); W_COM(0x07F4); W_DATA(0x0022); W_COM(0x07F5); W_DATA(0x0011); W_COM(0x07F0); W_DATA(0x0000); W_COM(0x0007); W_DATA(0x0173); //Display Control 1 Delay(200); }
static void init_lcm_registers(void) { int i; #if defined(BUILD_LK) printf("mycat LCD otm8012_nisin_NST397WV3932ANP_mcu_wvga_lcm_drv \n"); #endif W_COM(0xFF00); W_DATA(0x80); W_COM(0xFF01); W_DATA(0x12); W_COM(0xFF02); W_DATA(0x01); W_COM(0xFF80); W_DATA(0x80); W_COM(0xFF81); W_DATA(0x12); W_COM(0xB0C6); W_DATA(0x03); W_COM(0xB3A1); W_DATA(0x00); W_COM(0xB3A6); W_DATA(0x20); W_COM(0xB3A7); W_DATA(0x01); W_COM(0xB3B0); W_DATA(0x18); W_COM(0xC0A3); W_DATA(0x05); W_COM(0xC0A4); W_DATA(0x15); W_COM(0xC0B4); W_DATA(0x11); W_COM(0xC481); W_DATA(0x04); W_COM(0xC482); W_DATA(0xF2); W_COM(0xC48B); W_DATA(0x24); W_COM(0xC492); W_DATA(0x00); W_COM(0xC580); W_DATA(0x50); W_COM(0xC582); W_DATA(0xF0); W_COM(0xC590); W_DATA(0x03); W_COM(0xC591); W_DATA(0x76); W_COM(0xC592); W_DATA(0x01); W_COM(0xC594); W_DATA(0x44); W_COM(0xC595); W_DATA(0x44); W_COM(0xC596); W_DATA(0x46); W_COM(0xF5BA); W_DATA(0x01); W_COM(0xF5BB); W_DATA(0x11); W_COM(0xF5C2); W_DATA(0x00); W_COM(0xC090); W_DATA(0x00); W_COM(0xC091); W_DATA(0x44); W_COM(0xC092); W_DATA(0x00); W_COM(0xC093); W_DATA(0x00); W_COM(0xC094); W_DATA(0x00); W_COM(0xC095); W_DATA(0x03); W_COM(0xCE80); W_DATA(0x85); W_COM(0xCE81); W_DATA(0x03); W_COM(0xCE82); W_DATA(0x00); W_COM(0xCE83); W_DATA(0x84); W_COM(0xCE84); W_DATA(0x03); W_COM(0xCE85); W_DATA(0x00); W_COM(0xCE86); W_DATA(0x87); W_COM(0xCE87); W_DATA(0x03); W_COM(0xCE88); W_DATA(0x00); W_COM(0xCE89); W_DATA(0x86); W_COM(0xCE8A); W_DATA(0x03); W_COM(0xCE8B); W_DATA(0x00); W_COM(0xCE90); W_DATA(0x33); W_COM(0xCE91); W_DATA(0x26); W_COM(0xCE92); W_DATA(0x00); W_COM(0xCE93); W_DATA(0x33); W_COM(0xCE94); W_DATA(0x27); W_COM(0xCE95); W_DATA(0x00); W_COM(0xCEA0); W_DATA(0x38); W_COM(0xCEA1); W_DATA(0x03); W_COM(0xCEA2); W_DATA(0x03); W_COM(0xCEA3); W_DATA(0x20); W_COM(0xCEA4); W_DATA(0x00); W_COM(0xCEA5); W_DATA(0x00); W_COM(0xCEA6); W_DATA(0x00); W_COM(0xCEA7); W_DATA(0x38); W_COM(0xCEA8); W_DATA(0x02); W_COM(0xCEA9); W_DATA(0x03); W_COM(0xCEAA); W_DATA(0x21); W_COM(0xCEAB); W_DATA(0x00); W_COM(0xCEAC); W_DATA(0x00); W_COM(0xCEAD); W_DATA(0x00); W_COM(0xCEB0); W_DATA(0x38); W_COM(0xCEB1); W_DATA(0x01); W_COM(0xCEB2); W_DATA(0x03); W_COM(0xCEB3); W_DATA(0x22); W_COM(0xCEB4); W_DATA(0x00); W_COM(0xCEB5); W_DATA(0x00); W_COM(0xCEB6); W_DATA(0x00); W_COM(0xCEB7); W_DATA(0x38); W_COM(0xCEB8); W_DATA(0x00); W_COM(0xCEB9); W_DATA(0x03); W_COM(0xCEBA); W_DATA(0x23); W_COM(0xCEBB); W_DATA(0x00); W_COM(0xCEBC); W_DATA(0x00); W_COM(0xCEBD); W_DATA(0x00); W_COM(0xCEC0); W_DATA(0x30); W_COM(0xCEC1); W_DATA(0x00); W_COM(0xCEC2); W_DATA(0x03); W_COM(0xCEC3); W_DATA(0x24); W_COM(0xCEC4); W_DATA(0x00); W_COM(0xCEC5); W_DATA(0x00); W_COM(0xCEC6); W_DATA(0x00); W_COM(0xCEC7); W_DATA(0x30); W_COM(0xCEC8); W_DATA(0x01); W_COM(0xCEC9); W_DATA(0x03); W_COM(0xCECA); W_DATA(0x25); W_COM(0xCECB); W_DATA(0x00); W_COM(0xCECC); W_DATA(0x00); W_COM(0xCECD); W_DATA(0x00); W_COM(0xCED0); W_DATA(0x30); W_COM(0xCED1); W_DATA(0x02); W_COM(0xCED2); W_DATA(0x03); W_COM(0xCED3); W_DATA(0x26); W_COM(0xCED4); W_DATA(0x00); W_COM(0xCED5); W_DATA(0x00); W_COM(0xCED6); W_DATA(0x00); W_COM(0xCED7); W_DATA(0x30); W_COM(0xCED8); W_DATA(0x03); W_COM(0xCED9); W_DATA(0x03); W_COM(0xCEDA); W_DATA(0x27); W_COM(0xCEDB); W_DATA(0x00); W_COM(0xCEDC); W_DATA(0x00); W_COM(0xCEDD); W_DATA(0x00); W_COM(0xCFC7); W_DATA(0x00); W_COM(0xCFC9); W_DATA(0x0A); W_COM(0xCFCA); W_DATA(0x06); W_COM(0xCBC0); W_DATA(0x00); W_COM(0xCBC1); W_DATA(0x00); W_COM(0xCBC2); W_DATA(0x00); W_COM(0xCBC3); W_DATA(0x00); W_COM(0xCBC4); W_DATA(0x54); W_COM(0xCBC5); W_DATA(0x54); W_COM(0xCBC6); W_DATA(0x54); W_COM(0xCBC7); W_DATA(0x54); W_COM(0xCBC8); W_DATA(0x00); W_COM(0xCBC9); W_DATA(0x54); W_COM(0xCBCA); W_DATA(0x00); W_COM(0xCBCB); W_DATA(0x54); W_COM(0xCBCC); W_DATA(0x00); W_COM(0xCBCD); W_DATA(0x00); W_COM(0xCBCE); W_DATA(0x00); W_COM(0xCBD0); W_DATA(0x00); W_COM(0xCBD1); W_DATA(0x00); W_COM(0xCBD2); W_DATA(0x00); W_COM(0xCBD3); W_DATA(0x00); W_COM(0xCBD4); W_DATA(0x00); W_COM(0xCBD5); W_DATA(0x00); W_COM(0xCBD6); W_DATA(0x00); W_COM(0xCBD7); W_DATA(0x00); W_COM(0xCBD8); W_DATA(0x00); W_COM(0xCBD9); W_DATA(0x54); W_COM(0xCBDA); W_DATA(0x00); W_COM(0xCBDB); W_DATA(0x54); W_COM(0xCBDC); W_DATA(0x00); W_COM(0xCBDD); W_DATA(0x54); W_COM(0xCBDE); W_DATA(0x54); W_COM(0xCBE0); W_DATA(0x54); W_COM(0xCBE1); W_DATA(0x54); W_COM(0xCBE2); W_DATA(0x00); W_COM(0xCBE3); W_DATA(0x00); W_COM(0xCBE4); W_DATA(0x00); W_COM(0xCBE5); W_DATA(0x00); W_COM(0xCBE6); W_DATA(0x00); W_COM(0xCBE7); W_DATA(0x00); W_COM(0xCBE8); W_DATA(0x00); W_COM(0xCC80); W_DATA(0x00); W_COM(0xCC81); W_DATA(0x00); W_COM(0xCC82); W_DATA(0x00); W_COM(0xCC83); W_DATA(0x00); W_COM(0xCC84); W_DATA(0x0C); W_COM(0xCC85); W_DATA(0x0A); W_COM(0xCC86); W_DATA(0x10); W_COM(0xCC87); W_DATA(0x0E); W_COM(0xCC88); W_DATA(0x00); W_COM(0xCC89); W_DATA(0x02); W_COM(0xCC90); W_DATA(0x00); W_COM(0xCC91); W_DATA(0x06); W_COM(0xCC92); W_DATA(0x00); W_COM(0xCC93); W_DATA(0x00); W_COM(0xCC94); W_DATA(0x00); W_COM(0xCC95); W_DATA(0x00); W_COM(0xCC96); W_DATA(0x00); W_COM(0xCC97); W_DATA(0x00); W_COM(0xCC98); W_DATA(0x00); W_COM(0xCC99); W_DATA(0x00); W_COM(0xCC9A); W_DATA(0x00); W_COM(0xCC9B); W_DATA(0x00); W_COM(0xCC9C); W_DATA(0x00); W_COM(0xCC9D); W_DATA(0x00); W_COM(0xCC9E); W_DATA(0x05); W_COM(0xCCA0); W_DATA(0x00); W_COM(0xCCA1); W_DATA(0x01); W_COM(0xCCA2); W_DATA(0x00); W_COM(0xCCA3); W_DATA(0x0D); W_COM(0xCCA4); W_DATA(0x0F); W_COM(0xCCA5); W_DATA(0x09); W_COM(0xCCA6); W_DATA(0x0B); W_COM(0xCCA7); W_DATA(0x00); W_COM(0xCCA8); W_DATA(0x00); W_COM(0xCCA9); W_DATA(0x00); W_COM(0xCCAA); W_DATA(0x00); W_COM(0xCCAB); W_DATA(0x00); W_COM(0xCCAC); W_DATA(0x00); W_COM(0xCCAD); W_DATA(0x00); W_COM(0xCCAE); W_DATA(0x00); W_COM(0xCCB0); W_DATA(0x00); W_COM(0xCCB1); W_DATA(0x00); W_COM(0xCCB2); W_DATA(0x00); W_COM(0xCCB3); W_DATA(0x00); W_COM(0xCCB4); W_DATA(0x0D); W_COM(0xCCB5); W_DATA(0x0F); W_COM(0xCCB6); W_DATA(0x09); W_COM(0xCCB7); W_DATA(0x0B); W_COM(0xCCB8); W_DATA(0x00); W_COM(0xCCB9); W_DATA(0x05); W_COM(0xCCC0); W_DATA(0x00); W_COM(0xCCC1); W_DATA(0x01); W_COM(0xCCC2); W_DATA(0x00); W_COM(0xCCC3); W_DATA(0x00); W_COM(0xCCC4); W_DATA(0x00); W_COM(0xCCC5); W_DATA(0x00); W_COM(0xCCC6); W_DATA(0x00); W_COM(0xCCC7); W_DATA(0x00); W_COM(0xCCC8); W_DATA(0x00); W_COM(0xCCC9); W_DATA(0x00); W_COM(0xCCCA); W_DATA(0x00); W_COM(0xCCCB); W_DATA(0x00); W_COM(0xCCCC); W_DATA(0x00); W_COM(0xCCCD); W_DATA(0x00); W_COM(0xCCCE); W_DATA(0x02); W_COM(0xCCD0); W_DATA(0x00); W_COM(0xCCD1); W_DATA(0x06); W_COM(0xCCD2); W_DATA(0x00); W_COM(0xCCD3); W_DATA(0x0C); W_COM(0xCCD4); W_DATA(0x0A); W_COM(0xCCD5); W_DATA(0x10); W_COM(0xCCD6); W_DATA(0x0E); W_COM(0xCCD7); W_DATA(0x00); W_COM(0xCCD8); W_DATA(0x00); W_COM(0xCCD9); W_DATA(0x00); W_COM(0xCCDA); W_DATA(0x00); W_COM(0xCCDB); W_DATA(0x00); W_COM(0xCCDC); W_DATA(0x00); W_COM(0xCCDD); W_DATA(0x00); W_COM(0xCCDE); W_DATA(0x00); W_COM(0xD800); W_DATA(0x83); W_COM(0xD801); W_DATA(0x83); W_COM(0xD900); W_DATA(0x6E); W_COM(0xE100); W_DATA(0x0C); W_COM(0xE101); W_DATA(0x0F); W_COM(0xE102); W_DATA(0x14); W_COM(0xE103); W_DATA(0x1E); W_COM(0xE104); W_DATA(0x32); W_COM(0xE105); W_DATA(0x4A); W_COM(0xE106); W_DATA(0x58); W_COM(0xE107); W_DATA(0x8C); W_COM(0xE108); W_DATA(0x7A); W_COM(0xE109); W_DATA(0x8F); W_COM(0xE10A); W_DATA(0x78); W_COM(0xE10B); W_DATA(0x69); W_COM(0xE10C); W_DATA(0x82); W_COM(0xE10D); W_DATA(0x6F); W_COM(0xE10E); W_DATA(0x75); W_COM(0xE10F); W_DATA(0x6F); W_COM(0xE110); W_DATA(0x68); W_COM(0xE111); W_DATA(0x60); W_COM(0xE112); W_DATA(0x56); W_COM(0xE113); W_DATA(0x20); W_COM(0xE200); W_DATA(0x0C); W_COM(0xE201); W_DATA(0x0F); W_COM(0xE202); W_DATA(0x14); W_COM(0xE203); W_DATA(0x1E); W_COM(0xE204); W_DATA(0x32); W_COM(0xE205); W_DATA(0x4A); W_COM(0xE206); W_DATA(0x58); W_COM(0xE207); W_DATA(0x8C); W_COM(0xE208); W_DATA(0x7A); W_COM(0xE209); W_DATA(0x8F); W_COM(0xE20A); W_DATA(0x78); W_COM(0xE20B); W_DATA(0x69); W_COM(0xE20C); W_DATA(0x82); W_COM(0xE20D); W_DATA(0x6F); W_COM(0xE20E); W_DATA(0x75); W_COM(0xE20F); W_DATA(0x6F); W_COM(0xE210); W_DATA(0x68); W_COM(0xE211); W_DATA(0x60); W_COM(0xE212); W_DATA(0x56); W_COM(0xE213); W_DATA(0x20); W_COM(0x3A00); W_DATA(0x66); W_COM(0x1100); Delayms(150); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); Delayms(1); W_COM(0xC492); W_DATA(0x00); Delayms(1); W_COM(0xC492); W_DATA(0x08); W_COM(0xFF00); W_DATA(0xFF); W_COM(0xFF01); W_DATA(0xFF); W_COM(0xFF02); W_DATA(0xFF); W_COM(0x2900); Delayms(20); W_COM(0x2A00); W_DATA(0x00); W_COM(0x2A01); W_DATA(0x00); W_COM(0x2A02); W_DATA(0x01); W_COM(0x2A03); W_DATA(0xDF); W_COM(0x2B00); W_DATA(0x00); W_COM(0x2B01); W_DATA(0x00); W_COM(0x2B02); W_DATA(0x03); W_COM(0x2B03); W_DATA(0x1F); send_ctrl_cmd(0x3500); send_data_cmd(0x0000); //TE on send_ctrl_cmd(0x4400); send_data_cmd(0x0001); //write TE send_ctrl_cmd(0x4401); send_data_cmd(0x0022); send_ctrl_cmd(0x1100); MDELAY(120); send_ctrl_cmd(0x2900); MDELAY(200); send_ctrl_cmd(0x2C00); MDELAY(200); }