cbcx
Dependencies: DmTftLibrary mbed
Fork of LCD_Proj by
Diff: main.cpp
- Revision:
- 4:0d4286278f41
- Parent:
- 3:03c08a612220
diff -r 03c08a612220 -r 0d4286278f41 main.cpp --- a/main.cpp Mon Jan 25 12:42:52 2016 +0000 +++ b/main.cpp Mon Feb 01 13:08:54 2016 +0000 @@ -16,6 +16,9 @@ #include "mbed.h" #include "bild.h" //Bilder mit einbinden +#include "as5047p.h" +#include "fuellstand.h" + #include "DmTftHX8353C.h" #include "DmTftS6D0164.h" @@ -61,6 +64,8 @@ * Local variables *****************************************************************************/ +/********* Fuellstand *********/ +Fuellstand fst(75,p25, p26, p27, p28, p30); /********* TFT DISPLAY INIT *********/ DmTftIli9341 tft(p21, p22, p5, p6, p7); /* DmTftIli9341(PinName cs, PinName dc, PinName mosi, PinName miso, PinName clk) DM_TFT28_105 and DM_TFT28_116*/ @@ -216,6 +221,7 @@ touch.init(); tft.drawImage(208,0,32,32,zahnrad); + tft.drawImage(0,0,32,32,fuellstand); } @@ -343,13 +349,82 @@ } + + +void FReckt(int width, int x, int y, int percent) +{ + tft.drawRectangle(x,y,x+width,y+100,WHITE); + tft.fillRectangle(x+1,y+1,x+width-2,y+98,BLACK); + + + + if(percent>=1&&percent<=25) + { + tft.fillRectangle(x+1,y+76,x+width-2,y+98,BLUE); + + } + + if(percent>=26&&percent<=50) + { + tft.fillRectangle(x+1,y+51,x+width-2,y+98,BLUE); + } + + if(percent>=51&&percent<=75) + { + tft.fillRectangle(x+1,y+26,x+width-2,y+98,BLUE); + } + + if(percent == 100) + { + tft.fillRectangle(x+1,y+1,x+width-2,y+98,BLUE); + } + +} + +void Fstand() +{ + + tft.clearScreen(BLACK); + + + while(1) + { + FReckt(60, 30, 30, fst.wert()); + wait(0.5); + } + /* + while(1) + { + a=a+5; + wait(0.5); + FReckt(120,80,10,10,a); + if(a>=100) + { + a=100; + break; + } + + } + while(1) + { + a=a-5; + wait(0.5); + FReckt(120,80,10,10,a); + if(a<=0) + { + break; + } + } + */ +} + /****************************************************************************** * Main *****************************************************************************/ int main() { - + fst.setboden(true); struct tm t; t.tm_sec = 00; // 0-59 @@ -406,6 +481,10 @@ //Reset Stoppuhr if(down==true&&x>=165&&x<=214&&y>=285&&y<=310) reset(); + //Füllstand + if(down==true&&x>=0&&x<=32&&y>=0&&y<=32) + Fstand(); + tft.drawNumber(78,230,stund,2,1); tft.drawString(94, 230, ":");