Fix a bug in Contrast handling in the Nokia drivers
This commit is contained in:
parent
0698fd28c0
commit
1b3297aeae
2 changed files with 4 additions and 4 deletions
|
@ -115,7 +115,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
write_index(g, SLEEPOUT); // Sleep out
|
||||
write_reg(g, COLMOD, 0x03); // Color Interface Pixel Format - 0x03 = 12 bits-per-pixel
|
||||
write_reg(g, MADCTL, 0x00); // Memory access controller
|
||||
write_reg(g, SETCON, 127*GDISP_INITIAL_CONTRAST/100-64); // Write contrast
|
||||
write_reg(g, SETCON, 128*GDISP_INITIAL_CONTRAST/101-64); // Write contrast
|
||||
delayms(20);
|
||||
|
||||
// Finish Init
|
||||
|
@ -248,7 +248,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
case GDISP_CONTROL_CONTRAST:
|
||||
if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
|
||||
acquire_bus(g);
|
||||
write_reg(g, CONTRAST,(unsigned)127*g->p.ptr/100-64);
|
||||
write_reg(g, CONTRAST,(unsigned)128*g->p.ptr/101-64);
|
||||
release_bus(g);
|
||||
g->g.Contrast = (unsigned)g->p.ptr;
|
||||
return;
|
||||
|
|
|
@ -199,7 +199,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
// P1: 0x00 = page address normal, column address normal, address scan in column direction
|
||||
// P2: 0x00 = RGB sequence (default value)
|
||||
// P3: 0x02 = 4 bits per colour (Type A)
|
||||
write_cmd2(g, VOLCTR, 63*GDISP_INITIAL_CONTRAST/100, 0x03); // Voltage control (contrast setting)
|
||||
write_cmd2(g, VOLCTR, 64*GDISP_INITIAL_CONTRAST/101, 0x03); // Voltage control (contrast setting)
|
||||
// P1 = Contrast (0..63)
|
||||
// P2 = 3 resistance ratio (only value that works)
|
||||
delayms(100); // Allow power supply to stabilise
|
||||
|
@ -543,7 +543,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
case GDISP_CONTROL_CONTRAST:
|
||||
if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
|
||||
acquire_bus(g);
|
||||
write_cmd2(g, VOLCTR, 63*(unsigned)g->p.ptr/100, 0x03);
|
||||
write_cmd2(g, VOLCTR, 64*(unsigned)g->p.ptr/101, 0x03);
|
||||
release_bus(g);
|
||||
g->g.Contrast = (unsigned)g->p.ptr;
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue