Ljubuncic Orhan Odobasic Faris

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim008
Date:
Mon May 05 10:05:01 2014 +0000
Commit message:
LB8_zad1_tim009_grupa2

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 6a52cbe1aa9b N5110.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Mon May 05 10:05:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r 6a52cbe1aa9b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 05 10:05:01 2014 +0000
@@ -0,0 +1,107 @@
+#include "mbed.h"
+#include "N5110.h"
+
+#define backspace 8
+#define del 127
+#define LF 10
+#define CR 13
+
+Serial pc(USBTX, USBRX);
+
+N5110 display(dp4,dp24,dp23,dp25,dp2,dp6,dp18);
+
+int x(0), y(0);
+
+void obrisi()
+{
+    if(x==0 && y==0)
+    {   
+        x = 84;
+        y = 40;
+    }
+    
+    if(x==0)
+    {
+        y = y - 1;
+        x = 84;
+        
+    }
+    
+    int nx(x-6);
+    int ny(y+1);
+    
+    for(int i = x - 1;i>=nx;i--)
+    
+        for(int j = y;j<ny;j++)
+        {
+            display.setXYAddress(x,y);
+            display.clearPixel(i,j);
+        }
+    
+    
+    display.refresh();
+    x = nx;
+
+}
+
+void obrisiSve()
+{
+    display.clear();
+    display.refresh();
+    x = y = 0;
+    display.setXYAddress(0,0);
+
+}
+
+void noviRed()
+{
+    if(y==40) y = 0;
+    else y = y + 1;
+    
+    x = 0;
+    
+    display.setXYAddress(x,y);
+    
+}
+
+void ispisiKarakter(char c)
+{
+    //display.setXYAddress(0,0);
+    display.printChar(c);
+    
+    
+    x = x + 6;
+    
+    if(x==84)
+    { 
+        x = 0;
+        y = y + 8;
+    }
+
+}
+
+
+
+
+int main()
+{
+    display.init();
+    display.normalMode();
+    display.setXYAddress(0,0);
+
+    while(1)
+    {
+        char c = pc.getc();
+        
+        if(c=='-')
+            obrisi();
+        else if(c=='*')
+            obrisiSve();
+        else if(c=='+')
+            noviRed();
+         else ispisiKarakter(c);
+         
+    
+    }
+
+}
diff -r 000000000000 -r 6a52cbe1aa9b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 05 10:05:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file