ADAFRUIT GP9002 VFD Driver supporting grayscale display, requires GFX-Library Note no "invert" function, also fixed timing issue in "begin"

Dependencies:   bitreversetable256

Dependents:   GP9002af_gray

Fork of Adafruit-GP9002-Graphic-VFD-Library by Oliver Broad

Files at this revision

API Documentation at this revision

Comitter:
oliverb
Date:
Sun May 15 07:13:29 2016 +0000
Parent:
3:0a38cff87d2e
Commit message:
Improved byte cache, now needs only one SPI data write for a hit.

Changed in this revision

Adafruit_GP9002.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0a38cff87d2e -r dc3e19dfd45d Adafruit_GP9002.cpp
--- a/Adafruit_GP9002.cpp	Mon May 09 09:29:03 2016 +0000
+++ b/Adafruit_GP9002.cpp	Sun May 15 07:13:29 2016 +0000
@@ -84,7 +84,7 @@
 
   // hold the address so we can read and then write
   command(GP9002_ADDRHELD);
-  addrcache=0; //known because we just set the address
+  addrcache=-1; //address OK but cmd not set
   bytecache=0; //known because display cleared
 }
 
@@ -165,6 +165,7 @@
     command(GP9002_DATAREAD);
     dataRead();
     bytecache = dataRead();
+    command(GP9002_DATAWRITE); //warning: subsequent drawpixel ops will assume this
   }
   y=0xc0>>((y & 3) <<1);
   color*=0b01010101;
@@ -173,7 +174,6 @@
 
   bytecache |= color&y;
   
-  command(GP9002_DATAWRITE);
   dataWrite(bytecache);
 }
 
@@ -325,13 +325,16 @@
   command(GP9002_CLEARSCREEN);
 
   wait_us(500);
+  addrcache=-1; //address OK but cmd not set
 }
 
 void Adafruit_GP9002::displayOff(void) {
   command(GP9002_DISPLAYSOFF); 
+  addrcache=-1; //address OK but cmd not set
 }
 void Adafruit_GP9002::displayOn(void) {
    command(GP9002_DISPLAY1ON);
+  addrcache=-1; //address OK but cmd not set
 }