Anesa Drakovac Hamdija Sinanovic

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim004
Date:
Thu May 08 14:05:37 2014 +0000
Commit message:
Anesa Drakovac;

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 14:05:37 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 14:05:37 2014 +0000
@@ -0,0 +1,111 @@
+#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 = 5;
+    }
+    
+    if(x-6<0)
+    {
+        y = y - 1;
+        x = 84;
+    }
+    
+    x -= 6;
+    display.setXYAddress(x,y);
+    display.printChar(' ');
+    /*x -= 6;
+    display.setXYAddress(x,y);*/
+}
+/*
+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 == 6) y = 0;
+    else y = y + 1;
+    x = 0;
+    display.setXYAddress(x,y);
+    
+}
+ 
+void ispisi(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 ispisi(c);
+
+    }
+ 
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 08 14:05:37 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file