LCD1in8_Driver.cpp
void LCD1in8_Driver::LCD_SetGramScanWay(LCD_SCAN_DIR Scan_dir)
{
    //Get the screen scan direction
    sLCD_DIS.LCD_Scan_Dir = Scan_dir;

    //Get GRAM and LCD width and height
    if(Scan_dir == L2R_U2D || Scan_dir == L2R_D2U || Scan_dir == R2L_U2D || Scan_dir == R2L_D2U) {
        sLCD_DIS.LCD_Dis_Column	= LCD_HEIGHT ;
        sLCD_DIS.LCD_Dis_Page = LCD_WIDTH ;
    } else {
        sLCD_DIS.LCD_Dis_Column	= LCD_WIDTH ;
        sLCD_DIS.LCD_Dis_Page = LCD_HEIGHT ;
    }

    // Gets the scan direction of GRAM
    uint16_t MemoryAccessReg_Data=0;  //0x36
    switch (Scan_dir) {
    case L2R_U2D:
        MemoryAccessReg_Data = 0X00 | 0x00; //x Scan direction | y Scan direction
        break;
    case L2R_D2U:
        MemoryAccessReg_Data = 0x00 | 0x80;//0xC8 | 0X10
        break;
    case R2L_U2D: //0X4
        MemoryAccessReg_Data = 0x40 | 0x00;
        break;
    case R2L_D2U: //0XC
        MemoryAccessReg_Data = 0x40 | 0x80;
        break;
    case U2D_L2R: //0X2
        MemoryAccessReg_Data = 0X00 | 0X00 | 0x20;
        break;
    case U2D_R2L: //0X6
        MemoryAccessReg_Data = 0x00 | 0X40 | 0x20;
        break;
    case D2U_L2R: //0XA
        MemoryAccessReg_Data = 0x80 | 0x00 | 0x20;
        break;
    case D2U_R2L: //0XE
        MemoryAccessReg_Data = 0x40 | 0x80 | 0x20;
        break;
    }

    //please set (MemoryAccessReg_Data & 0x10) != 1
    if((MemoryAccessReg_Data && 0x20) != 1) {
        sLCD_DIS.LCD_X_Adjust = LCD_X;
        sLCD_DIS.LCD_Y_Adjust = LCD_Y;
    } else {
        sLCD_DIS.LCD_X_Adjust = LCD_Y;
        sLCD_DIS.LCD_Y_Adjust = LCD_X;
    }

    // Set the read / write scan direction of the frame memory
    LCD_WriteReg(0x36); //MX, MY, RGB mode
    LCD_WriteData_8Bit( MemoryAccessReg_Data & 0xf7); //RGB color filter panel

}
/********************************************************************************
function:	Set the display scan and color transfer modes
parameter:
		Scan_dir   :   Scan direction
		Colorchose :   RGB or GBR color format
********************************************************************************/
Set the display scan and color transfer modes
parameter:
Scan_dir   :   Scan direction
Colorchose :   RGB or GBR color format
Set the display scan and color transfer modes parameter : Scan_dir : Scan direction Colorchose : RGB or GBR color format
void LCD1in8_Driver::LCD_SetGramScanWay(LCD_SCAN_DIR Scan_dir)
{
    sLCD_DIS.LCD_Scan_Dir = Scan_dir;
    if(Scan_dir == L2R_U2D || Scan_dir == L2R_D2U || Scan_dir == R2L_U2D || Scan_dir == R2L_D2U) {
        sLCD_DIS.LCD_Dis_Column	= LCD_HEIGHT ;
        sLCD_DIS.LCD_Dis_Page = LCD_WIDTH ;
    } else {
        sLCD_DIS.LCD_Dis_Column	= LCD_WIDTH ;
        sLCD_DIS.LCD_Dis_Page = LCD_HEIGHT ;
    }
    uint16_t MemoryAccessReg_Data=0;  
    switch (Scan_dir) {
    case L2R_U2D:
        MemoryAccessReg_Data = 0X00 | 0x00; 
        break;
    case L2R_D2U:
        MemoryAccessReg_Data = 0x00 | 0x80;
        break;
    case R2L_U2D: 
        MemoryAccessReg_Data = 0x40 | 0x00;
        break;
    case R2L_D2U: 
        MemoryAccessReg_Data = 0x40 | 0x80;
        break;
    case U2D_L2R: 
        MemoryAccessReg_Data = 0X00 | 0X00 | 0x20;
        break;
    case U2D_R2L: 
        MemoryAccessReg_Data = 0x00 | 0X40 | 0x20;
        break;
    case D2U_L2R: 
        MemoryAccessReg_Data = 0x80 | 0x00 | 0x20;
        break;
    case D2U_R2L: 
        MemoryAccessReg_Data = 0x40 | 0x80 | 0x20;
        break;
    }
    if((MemoryAccessReg_Data && 0x20) != 1) {
        sLCD_DIS.LCD_X_Adjust = LCD_X;
        sLCD_DIS.LCD_Y_Adjust = LCD_Y;
    } else {
        sLCD_DIS.LCD_X_Adjust = LCD_Y;
        sLCD_DIS.LCD_Y_Adjust = LCD_X;
    }
    LCD_WriteReg(0x36); 
    LCD_WriteData_8Bit( MemoryAccessReg_Data & 0xf7); 
}
void LCD1in8_Driver :: LCD_SetGramScanWay ( LCD_SCAN_DIR Scan_dir ) { sLCD_DIS . LCD_Scan_Dir = Scan_dir ; if ( Scan_dir == L2R_U2D || Scan_dir == L2R_D2U || Scan_dir == R2L_U2D || Scan_dir == R2L_D2U ) { sLCD_DIS . LCD_Dis_Column = LCD_HEIGHT ; sLCD_DIS . LCD_Dis_Page = LCD_WIDTH ; } else { sLCD_DIS . LCD_Dis_Column = LCD_WIDTH ; sLCD_DIS . LCD_Dis_Page = LCD_HEIGHT ; } uint16_t MemoryAccessReg_Data = 0 ; switch ( Scan_dir ) { case L2R_U2D : MemoryAccessReg_Data = 0 X00 | 0x00 ; break ; case L2R_D2U : MemoryAccessReg_Data = 0x00 | 0x80 ; break ; case R2L_U2D : MemoryAccessReg_Data = 0x40 | 0x00 ; break ; case R2L_D2U : MemoryAccessReg_Data = 0x40 | 0x80 ; break ; case U2D_L2R : MemoryAccessReg_Data = 0 X00 | 0 X00 | 0x20 ; break ; case U2D_R2L : MemoryAccessReg_Data = 0x00 | 0 X40 | 0x20 ; break ; case D2U_L2R : MemoryAccessReg_Data = 0x80 | 0x00 | 0x20 ; break ; case D2U_R2L : MemoryAccessReg_Data = 0x40 | 0x80 | 0x20 ; break ; } if ( ( MemoryAccessReg_Data && 0x20 ) != 1 ) { sLCD_DIS . LCD_X_Adjust = LCD_X ; sLCD_DIS . LCD_Y_Adjust = LCD_Y ; } else { sLCD_DIS . LCD_X_Adjust = LCD_Y ; sLCD_DIS . LCD_Y_Adjust = LCD_X ; } LCD_WriteReg ( 0x36 ) ; LCD_WriteData_8Bit ( MemoryAccessReg_Data & 0xf7 ) ; }
function:       Set the display scan and color transfer modes
parameter:
Scan_dir   :   Scan direction
Colorchose :   RGB or GBR color format
function : Set the display scan and color transfer modes parameter : Scan_dir : Scan direction Colorchose : RGB or GBR color format
//Get the screen scan direction //Get GRAM and LCD width and height // Gets the scan direction of GRAM //0x36 //x Scan direction | y Scan direction //0xC8 | 0X10 //0X4 //0XC //0X2 //0X6 //0XA //0XE //please set (MemoryAccessReg_Data & 0x10) != 1 // Set the read / write scan direction of the frame memory //MX, MY, RGB mode //RGB color filter panel