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:
Geremia
Date:
Sun Feb 22 16:13:11 2015 +0000
Parent:
12:9c8f3076347c
Child:
14:29bab588ba75
Commit message:
multibyte cmds workaround for compatibility with actual SPI_16 NOP trick (see LCD class wr_cmd8)

Changed in this revision

Inits/SSD1306.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Inits/SSD1306.cpp	Sun Feb 22 00:05:34 2015 +0000
+++ b/Inits/SSD1306.cpp	Sun Feb 22 16:13:11 2015 +0000
@@ -64,38 +64,38 @@
   //  wr_cmd8(0xE2);   //  sw reset
     wait_ms(15);
     
-    wr_cmd8(SSD1306_DISPLAYOFF);   
-    wr_cmd8(SSD1306_SETDISPLAYCLOCKDIV);   
-    wr_cmd8(0x80); 
-    wr_cmd8(SSD1306_SETMULTIPLEX);
-    wr_cmd8(63);
+    wr_cmd8(SSD1306_DISPLAYOFF);    // no problem in SPI_16 for single byte cmds
+    wr_cmd16((SSD1306_SETDISPLAYCLOCKDIV<<8)|0x80);   // wr_cmd16 for multibyte cmds issue in SPI16 mode
+  //  wr_cmd8(0x80); // in SPI_16 it would become 0xE380 and will break things up
+    wr_cmd16((SSD1306_SETMULTIPLEX<<8)|63);
+ //   wr_cmd8(63);
     
-    wr_cmd8(SSD1306_SETDISPLAYOFFSET);
-    wr_cmd8(0x0);
+    wr_cmd16((SSD1306_SETDISPLAYOFFSET<<8)|0x00);
+ //   wr_cmd8(0x0);
     
     wr_cmd8(SSD1306_SETSTARTLINE | 0x0);            // line #0
 
-    wr_cmd8(SSD1306_CHARGEPUMP);
-    wr_cmd8(0x14);                         // 0x10 
+    wr_cmd16((SSD1306_CHARGEPUMP<<8)|0x14);
+  //  wr_cmd8(0x14);                         // 0x10 
 
-    wr_cmd8(SSD1306_MEMORYMODE);
-    wr_cmd8(0x00);                                  // 0x0 act like ks0108
+    wr_cmd16((SSD1306_MEMORYMODE<<8)|0x00);
+ //   wr_cmd8(0x00);                                  // 0x0 act like ks0108
 
     wr_cmd8(SSD1306_SEGREMAP ); //| 0x1);
 
     wr_cmd8(SSD1306_COMSCANDEC);
 
-    wr_cmd8(SSD1306_SETCOMPINS);
-    wr_cmd8(0x12);                           //        LCDSIZE_Y == 32 ? 0x02 : 0x12);        
+    wr_cmd16((SSD1306_SETCOMPINS<<8)|0x12);
+  //  wr_cmd8(0x12);                           //        LCDSIZE_Y == 32 ? 0x02 : 0x12);        
 
-    wr_cmd8(SSD1306_SETCONTRAST);
-    wr_cmd8(0xCF);                              //  _rawHeight == 32 ? 0x8F : ((vccstate == SSD1306_EXTERNALVCC) ? 0x9F : 0xCF) );
+    wr_cmd16((SSD1306_SETCONTRAST<<8)|0xCF);
+ //   wr_cmd8(0xCF);                              //  _rawHeight == 32 ? 0x8F : ((vccstate == SSD1306_EXTERNALVCC) ? 0x9F : 0xCF) );
 
-    wr_cmd8(SSD1306_SETPRECHARGE);
-    wr_cmd8(0xF1);                               // : 0x22);
+    wr_cmd16((SSD1306_SETPRECHARGE<<8)|0xF1);
+ //   wr_cmd8(0xF1);                               // : 0x22);
 
-    wr_cmd8(SSD1306_SETVCOMDETECT);
-    wr_cmd8(0x40);
+    wr_cmd16((SSD1306_SETVCOMDETECT<<8)|0x40);
+ //   wr_cmd8(0x40);
 
     wr_cmd8(SSD1306_DISPLAYALLON_RESUME);