1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-21 07:15:12 +03:00

Taranis+ LCD driver a little bit improved

This commit is contained in:
bsongis 2014-07-01 11:39:01 +02:00
parent 013e6925dc
commit a9dd0d0dfb

View file

@ -15,49 +15,61 @@
#define WriteCommand(x) AspiCmd(x) #define WriteCommand(x) AspiCmd(x)
#if defined(REVPLUS) #if defined(REVPLUS)
#define CONTRAST_OFS 120 #define CONTRAST_OFS 160
#else #else
#define CONTRAST_OFS 5 #define CONTRAST_OFS 5
#endif #endif
//275us
void Delay(volatile unsigned int ms)
{
volatile u8 i;
while(ms != 0) {
for(i=0;i<250;i++) {}
for(i=0;i<75;i++) {}
ms--;
}
}
#if defined(REVPLUS) #if defined(REVPLUS)
static void LCD_Init() static void LCD_Init()
{ {
AspiCmd(0x25); //(5) Temperature compensation curve definition: 0x25 = -0.05%/oC WriteCommand(0x2F); //Internal pump control
AspiCmd(0x2b); //(6) Panel loading set ,Internal VLCD. Delay(20);
AspiCmd(0xEA); //(27) set bias=1/10 WriteCommand(0x24); //Temperature compensation
AspiCmd(0x81); //(11) Set Vop + next byte WriteCommand(0xE9); //set bias=1/10
WriteCommand(0x81); //Set Vop
#if defined(BOOT) #if defined(BOOT)
AspiCmd(CONTRAST_OFS+25); AspiCmd(CONTRAST_OFS+25);
#else #else
AspiCmd(CONTRAST_OFS+g_eeGeneral.contrast); AspiCmd(CONTRAST_OFS+g_eeGeneral.contrast);
#endif #endif
AspiCmd(0xA6); //inverse display off WriteCommand(0xA2); //set line rate:28KLPS
AspiCmd(0xA1); //line rates,24 Klps WriteCommand(0x28); //set pannel loading
AspiCmd(0x84); //Disable Partial Display WriteCommand(0x40); //scroll line LSB
AspiCmd(0xC8); //SET N-LINE INVERSION WriteCommand(0x50); //SCROLL LINE MSB
AspiCmd(0x00); //Disable NIV WriteCommand(0x89); //ram address control
AspiCmd(0xF1); //Set CEN WriteCommand(0xC0); //LCD mapping control
AspiCmd(0x3F); // 1/64DUTY WriteCommand(0x04); //MX=0,MY=1
AspiCmd(0xC0); //(21) Set mapping WriteCommand(0xD0); //DISPLAY PATTERN = 16-SCALE GRAY
AspiCmd(0x05); // MY=1, MX=0, MSF=0 WriteCommand(0xF1); //SET COM end
AspiCmd(0x89); //(15) WA=1,column (CA) increment (+1) first until CA reaches CA boundary, then RA will increment by (+1). WriteCommand(0x3F); //64
AspiCmd(0xF8); //Set Window Program Enable ,inside modle
AspiCmd(0xD0); //(23) SET 4 bits/pixel, pattern 0 WriteCommand(0xF8); //Set Window Program Disable.
AspiCmd(0xF4); //starting column address of RAM program window.
AspiCmd(0x00); WriteCommand(0xF5); //starting row address of RAM program window.PAGE1
AspiCmd(0xF5); //starting row address of RAM program window. WriteCommand(0x00);
AspiCmd(0x00); WriteCommand(0xF7); //end row address of RAM program window.PAGE32
AspiCmd(0xF6); //ending column address of RAM program window. WriteCommand(0x1F);
AspiCmd(0xD3); WriteCommand(0xF4); //start column address of RAM program window.
AspiCmd(0xF7); //ending row address of RAM program window. WriteCommand(0x00);
AspiCmd(0x3F); WriteCommand(0xF6); //end column address of RAM program window.SEG212
AspiCmd(0xAF); // Active and 16-grey scale WriteCommand(0xD3);
} }
#else #else
static void LCD_Init() static void LCD_Init()
{ {
AspiCmd(0x2b); //Panel loading set ,Internal VLCD. AspiCmd(0x2B); //Panel loading set ,Internal VLCD.
AspiCmd(0x25); //Temperature compensation curve definition: 0x25 = -0.05%/oC AspiCmd(0x25); //Temperature compensation curve definition: 0x25 = -0.05%/oC
AspiCmd(0xEA); //set bias=1/10 :Command table NO.27 AspiCmd(0xEA); //set bias=1/10 :Command table NO.27
AspiCmd(0x81); //Set Vop AspiCmd(0x81); //Set Vop
@ -131,14 +143,14 @@ void lcdRefresh()
uint8_t b = p[2*DISPLAY_PLAN_SIZE+x] ; uint8_t b = p[2*DISPLAY_PLAN_SIZE+x] ;
uint8_t c = p[DISPLAY_PLAN_SIZE+x] ; uint8_t c = p[DISPLAY_PLAN_SIZE+x] ;
uint8_t d = p[x] ; uint8_t d = p[x] ;
LCD_WRITE_BIT(a & mask);
LCD_WRITE_BIT(b & mask);
LCD_WRITE_BIT(c & mask);
LCD_WRITE_BIT(d & mask);
LCD_WRITE_BIT(a & mask2); LCD_WRITE_BIT(a & mask2);
LCD_WRITE_BIT(b & mask2); LCD_WRITE_BIT(b & mask2);
LCD_WRITE_BIT(c & mask2); LCD_WRITE_BIT(c & mask2);
LCD_WRITE_BIT(d & mask2); LCD_WRITE_BIT(d & mask2);
LCD_WRITE_BIT(a & mask);
LCD_WRITE_BIT(b & mask);
LCD_WRITE_BIT(c & mask);
LCD_WRITE_BIT(d & mask);
} }
LCD_NCS_HIGH(); LCD_NCS_HIGH();
@ -254,18 +266,6 @@ static void LCD_Hardware_Init()
GPIO_Init(GPIO_LCD_RST, &GPIO_InitStructure); GPIO_Init(GPIO_LCD_RST, &GPIO_InitStructure);
} }
//275us
void Delay(volatile unsigned int ms)
{
volatile u8 i;
while(ms != 0)
{
for(i=0;i<250;i++) {}
for(i=0;i<75;i++) {}
ms--;
}
}
void LCD_OFF() void LCD_OFF()
{ {
AspiCmd(0xE2); AspiCmd(0xE2);