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: Protocols/PAR8.cpp
- Revision:
- 7:bb0383b91104
- Parent:
- 5:b222a9461d6b
- Child:
- 11:b842b8e332cb
diff -r 8356d48a07db -r bb0383b91104 Protocols/PAR8.cpp --- a/Protocols/PAR8.cpp Mon Feb 16 01:18:29 2015 +0000 +++ b/Protocols/PAR8.cpp Tue Feb 17 11:02:06 2015 +0000 @@ -174,11 +174,42 @@ _CS = 1; #endif } -unsigned int PAR8::rd_data32_wdummy() +unsigned short PAR8::rd_gram() { #ifdef USE_CS _CS = 0; #endif + unsigned short r=0; + _DC = 1; // 1=data + _port.input(); + + _RD = 0; + _port.read(); //dummy read + _RD = 1; + + _RD = 0; +// _RD = 0; // add wait + r |= (_port.read()&0xFF); + r <<= 8; + _RD = 1; + + _RD = 0; +// _RD = 0; // add wait + r |= (_port.read()&0xFF); + _RD = 1; + +#ifdef USE_CS + _CS = 1; +#endif + _port.output(); + return r; +} +unsigned int PAR8::rd_reg_data32(unsigned char reg) +{ +#ifdef USE_CS + _CS = 0; +#endif + wr_cmd8(reg); unsigned int r=0; _DC = 1; // 1=data _port.input(); @@ -217,35 +248,10 @@ _port.output(); return r; } -unsigned short PAR8::rd_gram() +// in Par mode EXTC regs (0xB0-0xFF) can be directly read +unsigned int PAR8::rd_extcreg_data32(unsigned char reg, unsigned char SPIreadenablecmd) { -#ifdef USE_CS - _CS = 0; -#endif - unsigned short r=0; - _DC = 1; // 1=data - _port.input(); - - _RD = 0; - _port.read(); //dummy read - _RD = 1; - - _RD = 0; -// _RD = 0; // add wait - r |= (_port.read()&0xFF); - r <<= 8; - _RD = 1; - - _RD = 0; -// _RD = 0; // add wait - r |= (_port.read()&0xFF); - _RD = 1; - -#ifdef USE_CS - _CS = 1; -#endif - _port.output(); - return r; + return rd_reg_data32(reg); } void PAR8::hw_reset() {