From cec773f49f8fdae0ea9c36b519a6b97555d53bcc Mon Sep 17 00:00:00 2001 From: prenticedavid Date: Sun, 15 Apr 2018 11:13:28 +0100 Subject: [PATCH 1/4] S6D0139 disable scroll --- MCUFRIEND_kbv.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/MCUFRIEND_kbv.cpp b/MCUFRIEND_kbv.cpp index dcfa50a..5b59496 100644 --- a/MCUFRIEND_kbv.cpp +++ b/MCUFRIEND_kbv.cpp @@ -1,4 +1,4 @@ -//#define SUPPORT_0139 //not working +238 bytes +#define SUPPORT_0139 //not working +238 bytes #define SUPPORT_0154 //S6D0154 +320 bytes //#define SUPPORT_1289 //costs about 408 bytes //#define SUPPORT_1580 //R61580 Untested @@ -427,7 +427,7 @@ void MCUFRIEND_kbv::setRotation(uint8_t r) _MC = 0x20, _MP = 0x21, _MW = 0x22; GS = (val & 0x80) ? (1 << 9) : 0; SS_v = (val & 0x40) ? (1 << 8) : 0; - WriteCmdData(0x01, GS | SS_v | 0x0028); // set Driver Output Control + WriteCmdData(0x01, GS | SS_v | (_lcd_ID == 0x0139 ? 0x27 : 0x28)); // set Driver Output Control goto common_ORG; #endif case 0x5420: @@ -713,11 +713,13 @@ void MCUFRIEND_kbv::vertScroll(int16_t top, int16_t scrollines, int16_t offset) WriteCmdData(0x61, _lcd_rev); //!NDL, !VLE, REV WriteCmdData(0x6A, vsp); //VL# break; -#ifdef SUPPORT_0139 +#ifdef SUPPORT_0139 case 0x0139: - WriteCmdData(0x41, sea); //SEA - WriteCmdData(0x42, top); //SSA - WriteCmdData(0x43, vsp - top); //SST +#if 0 //disable scroll + WriteCmdData(0x42, sea); //SEA + WriteCmdData(0x43, top); //SSA + WriteCmdData(0x41, vsp - top); //VL# check vsp +#endif break; #endif #if defined(SUPPORT_0154) || defined(SUPPORT_9225) //thanks tongbajiel @@ -913,9 +915,10 @@ void MCUFRIEND_kbv::begin(uint16_t ID) 0x000c, 0x0000, //Interface Control: system i/f 0x0040, 0x0000, //Scan Line 0x0041, 0x0000, //Vertical Scroll Control - 0x0007, 0x0014, //Display Control: SPT=1, REV=1 - 0x0007, 0x0016, //Display Control: SPT=1, REV=1, display on - 0x0007, 0x0017, //Display Control: SPT=1, REV=1, display on, GON + 0x0007, 0x0014, //Display Control: VLE1=0, SPT=0, GON=1, REV=1, D=0 (halt) + 0x0007, 0x0016, //Display Control: VLE1=0, SPT=0, GON=1, REV=1, D=2 (blank) + 0x0007, 0x0017, //Display Control: VLE1=0, SPT=0, GON=1, REV=1, D=3 (normal) +// 0x0007, 0x0217, //Display Control: VLE1=1, SPT=0, GON=1, REV=1, D=3 }; init_table16(S6D0139_regValues, sizeof(S6D0139_regValues)); break; From 77cc299e2717420a1ae038e8e990318a0f3e04e9 Mon Sep 17 00:00:00 2001 From: prenticedavid Date: Wed, 18 Apr 2018 23:36:08 +0100 Subject: [PATCH 2/4] remove AUTO_READINC, vert scroll VL --- MCUFRIEND_kbv.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MCUFRIEND_kbv.cpp b/MCUFRIEND_kbv.cpp index 5b59496..7c621d2 100644 --- a/MCUFRIEND_kbv.cpp +++ b/MCUFRIEND_kbv.cpp @@ -427,7 +427,7 @@ void MCUFRIEND_kbv::setRotation(uint8_t r) _MC = 0x20, _MP = 0x21, _MW = 0x22; GS = (val & 0x80) ? (1 << 9) : 0; SS_v = (val & 0x40) ? (1 << 8) : 0; - WriteCmdData(0x01, GS | SS_v | (_lcd_ID == 0x0139 ? 0x27 : 0x28)); // set Driver Output Control + WriteCmdData(0x01, GS | SS_v | 0x0028); // set Driver Output Control goto common_ORG; #endif case 0x5420: @@ -715,11 +715,7 @@ void MCUFRIEND_kbv::vertScroll(int16_t top, int16_t scrollines, int16_t offset) break; #ifdef SUPPORT_0139 case 0x0139: -#if 0 //disable scroll - WriteCmdData(0x42, sea); //SEA - WriteCmdData(0x43, top); //SSA - WriteCmdData(0x41, vsp - top); //VL# check vsp -#endif + WriteCmdData(0x41, vsp); //VL# check vsp break; #endif #if defined(SUPPORT_0154) || defined(SUPPORT_9225) //thanks tongbajiel @@ -894,7 +890,7 @@ void MCUFRIEND_kbv::begin(uint16_t ID) */ #ifdef SUPPORT_0139 case 0x0139: - _lcd_capable = AUTO_READINC | REV_SCREEN | XSA_XEA_16BIT; + _lcd_capable = REV_SCREEN | XSA_XEA_16BIT; //remove AUTO_READINC static const uint16_t S6D0139_regValues[] PROGMEM = { 0x0000, 0x0001, //Start oscillator 0x0011, 0x1a00, //Power Control 2 @@ -909,7 +905,7 @@ void MCUFRIEND_kbv::begin(uint16_t ID) 0x0002, 0x0100, //LCD Control: (.kbv was 0700) FLD=0, BC= 0, EOR=1 0x0003, 0x1030, //Entry Mode: TR1=0, DFM=0, BGR=1, I_D=3 0x0007, 0x0000, //Display Control: everything off - 0x0008, 0x0808, //Blank Period: FP=98, BP=8 + 0x0008, 0x0303, //Blank Period: FP=3, BP=3 0x0009, 0x0000, //f.k. 0x000b, 0x0000, //Frame Control: 0x000c, 0x0000, //Interface Control: system i/f From 922af5c09ef0ff3ad2affeedc0bd310f157e0fe8 Mon Sep 17 00:00:00 2001 From: prenticedavid Date: Sat, 21 Apr 2018 09:38:23 +0100 Subject: [PATCH 3/4] whole screen scroll. set VLE1 before VL. --- MCUFRIEND_kbv.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/MCUFRIEND_kbv.cpp b/MCUFRIEND_kbv.cpp index 7c621d2..bd9d827 100644 --- a/MCUFRIEND_kbv.cpp +++ b/MCUFRIEND_kbv.cpp @@ -715,6 +715,7 @@ void MCUFRIEND_kbv::vertScroll(int16_t top, int16_t scrollines, int16_t offset) break; #ifdef SUPPORT_0139 case 0x0139: + WriteCmdData(0x07, 0x0213 | (_lcd_rev << 2)); //VLE1=1, GON=1, REV=x, D=3 WriteCmdData(0x41, vsp); //VL# check vsp break; #endif From dc30e2ac6322f72d693744c8f1eb37ce05d40f69 Mon Sep 17 00:00:00 2001 From: prenticedavid Date: Sat, 21 Apr 2018 16:30:19 +0100 Subject: [PATCH 4/4] NL must be correct for vertical scroll --- MCUFRIEND_kbv.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MCUFRIEND_kbv.cpp b/MCUFRIEND_kbv.cpp index bd9d827..5d65909 100644 --- a/MCUFRIEND_kbv.cpp +++ b/MCUFRIEND_kbv.cpp @@ -427,7 +427,8 @@ void MCUFRIEND_kbv::setRotation(uint8_t r) _MC = 0x20, _MP = 0x21, _MW = 0x22; GS = (val & 0x80) ? (1 << 9) : 0; SS_v = (val & 0x40) ? (1 << 8) : 0; - WriteCmdData(0x01, GS | SS_v | 0x0028); // set Driver Output Control + // S6D0139 requires NL = 0x27, S6D0154 NL = 0x28 + WriteCmdData(0x01, GS | SS_v | ((_lcd_ID == 0x0139) ? 0x27 : 0x28)); goto common_ORG; #endif case 0x5420: