Gdisp lld driver corrections
Corrections to Nokia gdisp driver - Fix for the application calling the unsupported gdispSetOrientation and gdispSetPower - Implemented full backlight control (on/off only currently) Corrections to the Ili9320 driver - Fix for the application calling the unsupported gdispSetOrientation - Fix for initialisation of the backlight - Fix for backlight when using display low power modes.
This commit is contained in:
parent
00f95af7f8
commit
4d521cff13
4 changed files with 64 additions and 25 deletions
|
@ -56,6 +56,9 @@
|
||||||
#define GDISP_SCREEN_WIDTH 240
|
#define GDISP_SCREEN_WIDTH 240
|
||||||
#define GDISP_SCREEN_HEIGHT 320
|
#define GDISP_SCREEN_HEIGHT 320
|
||||||
|
|
||||||
|
#define GDISP_INITIAL_CONTRAST 50
|
||||||
|
#define GDISP_INITIAL_BACKLIGHT 100
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver exported variables. */
|
/* Driver exported variables. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -206,13 +209,16 @@ bool_t GDISP_LLD(init)(void) {
|
||||||
lld_lcdWriteReg(0x0098, 0x0110); //
|
lld_lcdWriteReg(0x0098, 0x0110); //
|
||||||
lld_lcdWriteReg(0x0007, 0x0173); //display On
|
lld_lcdWriteReg(0x0007, 0x0173); //display On
|
||||||
|
|
||||||
|
// Turn on the backlight
|
||||||
|
GDISP_LLD(set_backlight)(GDISP_INITIAL_BACKLIGHT);
|
||||||
|
|
||||||
/* Initialise the GDISP structure */
|
/* Initialise the GDISP structure */
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Orientation = GDISP_ROTATE_0;
|
GDISP.Orientation = GDISP_ROTATE_0;
|
||||||
GDISP.Powermode = powerOn;
|
GDISP.Powermode = powerOn;
|
||||||
GDISP.Backlight = 0;
|
GDISP.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||||
GDISP.Contrast = 50;
|
GDISP.Contrast = GDISP_INITIAL_CONTRAST;
|
||||||
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
||||||
GDISP.clipx0 = 0;
|
GDISP.clipx0 = 0;
|
||||||
GDISP.clipy0 = 0;
|
GDISP.clipy0 = 0;
|
||||||
|
@ -418,6 +424,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
lld_lcdWriteReg(0x0011, 0x0000);
|
lld_lcdWriteReg(0x0011, 0x0000);
|
||||||
lld_lcdWriteReg(0x0012, 0x0000);
|
lld_lcdWriteReg(0x0012, 0x0000);
|
||||||
lld_lcdWriteReg(0x0013, 0x0000);
|
lld_lcdWriteReg(0x0013, 0x0000);
|
||||||
|
GDISP_LLD(set_backlight)(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case powerOn:
|
case powerOn:
|
||||||
|
@ -436,6 +443,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
lld_lcdWriteReg(0x0029, 0x0009); /* VCM[4:0] for VCOMH */
|
lld_lcdWriteReg(0x0029, 0x0009); /* VCM[4:0] for VCOMH */
|
||||||
lld_lcdDelay(500);
|
lld_lcdDelay(500);
|
||||||
lld_lcdWriteReg(0x0007, 0x0173); /* 262K color and display ON */
|
lld_lcdWriteReg(0x0007, 0x0173); /* 262K color and display ON */
|
||||||
|
GDISP_LLD(set_backlight)(GDISP.Backlight);
|
||||||
if(GDISP.Powermode != powerSleep || GDISP.Powermode != powerDeepSleep)
|
if(GDISP.Powermode != powerSleep || GDISP.Powermode != powerDeepSleep)
|
||||||
GDISP_LLD(init)();
|
GDISP_LLD(init)();
|
||||||
break;
|
break;
|
||||||
|
@ -448,6 +456,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
||||||
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||||
lld_lcdWriteReg(0x0010, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
lld_lcdWriteReg(0x0010, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||||
|
GDISP_LLD(set_backlight)(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case powerDeepSleep:
|
case powerDeepSleep:
|
||||||
|
@ -458,6 +467,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
lld_lcdWriteReg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
||||||
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
lld_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||||
lld_lcdWriteReg(0x0010, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
lld_lcdWriteReg(0x0010, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||||
|
GDISP_LLD(set_backlight)(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -466,6 +476,8 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
GDISP.Powermode = (gdisp_powermode_t)value;
|
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// NOT IMPLEMENTED YET
|
||||||
case GDISP_CONTROL_ORIENTATION:
|
case GDISP_CONTROL_ORIENTATION:
|
||||||
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
||||||
return;
|
return;
|
||||||
|
@ -506,6 +518,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
#endif
|
#endif
|
||||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
case GDISP_CONTROL_BACKLIGHT:
|
case GDISP_CONTROL_BACKLIGHT:
|
||||||
if((unsigned)value > 100) value = (void *)100;
|
if((unsigned)value > 100) value = (void *)100;
|
||||||
|
|
|
@ -57,7 +57,9 @@
|
||||||
#endif
|
#endif
|
||||||
#define GDISP_SCREEN_HEIGHT 132
|
#define GDISP_SCREEN_HEIGHT 132
|
||||||
#define GDISP_SCREEN_WIDTH 132
|
#define GDISP_SCREEN_WIDTH 132
|
||||||
|
|
||||||
#define GDISP_INITIAL_CONTRAST 38
|
#define GDISP_INITIAL_CONTRAST 38
|
||||||
|
#define GDISP_INITIAL_BACKLIGHT 100
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver exported variables. */
|
/* Driver exported variables. */
|
||||||
|
@ -214,14 +216,14 @@ bool_t GDISP_LLD(init)(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Turn on the back-light */
|
/* Turn on the back-light */
|
||||||
GDISP_LLD(setpin_backlight)(TRUE);
|
GDISP_LLD(set_backlight)(GDISP_INITIAL_BACKLIGHT);
|
||||||
|
|
||||||
/* Initialise the GDISP structure to match */
|
/* Initialise the GDISP structure to match */
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Orientation = GDISP_ROTATE_0;
|
GDISP.Orientation = GDISP_ROTATE_0;
|
||||||
GDISP.Powermode = powerOn;
|
GDISP.Powermode = powerOn;
|
||||||
GDISP.Backlight = 100;
|
GDISP.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||||
GDISP.Contrast = GDISP_INITIAL_CONTRAST;
|
GDISP.Contrast = GDISP_INITIAL_CONTRAST;
|
||||||
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
||||||
GDISP.clipx0 = 0;
|
GDISP.clipx0 = 0;
|
||||||
|
@ -466,27 +468,27 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void GDISP_LLD(control)(unsigned what, void *value) {
|
void GDISP_LLD(control)(unsigned what, void *value) {
|
||||||
/* NOT IMPLEMENTED YET */
|
|
||||||
/* The hardware is capable of supporting...
|
/* The hardware is capable of supporting...
|
||||||
* GDISP_CONTROL_POWER
|
* GDISP_CONTROL_POWER - not implemented yet
|
||||||
* GDISP_CONTROL_ORIENTATION
|
* GDISP_CONTROL_ORIENTATION - not implemented yet
|
||||||
* GDISP_CONTROL_BACKLIGHT (at least on the Olimex board)
|
* GDISP_CONTROL_BACKLIGHT - supported (the OlimexSAM7EX256 board.h currently only implements off/on although PWM is supported by the hardware)
|
||||||
* GDISP_CONTROL_CONTRAST
|
* GDISP_CONTROL_CONTRAST - supported
|
||||||
* We don't currently implement any of it.
|
|
||||||
*/
|
*/
|
||||||
switch(what) {
|
switch(what) {
|
||||||
|
#if 0
|
||||||
|
// NOT IMPLEMENTED YET
|
||||||
case GDISP_CONTROL_POWER:
|
case GDISP_CONTROL_POWER:
|
||||||
if (GDISP.Powermode == (gdisp_powermode_t)value)
|
if (GDISP.Powermode == (gdisp_powermode_t)value)
|
||||||
return;
|
return;
|
||||||
switch((gdisp_powermode_t)value) {
|
switch((gdisp_powermode_t)value) {
|
||||||
case powerOff:
|
case powerOff:
|
||||||
/* Code here */
|
// Code here
|
||||||
break;
|
break;
|
||||||
case powerOn:
|
case powerOn:
|
||||||
/* Code here */
|
// Code here
|
||||||
/* You may need this ---
|
/* You may need this ---
|
||||||
if (GDISP.Powermode != powerSleep)
|
* if (GDISP.Powermode != powerSleep)
|
||||||
GDISP_LLD(init)();
|
* GDISP_LLD(init)();
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case powerSleep:
|
case powerSleep:
|
||||||
|
@ -497,6 +499,9 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
}
|
}
|
||||||
GDISP.Powermode = (gdisp_powermode_t)value;
|
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
// NOT IMPLEMENTED YET
|
||||||
case GDISP_CONTROL_ORIENTATION:
|
case GDISP_CONTROL_ORIENTATION:
|
||||||
if (GDISP.Orientation == (gdisp_orientation_t)value)
|
if (GDISP.Orientation == (gdisp_orientation_t)value)
|
||||||
return;
|
return;
|
||||||
|
@ -504,22 +509,22 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
// WriteSpiData(0xC8); // restore to (mirror x and y, reverse rgb)
|
// WriteSpiData(0xC8); // restore to (mirror x and y, reverse rgb)
|
||||||
switch((gdisp_orientation_t)value) {
|
switch((gdisp_orientation_t)value) {
|
||||||
case GDISP_ROTATE_0:
|
case GDISP_ROTATE_0:
|
||||||
/* Code here */
|
// Code here
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
break;
|
break;
|
||||||
case GDISP_ROTATE_90:
|
case GDISP_ROTATE_90:
|
||||||
/* Code here */
|
// Code here
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
break;
|
break;
|
||||||
case GDISP_ROTATE_180:
|
case GDISP_ROTATE_180:
|
||||||
/* Code here */
|
// Code here
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
break;
|
break;
|
||||||
case GDISP_ROTATE_270:
|
case GDISP_ROTATE_270:
|
||||||
/* Code here */
|
// Code here
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
break;
|
break;
|
||||||
|
@ -534,9 +539,12 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
#endif
|
#endif
|
||||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||||
return;
|
return;
|
||||||
/*
|
#endif
|
||||||
case GDISP_CONTROL_BACKLIGHT:
|
case GDISP_CONTROL_BACKLIGHT:
|
||||||
*/
|
if ((unsigned)value > 100) value = (void *)100;
|
||||||
|
GDISP_LLD(set_backlight)((uint8_t)(unsigned)value);
|
||||||
|
GDISP.Backlight = (unsigned)value;
|
||||||
|
return;
|
||||||
case GDISP_CONTROL_CONTRAST:
|
case GDISP_CONTROL_CONTRAST:
|
||||||
if ((unsigned)value > 100) value = (void *)100;
|
if ((unsigned)value > 100) value = (void *)100;
|
||||||
#if defined(GDISP_USE_GE8)
|
#if defined(GDISP_USE_GE8)
|
||||||
|
|
|
@ -56,6 +56,21 @@ static __inline void GDISP_LLD(setpin_reset)(bool_t state) {
|
||||||
#error "gdispNokia6610: You must supply a definition for setpin_reset for your board"
|
#error "gdispNokia6610: You must supply a definition for setpin_reset for your board"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the lcd back-light level.
|
||||||
|
* @note For now 0% turns the backlight off, anything else the backlight is on.
|
||||||
|
* While the hardware supports PWM backlight control, we are not using it
|
||||||
|
* yet.
|
||||||
|
*
|
||||||
|
* @param[in] percent 0 to 100%
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline void GDISP_LLD(set_backlight)(uint8_t percent) {
|
||||||
|
/* Code here */
|
||||||
|
#error "gdispNokia6610: You must supply a definition for set_backlight for your board"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send an 8 bit command to the lcd.
|
* @brief Send an 8 bit command to the lcd.
|
||||||
*
|
*
|
||||||
|
|
|
@ -156,14 +156,17 @@ static __inline void GDISP_LLD(setpin_reset)(bool_t state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set or clear the lcd back-light pin.
|
* @brief Set the lcd back-light level.
|
||||||
|
* @note For now 0% turns the backlight off, anything else the backlight is on.
|
||||||
|
* While the hardware supports PWM backlight control, we are not using it
|
||||||
|
* yet.
|
||||||
*
|
*
|
||||||
* @param[in] state TRUE = lcd back-light on, FALSE = lcd back-light off
|
* @param[in] percent 0 to 100%
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void GDISP_LLD(setpin_backlight)(bool_t state) {
|
static __inline void GDISP_LLD(set_backlight)(uint8_t percent) {
|
||||||
if (state)
|
if (percent)
|
||||||
palSetPad(IOPORT2, PIOB_LCD_BL);
|
palSetPad(IOPORT2, PIOB_LCD_BL);
|
||||||
// pPIOB->PIO_SODR = PIOB_LCD_BL_MASK;
|
// pPIOB->PIO_SODR = PIOB_LCD_BL_MASK;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue