Toto je má konečná verze maturitního projektu
Dependencies: mbed mbed-rtos UTouch_vyrobek UniGraphic
Diff: display.cpp
- Revision:
- 1:4dd546219e30
- Parent:
- 0:6abf63b83992
- Child:
- 2:0629f1ddaa92
diff -r 6abf63b83992 -r 4dd546219e30 display.cpp --- a/display.cpp Mon Dec 06 22:07:00 2021 +0000 +++ b/display.cpp Mon Dec 06 22:21:09 2021 +0000 @@ -14,33 +14,29 @@ void Button(unsigned short int x0, unsigned short int y0,unsigned short int x1, unsigned short int y1,int color){ spi.fillrect(x0,y0,x1,y1,color); - //spi.fillrect(0,320,180,315,Purple); - //spi.fillrect(0,250,180,245,Purple); - //spi.fillrect(0,320,5,250,Purple); - while(1==1){ + while(1==1) + { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); - unsigned short int touch_x = touch.GetY(); + unsigned short int touch_x = touch.GetY(); touch_x = touch_x - 10; - touch_y = touch_y + 10; - printf("%d \r\n",touch_y); + touch_y = touch_y + 10; if ((touch_x >= x0 && touch_x <= x1)&&(touch_y >= y0 && touch_y <= y1)){ spi.fillrect(x0,y0,x1,y1,Black); - wait(500); - + wait(0.5); + spi.fillrect(x0,y0,x1,y1,color); } - } + + - } - } - -} - - + } + } + } +} @@ -50,21 +46,8 @@ spi.circle(240, 320, 20, Black); touch.InitTouch(); touch.SetPrecision(PREC_EXTREME); - while(1){ - if (touch.DataAvailable()) - { - if(touch.Read()) - { - unsigned short int touch_y = touch.GetX(); - unsigned short int touch_x = touch.GetY(); - touch_x = touch_x - 10; - touch_y = touch_y + 10; - printf("%d \r\n",touch_y); - spi.pixel(touch_x,touch_y,Blue); - } - - } - - } + + Button(0,0,180,70,Blue); + Button(0,320,180,250,Blue); }