Haris Spahic Ensar Muratovic

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim003
Date:
Thu May 08 15:51:04 2014 +0000
Commit message:
LV8-Grupa6-Tim003-Zad3

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Thu May 08 15:51:04 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 08 15:51:04 2014 +0000
@@ -0,0 +1,71 @@
+#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.inverseMode();
+    lcd.setXYAddress(0,0);
+ 
+    while(1)
+    {
+        char c = pc.getc();
+        if(c == '1') bckspc();
+        else if(c == '2') CLS();
+        else if(c == '3') enter();
+        else karakter(c);
+    }
+ 
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 08 15:51:04 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file