Liam Faruq
/
MAX7456_2
Revision 5:3f3006b4b29b, committed 2010-09-01
- Comitter:
- faruq
- Date:
- Wed Sep 01 15:04:45 2010 +0000
- Parent:
- 4:804abcb28b86
- Commit message:
Changed in this revision
diff -r 804abcb28b86 -r 3f3006b4b29b MAX7456.cpp --- 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;
diff -r 804abcb28b86 -r 3f3006b4b29b MAX7456.h --- a/MAX7456.h Thu Aug 26 17:04:27 2010 +0000 +++ b/MAX7456.h Wed Sep 01 15:04:45 2010 +0000 @@ -36,6 +36,7 @@ void vtrim (char way,int v); // remember to pass parametres void htrim (char way,int h); void format (char c); + void invert(int bit); void setdarkness (void); void initaddress (void); int _increment(int x, int y);
diff -r 804abcb28b86 -r 3f3006b4b29b main.cpp --- a/main.cpp Thu Aug 26 17:04:27 2010 +0000 +++ b/main.cpp Wed Sep 01 15:04:45 2010 +0000 @@ -17,27 +17,40 @@ vo.cls(); -vo.locate(30,16); +/** +vo.locate(1,1); vo.printf("Hello World"); - - - +wait(3.0); +vo.cls(); +**/ int count = 0; +vo.invert(0); for (int y = 0 ; y < 16 ; y++) { for (int x = 0 ; x < 30 ; x++) { vo.locate(x,y); count= count+1; - vo.putc(count); + vo.putc('1'); wait(0.01); printf("/%d/",count); } } -wait(5.0); -vo.locate(10,10); +wait(1.5); +vo.invert(0); +vo.locate(1,0); +vo.putc('G'); + +vo.locate(1,1); vo.putc('G'); +vo.locate(1,2); +vo.putc('G'); + +vo.locate(1,3); +vo.putc('G'); + + /* vo.locate(1,1);