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: Graphics/GraphicsDisplay.cpp
- Revision:
- 8:26757296c79d
- Parent:
- 4:12ba0ecc2c1f
- Child:
- 16:244f9563ebc1
diff -r bb0383b91104 -r 26757296c79d Graphics/GraphicsDisplay.cpp --- a/Graphics/GraphicsDisplay.cpp Tue Feb 17 11:02:06 2015 +0000 +++ b/Graphics/GraphicsDisplay.cpp Tue Feb 17 17:54:14 2015 +0000 @@ -25,7 +25,7 @@ #include "GraphicsDisplay.h" #define SWAP(a, b) { a ^= b; b ^= a; a ^= b; } GraphicsDisplay::GraphicsDisplay(const char *name):TextDisplay(name) { - set_font((unsigned char*)Terminal6x8); + set_font((unsigned char*)Terminal6x8,32,127,true); // foreground(0xFFFF); // background(0x0000); char_x = 0; @@ -299,8 +299,12 @@ } } } - if(fontprop) char_x += w; - else char_x += fonthor; + if(fontprop) + { + if((w+1)<fonthor) char_x += w+1; // put at least 1 blank after variable-width characters, except characters that occupy whole fonthor space like "_" + else char_x += fonthor; + } + else char_x += fonthor; // fixed width } void GraphicsDisplay::Bitmap_BW(Bitmap_s bm, int x, int y) {