//ILI9486L method of setting display direction #defined LCD_W 320 #defined LCD_H 480 void LCD_direction(u8 direction) { switch(direction){ case 0: //0 degree vertical display lcddev.width=LCD_W; lcddev.height=LCD_H; LCD_WriteReg(0x36,(1<<3)); break; case 1: //Rotate 90 degrees clockwise for horizontal display lcddev.width=LCD_H; lcddev.height=LCD_W; LCD_WriteReg(0x36,(1<<3)|(1<<6)|(1<<5)); break; case 2: //Rotate 180 degrees clockwise for vertical display lcddev.width=LCD_W; lcddev.height=LCD_H; LCD_WriteReg(0x36,(1<<3)|(1<<6)|(1<<7)); break; case 3: //Rotate 270 degrees clockwise for horizontal display lcddev.width=LCD_H; lcddev.height=LCD_W; LCD_WriteReg(0x36,(1<<3)|(1<<5)|(1<<7)); break; default:break; } }