//St7775R method of setting display direction #define LCD_W 176 #define LCD_H 220 void LCD_Set_Direction(u8 direction) { lcddev.dir = direction&3; switch(lcddev.dir){ case 0: //0 angle vertical display lcddev.width=LCD_W; lcddev.height=LCD_H; LCD_WriteReg(0x0003,0x1030); break; case 1: //Rotate 90 degrees clockwise for horizontal display lcddev.width=LCD_H; lcddev.height=LCD_W; LCD_WriteReg(0x0003,0x1028); break; case 2: //Rotate 180 degrees clockwise for vertical display lcddev.width=LCD_W; lcddev.height=LCD_H; LCD_WriteReg(0x0003,0x1000); break; case 3: //Rotate 270 degrees clockwise for horizontal display lcddev.width=LCD_H; lcddev.height=LCD_W; LCD_WriteReg(0x0003,0x1018); break; default:break; } } //St7775R setting display window method void LCD_SetWindows(u16 xStar,u16 yStar,u16 xEnd,u16 yEnd) { u16 x,y,tmp; switch(lcddev.dir) { case 0: x = xStar; y = yStar; break; case 1: tmp = yStar; yStar = xStar; xStar = LCD_W-1-yEnd; yEnd = xEnd; xEnd = LCD_W-1-tmp; x = xEnd; y = yStar; break; case 2: tmp = xStar; xStar = LCD_W-1-xEnd; xEnd = LCD_W-1-tmp; tmp = yStar; yStar = LCD_H-1-yEnd; yEnd = LCD_H-1-tmp; x = xEnd; y = yEnd; break; case 3: tmp = xStar; xStar = yStar; yStar = LCD_H-1-xEnd; xEnd = yEnd; yEnd = LCD_H-1-tmp; x = xStar; y = yEnd; break; default: break; } LCD_WriteReg(0x0036, xEnd); //Set X coordinate LCD_WriteReg(0x0037, xStar); LCD_WriteReg(0x0038, yEnd); //Set Y coordinate LCD_WriteReg(0x0039, yStar); LCD_WriteReg(0x0020, x); LCD_WriteReg(0x0021, y); LCD_WR_REG(0x0022); //Start writing gram }