Almin Halilović Grupa 2 Elmir Hodžić

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim003
Date:
Mon May 05 18:06:08 2014 +0000
Commit message:
LV8_Grupa4_Tim008_Zadatak3

Changed in this revision

N5110.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 28b09b3bae67 N5110.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Mon May 05 18:06:08 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r 28b09b3bae67 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 05 18:06:08 2014 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+#include "N5110.h"
+
+
+Serial pc(USBTX, USBRX);
+N5110 lcd(dp4, dp24, dp23, dp25, dp2, dp6, dp18);
+
+int X = 0;
+int Y = 0;
+
+void bckspc()
+{
+    if(X == 0 && Y == 0) return;
+
+    if(X == 0)
+    {
+        Y -= 1;
+        X = 84;
+    }
+
+    X -= 6;
+    lcd.setXYAddress(X, Y);
+    lcd.printChar(' ');
+    lcd.setXYAddress(X, Y);
+}
+
+void CLS()
+{
+    lcd.clear();
+    lcd.refresh();
+    X = Y = 0;
+    lcd.setXYAddress(X, Y);
+}
+
+void enter()
+{
+    if(Y == 5) Y = 0;
+    else Y ++;
+    X = 0;
+    lcd.setXYAddress(X, Y);
+}
+
+void karakter(char c)
+{
+    lcd.printChar(c);
+    X += 6;
+    if(X == 84)
+    {
+        Y++;
+        if(Y == 6) Y = 0;
+        X = 0;
+    }
+}
+
+int main()
+{
+    lcd.init();
+    lcd.normalMode();
+    lcd.setXYAddress(X,Y);
+
+    while(1)
+    {
+        char c = pc.getc();
+        if(c == '1') bckspc();
+        else if(c == '2') CLS();
+        else if(c == '3') enter();
+        else karakter(c);
+    }
+
+}
diff -r 000000000000 -r 28b09b3bae67 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 05 18:06:08 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file