Delay_ms(500); // Delay 50ms
OTM3225A_RegWrite(0x0020, 0x0000); // AD[7:0]:0
OTM3225A_RegWrite(0x0021, 0x0000); // AD[16:8]:0 // ----------- Adjust the Gamma Curve ----------//
OTM3225A_RegWrite(0x0030, 0x0000);
OTM3225A_RegWrite(0x0031, 0x0404);
OTM3225A_RegWrite(0x0032, 0x0304);
OTM3225A_RegWrite(0x0035, 0x0005);
OTM3225A_RegWrite(0x0036, 0x1604);
OTM3225A_RegWrite(0x0037, 0x0304);
OTM3225A_RegWrite(0x0038, 0x0303);
OTM3225A_RegWrite(0x0039, 0x0707);
OTM3225A_RegWrite(0x003C, 0x0500);
OTM3225A_RegWrite(0x003D, 0x000F);
//------------------ Set GRAM area ---------------//
OTM3225A_RegWrite(0x0050, 0x0000); // HSA[7:0]:0
OTM3225A_RegWrite(0x0051, 0x00EF); // HEA[7:0]:0xEF
OTM3225A_RegWrite(0x0052, 0x0000); // VSA[7:0]:0
OTM3225A_RegWrite(0x0053, 0x013F); // VEA[7:0]:0x13F if(res == RES_LANDSCAPE_320X240)
OTM3225A_RegWrite(0x0060, 0xA700); // Gate Scan Line
else if (res == RES_PORTRAIT_240X320)
OTM3225A_RegWrite(0x0060, 0x2700); // GS:0. NL[5:0]:0x27, SCN[5:0]:0 OTM3225A_RegWrite(0x0061, 0x0001); // NDL,VLE, REV
OTM3225A_RegWrite(0x006A, 0x0000); // VL[8:0]:0
//-------------- Partial Display Control ---------//
OTM3225A_RegWrite(0x0080, 0x0000); // PTD[8:0]:0
OTM3225A_RegWrite(0x0081, 0x0000); // PTS[8:0]:0
OTM3225A_RegWrite(0x0082, 0x0000); // PTE[8:0]:0
OTM3225A_RegWrite(0x0083, 0x0000); // PTD[8:0]:0
OTM3225A_RegWrite(0x0084, 0x0000); // PTS[8:0]:0
OTM3225A_RegWrite(0x0085, 0x0000); // PTE[8:0]:0 //-------------- Panel Control -------------------//
OTM3225A_RegWrite(0x0090, 0x0010); // DIVI[1:0]:0, RTNI[4:0]:0x10
OTM3225A_RegWrite(0x0092, 0x0600); // NOWI[2:0]:0x6
//OTM3225A_RegWrite(0x0093, 0x0003);
//OTM3225A_RegWrite(0x0095, 0x021E); // DIVE[1:0]:0x2, RTNE[4:0]:0x1E
//OTM3225A_RegWrite(0x0095, 0x0110);
//OTM3225A_RegWrite(0x0097, 0x0C00); // NOWE[3:0]:0x6
//OTM3225A_RegWrite(0x0097, 0x0000);
//OTM3225A_RegWrite(0x0098, 0x0000);
OTM3225A_RegWrite(0x0007, 0x0133); // 262K color and display ON g_otm3225a_resolution = res;
}
void Show_Word32x32(uint16_t x, uint16_t y, uint8_t ascii, uint16_t color)
{
int row=0, column=0, bit=0;
int dot=0; for(column=0; column<32; column++)
{
OTM3225_window_start(x, y);
for(row=0; row<4; row++)
{
for(bit=1; bit<=8; bit++)
{
if( (zk_table[ascii][dot] & 0x80) && (bit==1))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x40) && (bit==2))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x20) && (bit==3))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x10) && (bit==4))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x08) && (bit==5))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x04) && (bit==6))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x02) && (bit==7))
OTM3225A_DataWrite(color);
else if( (zk_table[ascii][dot] & 0x01) && (bit==8))
OTM3225A_DataWrite(color); OTM3225_window_start(x+(row*8)+bit, y);
} dot++;
} y++;
}
} void Show_String32x32(uint16_t x, uint16_t y, uint8_t *string, uint16_t color)
{
int row=0, startx=0;
int length = strlen((const char *)string); for(row=0; row<length; row++)
{
if(row==0) {
startx = x;
Show_Word32x32(x, y, string[row], color);
}
else {
startx = startx
+3
2-ALIGN_CONTROL;
Show_Word32x32(startx, y, string[row], color);
}
}
} void ClearScreen(uint16_t color)
{
uint16_t xaxis, yaxis;
OTM3225_window_start(0, 0);
for(xaxis=0; xaxis<320; xaxis++)
{
for(yaxis=0; yaxis<240; yaxis++)
{
OTM3225A_DataWrite(color);
}
}
} void DrawPartialScreen(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)
{
uint16_t xaxis, yaxis;
for(yaxis=0; yaxis<height; yaxis++)
{
OTM3225_window_start(x, y++);
for(xaxis=0; xaxis<width; xaxis++)
{
OTM3225A_DataWrite(color);
}
}
}
2012年12月20日 06点12分
8