tim008 tim008
/
pripremaLV8Z03
Sumejja Porca
Revision 0:6e6e952bc572, committed 2014-05-08
- Comitter:
- tim008
- Date:
- Thu May 08 13:57:40 2014 +0000
- Commit message:
- pripremaZ03
Changed in this revision
diff -r 000000000000 -r 6e6e952bc572 N5110.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/N5110.lib Thu May 08 13:57:40 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r 6e6e952bc572 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 08 13:57:40 2014 +0000 @@ -0,0 +1,87 @@ +#include "mbed.h" +#include "N5110.h" + +Serial pc (USBTX, USBRX); +//Deklaracija LCD objekta +//N5110 lcd(VCC,SCE,RST,D/C,MOSI,SCLK,LED) +N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18); + + int x(0), y(0); + +void deleteAll() +{ + lcd.clear(); + lcd.refresh(); + x = y = 0; +} + +void deleteLetter() +{ + if(x == 0 && y == 0) + { + x = 84; + y = 47; + return; + } + + if(x == 0) + { + y = y - 1; + x = 84; + return; + } + + for(int i = x - 1; i >= x - 6; i--) + { + lcd.clearPixel(i,y); + } + + lcd.refresh(); + x = x - 6; +} + +void newLine() +{ + if(y == 47) y = 0; + else y = y + 1; + + x = 0; +} + +void getChar() +{ + if(pc.readable()) + { + char c = pc.getc(); + // if (c == backspace) + deleteLetter(); + // else if (c == del) + deleteAll(); + // else if (c == enter) + newLine(); + // else + { + lcd.printChar(c); + + x += 6; + + if(x == 84 && y != 5) + { + x = 0; + y++; + } + } + lcd.setXYAddress(x,y); + } +} + +int main() { + // initialise display + lcd.init(); + lcd.normalMode(); + + lcd.setXYAddress(0,0); + pc.attach(&getChar); + while(1); + +}
diff -r 000000000000 -r 6e6e952bc572 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 08 13:57:40 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file