for TFT2P0327 aitendo.com 128*160 TFT LCD. LCD driver is S6D0151 Sumsung.

Dependents:   FRDM_tocos_x2_FIXED

Revision:
4:648a364412e4
Parent:
1:a3651128e297
Child:
5:18920a7a693e
--- a/S6D0151_TFT.cpp	Wed Aug 26 14:58:55 2015 +0000
+++ b/S6D0151_TFT.cpp	Sun Oct 02 13:03:41 2016 +0000
@@ -10,7 +10,7 @@
 S6D0151_TFT::S6D0151_TFT(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, const char *name)
         : _spi(mosi, miso, sclk), _cs(cs), _reset(reset),GraphicsDisplay(name) {
     tft_reset();
-    orientation = 2;
+    orientation = 0;
     char_x = 0;
 }
 
@@ -29,23 +29,26 @@
 
 void S6D0151_TFT::set_orientation(unsigned int o) {
     orientation = o;
-    /* I do NOT understand rotation methods. */
-#if 0
+    /* I can't understand rotation methods. 
+       Maybe , S6D0151 can NOT conversion row and column.
+       but i can conversion up and down.
+       orientation=0 : Normal FPC side bottom.
+       orientation=2 ; Reverse FPC side is Top.  
+    */
     switch (orientation) {
         case 0:
-            wr_reg(ST7735_MADCTL, 0x0000);
+            regwr(0x0001,0x0014);   //DRIVER OUTPUT CONTROL (R01h)
             break;
         case 1:
-            wr_reg(ST7735_MADCTL, 0x0060);
+            //wr_reg(ST7735_MADCTL, 0x0060);
             break;
         case 2:
-            wr_reg(ST7735_MADCTL, 0x00C0);
+            regwr(0x0001,0x0314);   //DRIVER OUTPUT CONTROL (R01h)
             break;
         case 3:
-            wr_reg(ST7735_MADCTL, 0x00A0);
+            //wr_reg(ST7735_MADCTL, 0x00A0);
             break;
     }
-#endif
 }
 
 void S6D0151_TFT::wr_dat_start(void) {
@@ -180,6 +183,7 @@
         //VRH[5:0]=1e=011110 VCIR_EXIN X 2.250 = 4.50V
     wait_ms(20);   
    
+//    regwr(0x0001,0x0014);   //DRIVER OUTPUT CONTROL (R01h)
     regwr(0x0001,0x0014);   //DRIVER OUTPUT CONTROL (R01h)
     // X X X DPL EPL SM GS SS X X X NL4 NL3 NL2 NL1 NL0
     // demo code was 0x0114,SS bit=1 is reverse horizontal.