Dependencies:   mbed

Revision:
5:3f3006b4b29b
Parent:
4:804abcb28b86
--- a/MAX7456.cpp	Thu Aug 26 17:04:27 2010 +0000
+++ b/MAX7456.cpp	Wed Sep 01 15:04:45 2010 +0000
@@ -6,7 +6,7 @@
 
 
 MAX7456::MAX7456(PinName mosi, PinName miso, PinName clk, PinName ncs, PinName nrst, const char* name)
-        : Stream(name), _spi(mosi, miso, clk), _ncs(ncs),_nrst(nrst) {
+        : Stream(name), _spi(mosi, miso, clk), _ncs(ncs),_nrst(nrst){
 
 // initialisation code here
 
@@ -57,9 +57,10 @@
    } 
 */
 
-int MAX7456::_getc() {
-   wait(5.0);
-   printf("getc function has now been called");
+int MAX7456::_getc() {    
+    int mode= _read(DMM);
+    mode|=0x01;
+    _write(DMM,mode);
    return(0);
 }
 void MAX7456::test(){
@@ -100,6 +101,11 @@
     
 
 int MAX7456::_putc(int c) {
+    int set= _read(DMM);
+    set&=0xFB;           //set bit 1 to 0 so that the DMM register can be written to
+    _write(DMM,set);  
+
+    
     if ((c >= 0x31)&&(c <= 0x39)) { //characters from 1-9
         c= c-0x30;
     } 
@@ -114,19 +120,41 @@
     }
 
     _write(DMDI,c);
+    
+    /*
+    int mode= _read(DMM);
+    mode|=0x01;        // enable auto increment mode
+    _write(DMM,mode);
+    _HYSNC=1;
+    */
     //xyincrement();
     
     /*
     int data= _read(DMDI);
     printf("DMDI shows 0x%x",data);
+    */
+    
     return(c);
-    */
+ 
 }
 
 void MAX7456::setdarkness() {
     _write(VM1,0xC7);
 }
 
+void MAX7456::invert(int bit) {
+    int data= _read(DMM);
+    if (bit == 1){
+        data|=0x08;
+        }
+    else if (bit == 0){
+        data&=0xF9;
+        }
+    _write(DMM,data);
+    }
+        
+
+
 void MAX7456::initaddress() {
     int d = _read(DMAH);
     d= d&0xFC;