mbed library for earthlcd ezLCD3xx line of displays

Dependencies:   MMA8451Q SDFileSystem TSI ezLCDLib mbed

go here for library http://mbed.org/users/codeman/code/ezLCDLib/

Files at this revision

API Documentation at this revision

Comitter:
codeman
Date:
Mon Apr 29 03:04:30 2013 +0000
Parent:
0:b4366af9dee8
Child:
2:839437baa4db
Commit message:
version .5

Changed in this revision

MMA8451Q.lib Show annotated file Show diff for this revision Revisions of this file
TSI.lib Show annotated file Show diff for this revision Revisions of this file
ezLCD.lib Show diff for this revision Revisions of this file
ezLCDLib.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Mon Apr 29 03:04:30 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Mon Apr 29 03:04:30 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/emilmont/code/TSI/#507b1f67804b
--- a/ezLCD.lib	Sun Apr 21 22:21:50 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/shimniok/code/SerialGraphicLCD/#cc0e1e8fd19e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ezLCDLib.lib	Mon Apr 29 03:04:30 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/codeman/code/ezLCDLib/#28e71ce23bfd
--- a/main.cpp	Sun Apr 21 22:21:50 2013 +0000
+++ b/main.cpp	Mon Apr 29 03:04:30 2013 +0000
@@ -1,27 +1,164 @@
+/**
+*
+*
+*
+*
+*/
 #include "mbed.h"
+#include "TSISensor.h"
 #include "ezLCDLib.h"
- 
-ezLCD3 lcd(PTC4, PTC3);
-  int main() {
-    while (1) {
-       lcd.cls();
-//       wait(2);
-//       lcd.light(50);
-//       wait(2);
-       lcd.printf("%d %s %02x", 1024, "test", 54);
-       wait(1);
-//       lcd.light(100);              
-/*
-       lcd.pixel(14, 35, true);
-       lcd.pixel(16, 36, true);
-       lcd.pixel(18, 37, true);
-       lcd.pos(5, 30);
-       lcd.printf("Hi");
-       lcd.circle(50, 20, 20, true);
-       lcd.pos(50, 20);
-       lcd.printf("Howdy");
-       lcd.line(0, 0, 25, 25, true);
-*/
-       wait(2);
+#include "MMA8451Q.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+enum { BLACK, GRAY, SILVER, WHITE, RED, MAROON, YELLOW, OLIVE, LIME, GREEN, AQUA, TEAL, BLUE, NAVY, FUCHSIA, PURPLE };
+#define arLCD
+//InterruptIn ezLCD3Int( PTD7);   //  interrupt instance for touch
+//InterruptIn ezLCD3Int( PTA13);   //  interrupt instance for touch
+#ifdef arLCD
+InterruptIn ezLCD3Int( PTD4 );   //  interrupt instance for touch
+DigitalOut _nrst(PTC7);
+ezLCD3 lcd(PTA2, PTA1); //rx,tx
+TSISensor tsi;
+AnalogIn adc1(PTB0);
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+#endif
+
+DigitalOut myled(LED_BLUE);
+volatile bool ezLCD3Touch = false;
+
+int color = BLACK;
+int temp;
+int touch=0;
+int adc1Count = 0;
+float adc1Average = 0;
+
+char ezID[20];
+char ezVER[20];
+char adcBuf[20];
+void ezLCD3Isr( void )
+{
+    ezLCD3Touch = true;
+}
+
+int main()
+{
+    /*
+        _nrst=0;
+        wait(1);
+        _nrst=1;
+     */
+    wait(3);
+
+    while(!lcd.sync());
+    ezLCD3Int.fall(&ezLCD3Isr);
+    ezLCD3Touch = false;
+    myled=1;
+    lcd.cls(BLACK);
+ //int EmbossDkColor, int  EmbossLtColor, int TextColor0, int TextColor1, int TextColorDisabled, int Color0, int Color1, int ColorDisabled, int CommonBkColor, int Fontw
+    lcd.theme(0, 111, 106, 0, 130, 0, 13, 12, 101, 100, 0);
+//    lcd.touchZone(1,0,0,319,239,1);
+    lcd.xy(0,0);//11
+    lcd.color(BLACK);    //1
+    lcd.box(319,239, 1 );//2
+    lcd.color(155);
+    lcd.xy(1,1);
+    lcd.line(317,1);
+    lcd.xy(1,1);
+    lcd.line(1,237);  
+    lcd.color(WHITE);
+    lcd.xy(2,237);
+    lcd.line(317,237);
+    lcd.line(317,2);
+    lcd.color(WHITE);//3
+    lcd.xy(300,100);//4
+//    lcd.circle(50,0);//5
+    lcd.xy(300,200);//6
+//    lcd.circle(50,1);//7
+    lcd.light(50);//8
+    lcd.xy(40,10);//9
+    lcd.print("--==[\\[28m Hello \\[65mMBED\\[28m World \\[3m]==--");//10
+    lcd.xy(20,100);//11
+    lcd.color(YELLOW);//12
+    lcd.setStringID( 2,"Button1");
+    lcd.setStringID( 3,"Button2");
+    //lcd.setStringID( 3,"AMeter");
+    lcd.button(2,20,40,100,40,1,0,10,0,2);
+    lcd.button(3,200,40,100,40,1,0,10,0,3);
+    lcd.getStringID( 65,ezID);
+    lcd.getStringID( 66,ezVER);
+    lcd.print(ezID);
+    lcd.color(PURPLE);
+    lcd.xy(20,120);//11
+    lcd.print(ezVER);
+    lcd.color(TEAL);
+    lcd.xy(20,140);
+    lcd.printf("MaxX %d MaxY %d", lcd.getXmax()+1, lcd.getYmax()+1); //13 14
+    lcd.light(5);//15
+    lcd.light(100);//16
+    lcd.image(20,165,"0.gif");  
+    lcd.image(55,165,"1.gif");  
+    lcd.image(90,165,"2.gif");  
+    lcd.image(125,165,"3.gif");          
+    lcd.color(WHITE);//17
+    lcd.setStringID(4, "meter");
+    lcd.setStringID(5, "%");
+    lcd.setStringID(6, "X");
+    lcd.setStringID(7, "Y");
+    lcd.setStringID(8, "Z");            
+    lcd.staticText(  4, 200, 210, 100, 25, 8, 0, 4);
+    lcd.progressBar( 5, 200, 180, 100, 25, 1, 0, 100, 0 , 5);
+    lcd.progressBar( 6, 200, 90, 100, 25, 1, 0, 100, 0 , 6);
+    lcd.progressBar( 7, 200, 120, 100, 25, 1, 0, 100, 0 , 7);        
+    lcd.progressBar( 8, 200, 150, 100, 25, 1, 0, 100, 0 , 8);    
+//    lcd.ameter(3, 50, 30, 200, 200, 1, 10, 0, 120, 0, 3, 0);
+
+    while(1) {
+        if(ezLCD3Touch) {
+            ezLCD3Touch = false;
+            touch=lcd.wstack(LIFO);
+            myled = !myled;
+            lcd.xy(10,210);
+            lcd.color(BLACK);
+            lcd.box(180,20,1);
+            lcd.color(WHITE);
+            switch( touch ) {
+                case    240:
+                    lcd.print("Button1 Pressed");
+                    break;
+                case    214:
+                    lcd.print("Button1 Released");
+                    break;
+                case    224:
+                    lcd.print("Button1 Cancel");
+                    break;
+                case    340:
+                    lcd.print("Button2 Pressed");
+                    break;
+                case    314:
+                    lcd.print("Button2 Released");
+                    break;
+                case    324:
+                    lcd.print("Button2 Cancel");
+                    break;
+                default:
+                    lcd.print("default");
+                    break;
+            }
+        }
+    adc1Average += adc1.read();
+    adc1Count ++;
+    if (adc1Count == 500) {
+    adc1Count=0;
+    sprintf(adcBuf, "%1.3f V",(adc1Average/500)*3.3);
+    lcd.setStringID(4, adcBuf);
+    lcd.wstate(4,REDRAW);
+    adc1Average =0;
     }
-  }
\ No newline at end of file
+    wait(0.1);
+    lcd.wvalue(5,abs( tsi.readPercentage()*100));
+    lcd.wvalue(6,abs(acc.getAccX())*100);
+    lcd.wvalue(7,abs(acc.getAccY())*100);
+    lcd.wvalue(8,abs(acc.getAccZ())*100);
+    }
+
+}
\ No newline at end of file