implemented power modes for ILI9320
This commit is contained in:
parent
fafe23f2e4
commit
7ccd3da85f
2 changed files with 111 additions and 66 deletions
|
@ -408,76 +408,121 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
*/
|
*/
|
||||||
void GDISP_LLD(control)(unsigned what, void *value) {
|
void GDISP_LLD(control)(unsigned what, void *value) {
|
||||||
switch(what) {
|
switch(what) {
|
||||||
case GDISP_CONTROL_POWER:
|
case GDISP_CONTROL_POWER:
|
||||||
if (GDISP.Powermode == (gdisp_powermode_t)value)
|
if(GDISP.Powermode == (gdisp_powermode_t)value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch((gdisp_powermode_t)value) {
|
||||||
|
case powerOff:
|
||||||
|
lld_lcdWriteReg(0x0007, 0x0000);
|
||||||
|
lld_lcdWriteReg(0x0010, 0x0000);
|
||||||
|
lld_lcdWriteReg(0x0011, 0x0000);
|
||||||
|
lld_lcdWriteReg(0x0012, 0x0000);
|
||||||
|
lld_lcdWriteReg(0x0013, 0x0000);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case powerOn:
|
||||||
|
//*************Power On sequence ******************//
|
||||||
|
lld_lcdWriteReg(0x0010, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||||
|
lld_lcdWriteReg(0x0011, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||||
|
lld_lcdWriteReg(0x0012, 0x0000); /* VREG1OUT voltage */
|
||||||
|
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
||||||
|
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||||
|
lld_lcdWriteReg(0x0010, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||||
|
lld_lcdWriteReg(0x0011, 0x0147); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||||
|
lld_lcdDelay(500);
|
||||||
|
lld_lcdWriteReg(0x0012, 0x013C); /* VREG1OUT voltage */
|
||||||
|
lld_lcdDelay(500);
|
||||||
|
lld_lcdWriteReg(0x0013, 0x0E00); /* VDV[4:0] for VCOM amplitude */
|
||||||
|
lld_lcdWriteReg(0x0029, 0x0009); /* VCM[4:0] for VCOMH */
|
||||||
|
lld_lcdDelay(500);
|
||||||
|
lld_lcdWriteReg(0x0007, 0x0173); /* 262K color and display ON */
|
||||||
|
if(GDISP.Powermode != powerSleep || GDISP.Powermode != powerDeepSleep)
|
||||||
|
GDISP_LLD(init)();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case powerSleep:
|
||||||
|
lld_lcdWriteReg(0x0007, 0x0000); /* display OFF */
|
||||||
|
lld_lcdWriteReg(0x0010, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||||
|
lld_lcdWriteReg(0x0011, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||||
|
lld_lcdWriteReg(0x0012, 0x0000); /* VREG1OUT voltage */
|
||||||
|
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
||||||
|
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||||
|
lld_lcdWriteReg(0x0010, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case powerDeepSleep:
|
||||||
|
lld_lcdWriteReg(0x0007, 0x0000); /* display OFF */
|
||||||
|
lld_lcdWriteReg(0x0010, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||||
|
lld_lcdWriteReg(0x0011, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||||
|
lld_lcdWriteReg(0x0012, 0x0000); /* VREG1OUT voltage */
|
||||||
|
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
||||||
|
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||||
|
lld_lcdWriteReg(0x0010, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||||
return;
|
return;
|
||||||
switch((gdisp_powermode_t)value) {
|
|
||||||
case powerOff:
|
case GDISP_CONTROL_ORIENTATION:
|
||||||
lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
|
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
||||||
lld_lcdWriteReg(0x0007, 0x0000); // halt operation
|
return;
|
||||||
lld_lcdWriteReg(0x0000, 0x0000); // turn off oszillator
|
switch((gdisp_orientation_t)value) {
|
||||||
lld_lcdWriteReg(0x0010, 0x0001); // enter sleepmode
|
case GDISP_ROTATE_0:
|
||||||
break;
|
lld_lcdWriteReg(0x0001, 0x2B3F);
|
||||||
case powerOn:
|
/* ID = 11 AM = 0 */
|
||||||
lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
|
lld_lcdWriteReg(0x0011, 0x6070);
|
||||||
if (GDISP.Powermode != powerSleep)
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP_LLD(init)();
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
break;
|
break;
|
||||||
case powerSleep:
|
|
||||||
lld_lcdWriteReg(0x0010, 0x0001); // enter sleep mode
|
case GDISP_ROTATE_90:
|
||||||
break;
|
lld_lcdWriteReg(0x0001, 0x293F);
|
||||||
default:
|
/* ID = 11 AM = 1 */
|
||||||
return;
|
lld_lcdWriteReg(0x0011, 0x6078);
|
||||||
}
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Powermode = (gdisp_powermode_t)value;
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
return;
|
break;
|
||||||
case GDISP_CONTROL_ORIENTATION:
|
|
||||||
if (GDISP.Orientation == (gdisp_orientation_t)value)
|
case GDISP_ROTATE_180:
|
||||||
return;
|
lld_lcdWriteReg(0x0001, 0x2B3F);
|
||||||
switch((gdisp_orientation_t)value) {
|
/* ID = 01 AM = 0 */
|
||||||
case GDISP_ROTATE_0:
|
lld_lcdWriteReg(0x0011, 0x6040);
|
||||||
lld_lcdWriteReg(0x0001, 0x2B3F);
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
/* ID = 11 AM = 0 */
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
lld_lcdWriteReg(0x0011, 0x6070);
|
break;
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
case GDISP_ROTATE_270:
|
||||||
break;
|
lld_lcdWriteReg(0x0001, 0x293F);
|
||||||
case GDISP_ROTATE_90:
|
/* ID = 01 AM = 1 */
|
||||||
lld_lcdWriteReg(0x0001, 0x293F);
|
lld_lcdWriteReg(0x0011, 0x6048);
|
||||||
/* ID = 11 AM = 1 */
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
lld_lcdWriteReg(0x0011, 0x6078);
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
break;
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
|
||||||
break;
|
default:
|
||||||
case GDISP_ROTATE_180:
|
return;
|
||||||
lld_lcdWriteReg(0x0001, 0x2B3F);
|
}
|
||||||
/* ID = 01 AM = 0 */
|
|
||||||
lld_lcdWriteReg(0x0011, 0x6040);
|
#if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
|
||||||
break;
|
|
||||||
case GDISP_ROTATE_270:
|
|
||||||
lld_lcdWriteReg(0x0001, 0x293F);
|
|
||||||
/* ID = 01 AM = 1 */
|
|
||||||
lld_lcdWriteReg(0x0011, 0x6048);
|
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
|
|
||||||
GDISP.clipx0 = 0;
|
GDISP.clipx0 = 0;
|
||||||
GDISP.clipy0 = 0;
|
GDISP.clipy0 = 0;
|
||||||
GDISP.clipx1 = GDISP.Width;
|
GDISP.clipx1 = GDISP.Width;
|
||||||
GDISP.clipy1 = GDISP.Height;
|
GDISP.clipy1 = GDISP.Height;
|
||||||
#endif
|
#endif
|
||||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||||
return;
|
return;
|
||||||
/*
|
|
||||||
case GDISP_CONTROL_BACKLIGHT:
|
case GDISP_CONTROL_BACKLIGHT:
|
||||||
case GDISP_CONTROL_CONTRAST:
|
/* ToDo */
|
||||||
*/
|
break;
|
||||||
|
|
||||||
|
case GDISP_CONTROL_CONTRAST:
|
||||||
|
/* ToDo */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ typedef enum orientation {GDISP_ROTATE_0, GDISP_ROTATE_90, GDISP_ROTATE_180, GDI
|
||||||
/**
|
/**
|
||||||
* @brief Type for the available power modes for the screen.
|
* @brief Type for the available power modes for the screen.
|
||||||
*/
|
*/
|
||||||
typedef enum powermode {powerOff, powerSleep, powerOn} gdisp_powermode_t;
|
typedef enum powermode {powerOff, powerSleep, powerDeepSleep, powerOn} gdisp_powermode_t;
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue