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