Simple library for UC1701 based GLCD's

Dependents:   Opensmart_LCD_UC1701

With lots of fonts! Will include more in the future. A couple bitmaps have also been added.

Revision:
3:baaa16e24adc
Parent:
1:f396898c2963
Child:
4:8da4c691643a
--- a/UC1701.cpp	Sun Dec 18 21:17:42 2016 +0000
+++ b/UC1701.cpp	Mon Dec 19 12:58:10 2016 +0000
@@ -36,22 +36,32 @@
     _lcd->write(0x2E);              // Voltage regulator on
     _lcd->write(0x2F);              // Voltage follower on
     _lcd->write(0xF8);              // Set booster ratio
-    _lcd->write(0x00);              // to 4
+    _lcd->write(0x00);              
     _lcd->write(0x23);              // Set resistor ratio
-    _lcd->write(0x81);              // to 3
-    _lcd->write(0x28);              // Set Electronic volume to 40
-    _lcd->write(0xEE);              // Set cursor update ON -> after write, column cursor will be updated (rows will not!)
+    _lcd->write(0x81);              // Set contrast to
+    _lcd->write(0x28);              // 40
+    _lcd->write(0xEE);              // Set cursor update -> after write, column cursor will be updated (rows will not!)
     _lcd->write(0xAC);              // Disable static indicator
     _lcd->write(0x00);
     _lcd->write(0xA6);              // Disable inverse
     _lcd->write(0xAF);              // Display enable
-    //_lcd->write(0xA5);              // display all points
+    //_lcd->write(0xA5);            // display all points
     _lcd->write(0xA4);              // clear
-    _lcd_cs->write(1);                  // disable SPI
-    _lcd_cd->write(1);                  // DATA mode
+    _lcd_cs->write(1);              // disable SPI
+    _lcd_cd->write(1);              // DATA mode
 
 }
 
+void UC1701::setContrast(char contrast)
+{
+    _lcd_cs->write(0);              // enable SPI
+    _lcd_cd->write(0);              // command mode
+    _lcd->write(0x81);              // command to set contrast
+    _lcd->write(contrast);          // set contrast
+    _lcd_cs->write(1);
+    _lcd_cd->write(1);
+    }
+
 void UC1701::setCursor(char column, char line)
 {
     int i, j;