for TFT2P0327 aitendo.com 128*160 TFT LCD. LCD driver is S6D0151 Sumsung.
Dependents: FRDM_tocos_x2_FIXED
Diff: S6D0151_TFT.cpp
- Revision:
- 5:18920a7a693e
- Parent:
- 4:648a364412e4
diff -r 648a364412e4 -r 18920a7a693e S6D0151_TFT.cpp --- a/S6D0151_TFT.cpp Sun Oct 02 13:03:41 2016 +0000 +++ b/S6D0151_TFT.cpp Sun Oct 02 13:20:50 2016 +0000 @@ -71,9 +71,20 @@ regwr( 0x0021 , addr ); } +void S6D0151_TFT::reverse(int rev){ + if(rev == TFT_REVERSE_ON){ + regwr(0x0007,0x0033); //DISPLAY CONTROL (R07h) + } else { + regwr(0x0007,0x0037); //DISPLAY CONTROL (R07h) + } + // X X X PT1 PT0 X X SPT X X GON DTE CL REV D1 D0 + //GON=1,DTE=1 VGH/VGL Normal operation + //Rev bit mean Color reverse. + //REV=1 Displays all character and graphics display sections with Reverse + //D[1:0]=11 Display is RAM data +} /** -* */ void S6D0151_TFT::regwr(unsigned short reg,unsigned short dat){ int data; @@ -183,7 +194,6 @@ //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. @@ -652,7 +662,7 @@ wr_dat_start(); for (int p=0; p<pixel; p++) { _spi.write(color >> 8); - _spi.write(color); + _spi.write(color & 0xFF); } wr_dat_stop(); return;