Merge pull request #18 from inmarket/master
Nokia and Ili9320 gdisp drivers
This commit is contained in:
commit
ce4d7cf933
4 changed files with 64 additions and 25 deletions
|
@ -56,6 +56,9 @@
|
|||
#define GDISP_SCREEN_WIDTH 240
|
||||
#define GDISP_SCREEN_HEIGHT 320
|
||||
|
||||
#define GDISP_INITIAL_CONTRAST 50
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
@ -206,13 +209,16 @@ bool_t GDISP_LLD(init)(void) {
|
|||
lld_lcdWriteReg(0x0098, 0x0110); //
|
||||
lld_lcdWriteReg(0x0007, 0x0173); //display On
|
||||
|
||||
// Turn on the backlight
|
||||
GDISP_LLD(set_backlight)(GDISP_INITIAL_BACKLIGHT);
|
||||
|
||||
/* Initialise the GDISP structure */
|
||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||
GDISP.Orientation = GDISP_ROTATE_0;
|
||||
GDISP.Powermode = powerOn;
|
||||
GDISP.Backlight = 0;
|
||||
GDISP.Contrast = 50;
|
||||
GDISP.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
GDISP.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
||||
GDISP.clipx0 = 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(0x0012, 0x0000);
|
||||
lld_lcdWriteReg(0x0013, 0x0000);
|
||||
GDISP_LLD(set_backlight)(0);
|
||||
break;
|
||||
|
||||
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_lcdDelay(500);
|
||||
lld_lcdWriteReg(0x0007, 0x0173); /* 262K color and display ON */
|
||||
GDISP_LLD(set_backlight)(GDISP.Backlight);
|
||||
if(GDISP.Powermode != powerSleep || GDISP.Powermode != powerDeepSleep)
|
||||
GDISP_LLD(init)();
|
||||
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_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||
lld_lcdWriteReg(0x0010, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||
GDISP_LLD(set_backlight)(0);
|
||||
break;
|
||||
|
||||
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_lcdDelay(2000); /* Dis-charge capacitor power voltage */
|
||||
lld_lcdWriteReg(0x0010, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
|
||||
GDISP_LLD(set_backlight)(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -466,6 +476,8 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||
return;
|
||||
|
||||
#if 0
|
||||
// NOT IMPLEMENTED YET
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
||||
return;
|
||||
|
@ -506,6 +518,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
#endif
|
||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case GDISP_CONTROL_BACKLIGHT:
|
||||
if((unsigned)value > 100) value = (void *)100;
|
||||
|
|
|
@ -57,7 +57,9 @@
|
|||
#endif
|
||||
#define GDISP_SCREEN_HEIGHT 132
|
||||
#define GDISP_SCREEN_WIDTH 132
|
||||
|
||||
#define GDISP_INITIAL_CONTRAST 38
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
|
@ -214,14 +216,14 @@ bool_t GDISP_LLD(init)(void) {
|
|||
#endif
|
||||
|
||||
/* Turn on the back-light */
|
||||
GDISP_LLD(setpin_backlight)(TRUE);
|
||||
GDISP_LLD(set_backlight)(GDISP_INITIAL_BACKLIGHT);
|
||||
|
||||
/* Initialise the GDISP structure to match */
|
||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||
GDISP.Orientation = GDISP_ROTATE_0;
|
||||
GDISP.Powermode = powerOn;
|
||||
GDISP.Backlight = 100;
|
||||
GDISP.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
GDISP.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
||||
GDISP.clipx0 = 0;
|
||||
|
@ -466,28 +468,28 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
* @notapi
|
||||
*/
|
||||
void GDISP_LLD(control)(unsigned what, void *value) {
|
||||
/* NOT IMPLEMENTED YET */
|
||||
/* The hardware is capable of supporting...
|
||||
* GDISP_CONTROL_POWER
|
||||
* GDISP_CONTROL_ORIENTATION
|
||||
* GDISP_CONTROL_BACKLIGHT (at least on the Olimex board)
|
||||
* GDISP_CONTROL_CONTRAST
|
||||
* We don't currently implement any of it.
|
||||
* GDISP_CONTROL_POWER - not implemented yet
|
||||
* GDISP_CONTROL_ORIENTATION - not implemented yet
|
||||
* GDISP_CONTROL_BACKLIGHT - supported (the OlimexSAM7EX256 board.h currently only implements off/on although PWM is supported by the hardware)
|
||||
* GDISP_CONTROL_CONTRAST - supported
|
||||
*/
|
||||
switch(what) {
|
||||
#if 0
|
||||
// NOT IMPLEMENTED YET
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (GDISP.Powermode == (gdisp_powermode_t)value)
|
||||
return;
|
||||
switch((gdisp_powermode_t)value) {
|
||||
case powerOff:
|
||||
/* Code here */
|
||||
// Code here
|
||||
break;
|
||||
case powerOn:
|
||||
/* Code here */
|
||||
// Code here
|
||||
/* You may need this ---
|
||||
if (GDISP.Powermode != powerSleep)
|
||||
GDISP_LLD(init)();
|
||||
*/
|
||||
* if (GDISP.Powermode != powerSleep)
|
||||
* GDISP_LLD(init)();
|
||||
*/
|
||||
break;
|
||||
case powerSleep:
|
||||
/* Code here */
|
||||
|
@ -497,6 +499,9 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
}
|
||||
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||
return;
|
||||
#endif
|
||||
#if 0
|
||||
// NOT IMPLEMENTED YET
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (GDISP.Orientation == (gdisp_orientation_t)value)
|
||||
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)
|
||||
switch((gdisp_orientation_t)value) {
|
||||
case GDISP_ROTATE_0:
|
||||
/* Code here */
|
||||
// Code here
|
||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
/* Code here */
|
||||
// Code here
|
||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
/* Code here */
|
||||
// Code here
|
||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_270:
|
||||
/* Code here */
|
||||
// Code here
|
||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
|
@ -534,9 +539,12 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
#endif
|
||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||
return;
|
||||
/*
|
||||
#endif
|
||||
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:
|
||||
if ((unsigned)value > 100) value = (void *)100;
|
||||
#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"
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
static __inline void GDISP_LLD(setpin_backlight)(bool_t state) {
|
||||
if (state)
|
||||
static __inline void GDISP_LLD(set_backlight)(uint8_t percent) {
|
||||
if (percent)
|
||||
palSetPad(IOPORT2, PIOB_LCD_BL);
|
||||
// pPIOB->PIO_SODR = PIOB_LCD_BL_MASK;
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue