UniGraphic-Fork for ST7920-LCD-controller and SH1106. Tested with 128x64 LCD with SPI and 128x64-OLED with IIC
Dependents: UniGraphic-St7920-Test AfficheurUTILECO
Fork of UniGraphic by
Fork of the UniGraphic-Library for monochrome LCDs with ST7920 controller and 128x64-IIC-OLED-Display with SH1106-Controller
Had to adapt LCD for following reasons:
- Give access to screenbuffer buffer[] to parent class
- pixel() and pixel_read() as they are hardware-dependent
- added reset-pin to IIC-Interface
GraphicDisplay:: sends buffer to LCD when auto_update is set to true.
Testprogram for ST7920 can be found here:
https://developer.mbed.org/users/charly/code/UniGraphic-St7920-Test/
Diff: Display/TFT932x.cpp
- Revision:
- 30:87855d03d91a
- Parent:
- 27:acb2594b8aa4
--- a/Display/TFT932x.cpp Sat Nov 28 18:37:19 2015 +0000 +++ b/Display/TFT932x.cpp Sun Nov 29 19:58:47 2015 +0000 @@ -37,6 +37,7 @@ fastwindowready=false; is18bit=false; isBGR=false; + flipped=0; // cls(); // locate(0,0); } @@ -66,6 +67,7 @@ fastwindowready=false; is18bit=false; isBGR=false; + flipped=0; // cls(); // locate(0,0); } @@ -90,6 +92,7 @@ fastwindowready=false; is18bit=false; isBGR=false; + flipped=0; // locate(0,0); } // dummy read needed before read gram @@ -161,29 +164,29 @@ // ORG bit set for all modes { case 0:// default, portrait view 0° - reg_write(0x0001,0x0100); // S720 to S1 - reg_write(0x0060,0xA700); // G320 to G1 + reg_write(0x0001,((flipped&FLIP_X)==0) ? 0x0100:0x0000); // S720toS1 or S1toS720 + reg_write(0x0060,((flipped&FLIP_Y)==0) ? 0xA700:0x2700); // G320toG1 or G1toG320 reg_write(0x03, 0x10B0); set_width(screensize_X); set_height(screensize_Y); break; case 1:// landscape view +90° - reg_write(0x0001,0x0000); // S1 to S720 - reg_write(0x0060,0xA700); // G320 to G1 + reg_write(0x0001,((flipped&FLIP_X)==0) ? 0x0000:0x0100); // S1toS720 or S720toS1 + reg_write(0x0060,((flipped&FLIP_Y)==0) ? 0xA700:0x2700); // G320toG1 or G1toG320 reg_write(0x03, 0x10B8); // AM=1 increase addr ctr first vertically then horizontally set_width(screensize_Y); set_height(screensize_X); break; case 2:// portrait view +180° - reg_write(0x0001,0x0000); // S1 to S720 - reg_write(0x0060,0x2700); // G1 to G320 + reg_write(0x0001,((flipped&FLIP_X)==0) ? 0x0000:0x0100); // S1toS720 or S720toS1 + reg_write(0x0060,((flipped&FLIP_Y)==0) ? 0x2700:0xA700); // G1toG320 or G320toG1 reg_write(0x03, 0x10B0); set_width(screensize_X); set_height(screensize_Y); break; case 3:// landscape view -90° - reg_write(0x0001,0x0100); // S720 to S1 - reg_write(0x0060,0x2700); // G1 to G320 + reg_write(0x0001,((flipped&FLIP_X)==0) ? 0x0100:0x0000); // S720toS1 or S1toS720 + reg_write(0x0060,((flipped&FLIP_Y)==0) ? 0x2700:0xA700); // G1toG320 or G320toG1 reg_write(0x03, 0x10B8); // AM=1 increase addr ctr first vertically then horizontally set_width(screensize_Y); set_height(screensize_X);