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: Inits/SH1106.cpp
- Revision:
- 37:5de028b08308
- Parent:
- 36:668396f861d2
- Child:
- 38:1b6f9fc49a03
diff -r 668396f861d2 -r 5de028b08308 Inits/SH1106.cpp --- a/Inits/SH1106.cpp Sun Apr 22 21:41:24 2018 +0000 +++ b/Inits/SH1106.cpp Wed Apr 25 20:55:59 2018 +0000 @@ -1,5 +1,5 @@ /* mbed UniGraphic library - Device specific class - * SH1106 by Karl Zweimüller + * SH1106 by Karl Zweimüller, based on * SSD1306 by Copyright (c) 2015 Peter Drescher * Released under the MIT License: http://mbed.org/license/mit */ @@ -141,9 +141,10 @@ wr_cmd8(0xA4);// Disable Entire Display On (0xa4/0xa5) wr_cmd8(0xA6);// Disable Inverse Display On (0xa6/a7) - wr_cmd8(0xA1); // reverse order - //wr_cmd8(0xC0);//Set COM/Row Scan Direction - wr_cmd8(0xC8); //reverse direction + wr_cmd8(0xA0); // normal order + //wr_cmd8(0xA1); // reverse order + wr_cmd8(0xC0);//Set COM/Row Scan Direction normal + //wr_cmd8(0xC8); //reverse direction wr_cmd8(0xAF);//--turn on oled panel } @@ -155,7 +156,7 @@ { for(int page=0; page<8 /*_LCDPAGES */; page++) { - wr_cmd8(0x02); // set column low nibble + wr_cmd8(0x02); // set column low nibble My Display starts at column 2 (up to column 130 of 132) wr_cmd8(0x10); // set column hi nibble wr_cmd8(0xB0+page); // set page wr_grambuf(buffer16+(page*screensize_X>>1), screensize_X>>1); // send whole page pixels as shorts(16bit) not bytes!