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/LCD.h
- Revision:
- 7:bb0383b91104
- Parent:
- 4:12ba0ecc2c1f
- Child:
- 10:668cf78ff93a
diff -r 8356d48a07db -r bb0383b91104 Display/LCD.h --- a/Display/LCD.h Mon Feb 16 01:18:29 2015 +0000 +++ b/Display/LCD.h Tue Feb 17 11:02:06 2015 +0000 @@ -53,9 +53,6 @@ */ virtual void pixel(int x, int y, unsigned short color); - - - /** Set the window, which controls where items are written to the screen. * When something hits the window width, it wraps back to the left side * and down a row. If the initial write is outside the window, it will @@ -66,6 +63,8 @@ * @param h is the window height in pixels. */ virtual void window(int x, int y, int w, int h); + + /** Push a single pixel into the window and increment position. * You must first call window() then push pixels in loop. @@ -102,7 +101,7 @@ */ int get_contrast(void); - /** invert the screen + /** display inverted colors * * @param o = 0 normal, 1 invert */ @@ -114,10 +113,6 @@ */ virtual void cls(); - - - - /** Set the orientation of the screen * x,y: 0,0 is always top left * @@ -135,6 +130,29 @@ */ virtual void BusEnable(bool enable); + /** get display X size in pixels (native, orientation independent) + * @returns X size in pixels + */ + int sizeX(); + + /** get display X size in pixels (native, orientation independent) + * @returns screen height in pixels. + */ + int sizeY(); + +//////////////////////////////////////////////////////////////////////////////// + // not implemented yet +////////////////////////////////////////////////////////////////// + virtual unsigned short pixelread(int x, int y){return 0;}; + virtual void window4read(int x, int y, int w, int h){}; + void setscrollarea (int startY, int areasize){}; + void scroll (int lines){}; + void scrollreset(){}; + + unsigned int tftID; + + + protected: @@ -196,12 +214,12 @@ Protocols* proto; unsigned char *buffer; unsigned short *buffer16; - const int LCDSIZE_X; - const int LCDSIZE_Y; - const int LCDPAGES; - const int IC_X_SEGS; - const int IC_Y_COMS; - const int IC_PAGES; + const int screensize_X; + const int screensize_Y; + const int _LCDPAGES; + const int _IC_X_SEGS; + const int _IC_Y_COMS; + const int _IC_PAGES; int page_offset; int col_offset;