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 GraphicsDisplay

Fork of the UniGraphic-Library for monochrome LCDs with ST7920 controller and 128x64-IIC-OLED-Display with SH1106-Controller

/media/uploads/charly/20170522_210344.jpg

/media/uploads/charly/20180425_230623.jpg

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/

Files at this revision

API Documentation at this revision

Comitter:
dreschpe
Date:
Mon May 02 22:44:05 2016 +0000
Parent:
31:ef4225cef157
Child:
33:f87f06292637
Commit message:
If char is not in font, print blank.; Useful if you have a number only font and want to format output.

Changed in this revision

Graphics/GraphicsDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Graphics/GraphicsDisplay.cpp	Fri Apr 01 06:00:02 2016 +0000
+++ b/Graphics/GraphicsDisplay.cpp	Mon May 02 22:44:05 2016 +0000
@@ -275,8 +275,6 @@
     unsigned char* zeichen;
     unsigned char z,w,v;
 
-    if ((c < firstch) || (c > lastch)) return;   // test char range
-
  /*   // read font parameter from start of array
     offset = font[0];                    // bytes / char
     hor = font[1];                       // get hor size of font
@@ -291,23 +289,30 @@
         }
     }
     window(char_x, char_y,fonthor*fontzoomhor,fontvert*fontzoomver); // char box
-    zeichen = &font[((c-firstch) * fontoffset) + 4]; // start of char bitmap
-    w = zeichen[0];                          // width of actual char
-    // construct the char into the buffer
-    for (j=0; j<fontvert; j++) {  //  vert line
-        for (v=0; v<fontzoomver; v++) { // repeat horiz line for vertical zooming
-        for (i=0; i<fonthor; i++) {   //  horz line
-            z =  zeichen[(fontbpl * i) + ((j & 0xF8) >> 3)+1];
-            b = 1 << (j & 0x07);
-            if (( z & b ) == 0x00) {
-             //   pixel(char_x+i,char_y+j,0);
-                window_pushpixel(_background, fontzoomhor); //(color, howmany)
-            } else {
-            //    pixel(char_x+i,char_y+j,1);
-                window_pushpixel(_foreground, fontzoomhor);
-            }
-        }
-        } //for each zoomed vert
+    if ((c < firstch) || (c > lastch)) {   // test char range - if not exist fill with blank
+         for (i = 0; i < fonthor*fontvert*fontzoomver;i++){
+          window_pushpixel(_background, fontzoomhor); //(color, howmany) 
+          }
+    }
+    else{
+        zeichen = &font[((c-firstch) * fontoffset) + 4]; // start of char bitmap
+        w = zeichen[0];                          // width of actual char
+        // construct the char into the buffer
+        for (j=0; j<fontvert; j++) {  //  vert line
+            for (v=0; v<fontzoomver; v++) { // repeat horiz line for vertical zooming
+              for (i=0; i<fonthor; i++) {   //  horz line
+                z =  zeichen[(fontbpl * i) + ((j & 0xF8) >> 3)+1];
+                b = 1 << (j & 0x07);
+                if (( z & b ) == 0x00) {
+                //   pixel(char_x+i,char_y+j,0);
+                    window_pushpixel(_background, fontzoomhor); //(color, howmany)
+                } else {
+                //    pixel(char_x+i,char_y+j,1);
+                    window_pushpixel(_foreground, fontzoomhor);
+                }
+              }
+            } //for each zoomed vert
+         }
     }
     if(fontprop)
     {