driver for 8x8

Dependents:   poster8x8_ranger

Revision:
0:12e8e6371165
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/8x8.cpp	Tue Jun 14 13:33:56 2016 +0000
@@ -0,0 +1,37 @@
+#include "8x8.h"
+
+#include "smiles.h"
+
+//define 2 buses for the row and column pins
+BusOut Row(PTC11,PTC10,PTC3,PTB10,PTC0,PTE2,PTE3,PTC5);
+
+BusOut Col(PTC7,PTC6,PTB8,PTC4,PTE5,PTB9,PTE4,PTB11);
+
+// sub to write character to the 8x8 display once - has to be repeated to keep display live
+int write_8x8(int eye,int mth)
+{
+    int rw,i;
+    //write eyes
+    for(i=0; i<4; i++) {
+        rw=0;
+        rw=1<<i;
+        Row=~rw; // this inverts the row code so that only the desired row is low
+        Col=eyes[i+4*eye];
+        wait(0.002);
+
+    }//endfori
+    //write mouth
+    for(i=4; i<8; i++) {
+        rw=0;
+        rw=1<<i;
+        Row=~rw; // this inverts the row code so that only the desired row is low
+        Col=mouth[i-4+4*mth];
+        wait(0.002);
+
+    }//endfori
+
+
+
+
+    return(0);
+}