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/TFT.cpp
- Revision:
- 5:b222a9461d6b
- Parent:
- 4:12ba0ecc2c1f
- Child:
- 7:bb0383b91104
--- a/Display/TFT.cpp Sun Feb 15 20:06:07 2015 +0000 +++ b/Display/TFT.cpp Mon Feb 16 00:52:24 2015 +0000 @@ -83,6 +83,14 @@ { proto->wr_grambuf(data, lenght); } +unsigned int TFT::rd_data32_wdummy() + { + return proto->rd_data32_wdummy(); + } +unsigned short TFT::rd_gram() + { + return (proto->rd_gram()); + } //for TFT, just send data, position counters are in hw void TFT::window_pushpixel(unsigned short color) { @@ -141,7 +149,6 @@ { //ili9486 does not like truncated 2A/2B cmds, at least in par mode //setting only start column/page would speedup, but needs a windowmax() before, maybe implement later - //fixme for PAR_16: // cmd 2A/2B expects 8bit parameters wr_cmd8(0x2A); wr_data16(x); //start column wr_data16(x+w-1);//end column @@ -152,12 +159,33 @@ wr_cmd8(0x2C); //write mem, just send pixels color next } +void TFT::window4read(int x, int y, int w, int h) +{ + wr_cmd8(0x2A); + wr_data16(x); //start column + wr_data16(x+w-1);//end column + + wr_cmd8(0x2B); + wr_data16(y); //start page + wr_data16(y+h-1);//end page + + wr_cmd8(0x2E); //read mem, just pixelread next +} void TFT::pixel(int x, int y, unsigned short color) { window(x,y,1,1); // proto->wr_gram(color); // 2C expects 16bit parameters wr_gram(color); } +unsigned short TFT::pixelread(int x, int y) +{ + unsigned short color; + window4read(x,y,1,1); + // proto->wr_gram(color); // 2C expects 16bit parameters + color = rd_gram(); + if(mipistd) color = BGR2RGB(color); // in case, convert BGR to RGB (should depend on cmd36 bit3) but maybe is device specific + return color; +} void TFT::cls (void) { WindowMax();