void ILI9341_HSD2.8_Initial(void)
{
// VCI=2.8V
//************* Reset LCD Driver ****************//
LCD_nRESET = 1;
delayms(1); // Delay 1ms
LCD_nRESET = 0;
delayms(10); // Delay 10ms // This delay time is necessary
LCD_nRESET = 1;
delayms(120); // Delay 120 ms
//************* Start Initial Sequence **********//
LLCD_WRITE_CMD(0xCF);
LLCD_WRITE_DATA(0x00);
LLCD_WRITE_DATA(0xC1);
LLCD_WRITE_DATA(0x30);

LLCD_WRITE_CMD(0xED);
LLCD_WRITE_DATA(0x64);
LLCD_WRITE_DATA(0x03);
LLCD_WRITE_DATA(0x12);
LLCD_WRITE_DATA(0x81);

LLCD_WRITE_CMD(0xE8);
LLCD_WRITE_DATA(0x85);
LLCD_WRITE_DATA(0x01);
LLCD_WRITE_DATA(0x7A);

LLCD_WRITE_CMD(0xCB);
LLCD_WRITE_DATA(0x39);
LLCD_WRITE_DATA(0x2C);
LLCD_WRITE_DATA(0x00);
LLCD_WRITE_DATA(0x34);
LLCD_WRITE_DATA(0x02);

LLCD_WRITE_CMD(0xF7);
LLCD_WRITE_DATA(0x20);

LLCD_WRITE_CMD(0xEA);
LLCD_WRITE_DATA(0x00);
LLCD_WRITE_DATA(0x00);

LLCD_WRITE_CMD(0xC0); //Power control
LLCD_WRITE_DATA(0x21); //VRH[5:0]

LLCD_WRITE_CMD(0xC1); //Power control
LLCD_WRITE_DATA(0x11); //SAP[2:0];BT[3:0]

LLCD_WRITE_CMD(0xC5); //VCM control
LLCD_WRITE_DATA(0x31);
LLCD_WRITE_DATA(0x3C);

LLCD_WRITE_CMD(0xC7); //VCM control2
LLCD_WRITE_DATA(0x9f);

LLCD_WRITE_CMD(0x36); // Memory Access Control
LLCD_WRITE_DATA(0x08);

LLCD_WRITE_CMD(0x3A); // Memory Access Control
LLCD_WRITE_DATA(0x55);

LLCD_WRITE_CMD(0xB1);
LLCD_WRITE_DATA(0x00);
LLCD_WRITE_DATA(0x1B);

LLCD_WRITE_CMD(0xB6); // Display Function Control
LLCD_WRITE_DATA(0x0A);
LLCD_WRITE_DATA(0xA2);

LLCD_WRITE_CMD(0xF2); // 3Gamma Function Disable
LLCD_WRITE_DATA(0x00);

LLCD_WRITE_CMD(0x26); //Gamma curve selected
LLCD_WRITE_DATA(0x01);

LLCD_WRITE_CMD(0xE0); //Set Gamma
LLCD_WRITE_DATA(0x0F);
LLCD_WRITE_DATA(0x20);
LLCD_WRITE_DATA(0x1d);
LLCD_WRITE_DATA(0x0b);
LLCD_WRITE_DATA(0x10);
LLCD_WRITE_DATA(0x0a);
LLCD_WRITE_DATA(0x49);
LLCD_WRITE_DATA(0xa9);
LLCD_WRITE_DATA(0x3b);
LLCD_WRITE_DATA(0x0a);
LLCD_WRITE_DATA(0x15);
LLCD_WRITE_DATA(0x06);
LLCD_WRITE_DATA(0x0c);
LLCD_WRITE_DATA(0x06);
LLCD_WRITE_DATA(0x00);
LLCD_WRITE_CMD(0XE1); //Set Gamma
LLCD_WRITE_DATA(0x00);
LLCD_WRITE_DATA(0x1f);
LLCD_WRITE_DATA(0x22);
LLCD_WRITE_DATA(0x04);
LLCD_WRITE_DATA(0x0f);
LLCD_WRITE_DATA(0x05);
LLCD_WRITE_DATA(0x36);
LLCD_WRITE_DATA(0x46);
LLCD_WRITE_DATA(0x46);
LLCD_WRITE_DATA(0x05);
LLCD_WRITE_DATA(0x0b);
LLCD_WRITE_DATA(0x09);
LLCD_WRITE_DATA(0x33);
LLCD_WRITE_DATA(0x39);
LLCD_WRITE_DATA(0x0F);

LLCD_WRITE_CMD(0x11); // Sleep out
Delayms(120);
LLCD_WRITE_CMD(0x29); // Display on
LLCD_WRITE_CMD(0x2c)
}


void LCD_Enter Sleep_ILI9341(void)
{
LLCD_WRITE_CMD(0x28); // Display off
delayms(20);
LLCD_WRITE_CMD(0x10); // Enter Sleep mode
}

void LCD_Exit Sleep _ILI9341(void)
{
 static unsigned int aa=0x94;  //设置一个静态变量用作调水波纹
LLCD_WRITE_CMD(0x11); // Sleep out
Delayms(120);
LLCD_WRITE_CMD(0x29); // Display on

LLCD_WRITE_CMD(0xC7); //VCM control2
LLCD_WRITE_DATA(aa);
aa+=0x02;

}
