display
Dependencies: mbed SPI_TFT_ILI9341 UTouch
Revision 0:7573aef67295, committed 2021-12-01
- Comitter:
- smejky
- Date:
- Wed Dec 01 15:34:28 2021 +0000
- Commit message:
- display;
Changed in this revision
diff -r 000000000000 -r 7573aef67295 SPI_TFT_ILI9341.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SPI_TFT_ILI9341.lib Wed Dec 01 15:34:28 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/smejky/code/SPI_TFT_ILI9341/#2724838d11ed
diff -r 000000000000 -r 7573aef67295 UTouch.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UTouch.lib Wed Dec 01 15:34:28 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/smejky/code/UTouch/#1840ecdcb109
diff -r 000000000000 -r 7573aef67295 display.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/display.cpp Wed Dec 01 15:34:28 2021 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" +#include "SPI_TFT_ILI9341.h" +#include "UTouch.h" + +SPI_TFT_ILI9341 spi(D11,D12,D13,D8, D7, D6, "TFT");// mosi, miso, sclk, chip_select, reset, dc +UTouch touch(D4,D9,D3,D2,D5);//clk,chip_select,MOSI,miso,irq(pripojeno je ale nevim co to dela) +/* + v SPI_TFT_ILI9341.cpp zmeneny framerate ze 70 na 100, toto pomohlo problemu blikání displeje + +*/ + +void Button(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,int color){ + spi.fillrect(x0,y0,x1,y1,color); + while(1==1) + { + if (touch.DataAvailable()) + { + if(touch.Read()) + { + unsigned char touch_y = touch.GetX(); + unsigned char touch_x = touch.GetY(); + touch_x = touch_x - 10; + 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(0.5); + spi.fillrect(x0,y0,x1,y1,color); + } + + + + + } + } + } +} + + + +main(){ + + spi.background(White); + spi.cls(); + spi.circle(1, 1, 20, Black); + touch.InitTouch(); + touch.SetPrecision(PREC_LOW); + //spi.fillrect(0,0,220,100, Blue); + Button(0,0,220,100,Green); + + + +}
diff -r 000000000000 -r 7573aef67295 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Dec 01 15:34:28 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file