Ilvana Brankovic Emina Muharemovic

Dependencies:   N5110 mbed

Committer:
tim008
Date:
Thu May 08 14:07:03 2014 +0000
Revision:
0:c12be7f2bae2
lv8_Grupa5_Tim008_zad3

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tim008 0:c12be7f2bae2 1 #include "mbed.h"
tim008 0:c12be7f2bae2 2 #include "N5110.h"
tim008 0:c12be7f2bae2 3
tim008 0:c12be7f2bae2 4 N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18);
tim008 0:c12be7f2bae2 5
tim008 0:c12be7f2bae2 6 Serial pc( USBTX,USBRX);
tim008 0:c12be7f2bae2 7
tim008 0:c12be7f2bae2 8
tim008 0:c12be7f2bae2 9 #define delete '#'
tim008 0:c12be7f2bae2 10 #define backspace '*'
tim008 0:c12be7f2bae2 11 #define enter '&'
tim008 0:c12be7f2bae2 12
tim008 0:c12be7f2bae2 13 int x=0;
tim008 0:c12be7f2bae2 14 int y=0;
tim008 0:c12be7f2bae2 15
tim008 0:c12be7f2bae2 16
tim008 0:c12be7f2bae2 17 char unesen;
tim008 0:c12be7f2bae2 18
tim008 0:c12be7f2bae2 19 int main() {
tim008 0:c12be7f2bae2 20 lcd.init();
tim008 0:c12be7f2bae2 21 lcd.setXYAddress(0,0);
tim008 0:c12be7f2bae2 22 while(1) {
tim008 0:c12be7f2bae2 23
tim008 0:c12be7f2bae2 24 unesen=pc.getc();
tim008 0:c12be7f2bae2 25 if(unesen=='#')
tim008 0:c12be7f2bae2 26 {
tim008 0:c12be7f2bae2 27 lcd.clear();
tim008 0:c12be7f2bae2 28 lcd.refresh();
tim008 0:c12be7f2bae2 29 lcd.setXYAddress(0,0);
tim008 0:c12be7f2bae2 30 x=0;
tim008 0:c12be7f2bae2 31 y=0;
tim008 0:c12be7f2bae2 32 }
tim008 0:c12be7f2bae2 33 else if(unesen=='&')
tim008 0:c12be7f2bae2 34 {
tim008 0:c12be7f2bae2 35 if(x==83)
tim008 0:c12be7f2bae2 36 {
tim008 0:c12be7f2bae2 37 x=0;
tim008 0:c12be7f2bae2 38 }
tim008 0:c12be7f2bae2 39 y=y+1; // ili je y+1
tim008 0:c12be7f2bae2 40
tim008 0:c12be7f2bae2 41 if(y==48)
tim008 0:c12be7f2bae2 42 {
tim008 0:c12be7f2bae2 43 y=0;
tim008 0:c12be7f2bae2 44 }
tim008 0:c12be7f2bae2 45 lcd.setXYAddress(0,y);
tim008 0:c12be7f2bae2 46
tim008 0:c12be7f2bae2 47 }
tim008 0:c12be7f2bae2 48 else if(unesen=='*')
tim008 0:c12be7f2bae2 49 {
tim008 0:c12be7f2bae2 50 if(x>6)
tim008 0:c12be7f2bae2 51 {
tim008 0:c12be7f2bae2 52 for(int i=y-1;i<y;i++)
tim008 0:c12be7f2bae2 53 {
tim008 0:c12be7f2bae2 54 for(int j=x-6;j<x;j++)
tim008 0:c12be7f2bae2 55 {
tim008 0:c12be7f2bae2 56 lcd.clearPixel(j,i);
tim008 0:c12be7f2bae2 57 }
tim008 0:c12be7f2bae2 58 }
tim008 0:c12be7f2bae2 59 x=x-6;
tim008 0:c12be7f2bae2 60 lcd.setXYAddress(x,y);
tim008 0:c12be7f2bae2 61 }
tim008 0:c12be7f2bae2 62 else
tim008 0:c12be7f2bae2 63 {
tim008 0:c12be7f2bae2 64
tim008 0:c12be7f2bae2 65 }
tim008 0:c12be7f2bae2 66
tim008 0:c12be7f2bae2 67
tim008 0:c12be7f2bae2 68
tim008 0:c12be7f2bae2 69 }
tim008 0:c12be7f2bae2 70 else
tim008 0:c12be7f2bae2 71 {
tim008 0:c12be7f2bae2 72 lcd.printChar(unesen);
tim008 0:c12be7f2bae2 73 x=x+6;
tim008 0:c12be7f2bae2 74 if(x==83)
tim008 0:c12be7f2bae2 75 {
tim008 0:c12be7f2bae2 76 x=0;
tim008 0:c12be7f2bae2 77 y=y+1;
tim008 0:c12be7f2bae2 78 }
tim008 0:c12be7f2bae2 79 //adresa da li se kod printcahr stalno mijenja
tim008 0:c12be7f2bae2 80 // da li sam vidi imal mjesta da upise taj svoj char
tim008 0:c12be7f2bae2 81 }
tim008 0:c12be7f2bae2 82 }
tim008 0:c12be7f2bae2 83
tim008 0:c12be7f2bae2 84
tim008 0:c12be7f2bae2 85
tim008 0:c12be7f2bae2 86
tim008 0:c12be7f2bae2 87
tim008 0:c12be7f2bae2 88
tim008 0:c12be7f2bae2 89 }