Toto je má konečná verze maturitního projektu
Dependencies: mbed mbed-rtos UTouch_vyrobek UniGraphic
display.cpp
- Committer:
- smejky
- Date:
- 2022-02-26
- Revision:
- 13:4a5997f90d18
- Parent:
- 12:9bc02f9e16e3
- Child:
- 14:5e5fb33ba27e
File content as of revision 13:4a5997f90d18:
#include "display.h" UTouch touch(D5,D4,D3,D2,D1);//clk,chip_select,MOSI,miso,irq ILI9341 spi(SPI_8,320000000,PTD2,PTD3,PTD1,PTE24, PTE25, PTC4, "TFT",240,320);// mosi, miso, sclk, chip_select, reset, dc Thread thread; Thread thread_h; PwmOut br(D10); DigitalOut rel(D0); PwmOut r(PTC10); PwmOut g(PTC3); PwmOut b(PTC2); float rychlost = 0.05; float led_jas = 80; float lcd_jas = 0.50f; int barvy[9] = {}; int jas[] = {Cyan,White}; int jas_s = 2; int jas_led = 2; int jazyk_s = 0; int cas_hodiny = 0; int cas_minuty = 0; int cas_hodiny_on = 0; int cas_minuty_on = 0; int cas_hodiny_off = 0; int cas_minuty_off = 0; int cas_nastavit = 1037059200; int time_on = 0; int time_off = 1; int lang = 0; char minutka[32]; char hodinka[32]; char buffer[32]; char jazyk [6][150] = { "Czech", "English", " Set Time", "Brightness", " ON", " OFF" }; char en[6][150] = { "Czech", "English", " Set Time", "Brightness", " ON", " OFF" }; char cz[6][150] = { "Cestina", "Anglictina", "Nastavit cas", " Jas", "Zap.", "Vyp." }; void hold(){ int i = touch.DataAvailable(); while (i){ i = touch.DataAvailable(); } } void send_color(float color_r = 255,float color_g = 255, float color_b = 255, float brightness = 0){ brightness = 100 - brightness; color_r = color_r * 0.00387855; //příklad 255*0,0039 se rovná 0.9945 což znamená že je to 1 barevný bod; 0.9945 vezmeme a vynásobíme 0,0039 což nám vznikne tady toto, funguje to nevim jak to funguje color_g = color_g * 0.00387855; // example 255*0,0039 equals to 0.9945 which means that this is one color point out of 255; we take the 0.9945 and multiply it by 0,0039 which results to this, it works I dunno how color_b = color_b * 0.00387855; color_r = color_r - ((color_r*0.01)*brightness); //jas vypocitame tak ze si vezmeme kolik je jedno procento vybraných barevných bodů a to vynásobíme cislem jak moc chceme omezit tento jas color_g = color_g - ((color_g*0.01)*brightness); //we calculate the brightness by taking the choosen color points and getting how much is 1% then we just make it how much do we want to lower the brightness color_b = color_b - ((color_b*0.01)*brightness); write_color(color_r,color_g,color_b); } void write_color(float red,float green, float blue){ r.write(red); g.write(green); b.write(blue); } /* v ILI9341.cpp zmeneny framerate ze 70 na 100, toto pomohlo problemu blikání displeje velikost fotky pro čudlik 180x70 x0 = od leveho horniho rohu(240max) y=0 od leveho horniho rohu x1 = od pravého spodniho rohu(240max) mel by byt vetsi nez x0 y1 = od pravého spodniho rohu mel by byt vetsi nez y0 4x doprava jas pro cudliky v menu predelat na konci jmena cudliku */ void grafika(unsigned short int press = 0){ switch(press) { case 1: spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc); // pravy spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy break; case 2: spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); break; case 7: //zrusit spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit); spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); break; case 9: //potvrdit spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); break; case 3: spi.fillrect(0,200,106,240,Black); spi.Bitmap(13,200,80,40,(unsigned char*)gImage_spodni_levy); break; case 4: spi.fillrect(107,200,213,240,Black); spi.Bitmap(120,200,80,40,(unsigned char*)gImage_stredni_levy);//prostredni break; case 5: spi.fillrect(214,200,320,240,Black); spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy);//pravy spodni break; default: spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.Bitmap(274,0,46,36,(unsigned char*)gImage_vypln);//pravy spi.Bitmap(274,165,46,36,(unsigned char*)gImage_vypln);//pravy spi.Bitmap(0,0,46,36,(unsigned char*)gImage_vypln);//levy spi.Bitmap(0,165,46,36,(unsigned char*)gImage_vypln);//levy spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc); // pravy spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); spi.fillrect(0,200,106,240,Black); spi.Bitmap(13,200,80,40,(unsigned char*)gImage_spodni_levy); spi.fillrect(107,200,213,240,Black); spi.Bitmap(120,200,80,40,(unsigned char*)gImage_stredni_levy);//prostredni spi.fillrect(214,200,320,240,Black); spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy);//pravy spodni } } void malovani(){ while(1==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; spi.pixel(touch_x,touch_y,Blue); } } } } /* else if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy [1])){ R_is_pressed = 1; spi.fillrect(pravy[0],pravy[1],pravy[2],pravy[3],pravy[4]); wait(0.1); } */ void Button(int strana = 0){ int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík //int cudlik[] = {20,80,42,130,Orange}; //slider nepovedeny projekt //int stred_cudliku[] = {30,105,Blue}; //střed čudliku int spodni_levy[] = {200,214,240,320}; // pravy spodni cudlik int stredni_levy[] = {200,107,240,213}; //stred spodni cudlik int stredni_pravy[] = {200,0,240,106}; //stred levy spodni cudlik int cudlik_1[] = {10,213,58,260}; int cudlik_2[] = {10,137,58,184}; int cudlik_3[] = {10,60,58,107}; int cudlik_4[] = {76,213,123,260}; int cudlik_5[] = {76,137,123,184}; while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 touch_x = touch_x - 5; touch_y = touch_y + 10; //spi.pixel(touch_x,touch_y,Blue); //printf("x %d ,y %d\r\n",touch_x,touch_y); //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ int m = strana; switch(strana){ case 0: m++; break; case 1: m++; break; default: m = 0; } //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(1); Menu(m); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ int m = strana; switch(strana){ case 1: m--; break; default: m = 1; } //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(2); Menu(m); } //levý čudlik //levý spodni čudlik if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ spi.fillrect(0,200,106,240,Select); spi.Bitmap(13,200,80,40,(unsigned char*)gImage_spodni_levy_s); hold(); grafika(9); grafika(3); grafika(7); nastaveni(); } //levý spodni čudlik //stred levy spodni cudlik if ((touch_x > stredni_levy[0]) && (touch_x < stredni_levy[2]) && (touch_y < stredni_levy[3]) && (touch_y > stredni_levy[1])){ spi.fillrect(107,200,213,240,Select); spi.Bitmap(120,200,80,40,(unsigned char*)gImage_stredni_levy_s); on_off(); hold(); grafika(4); } //stred levy spodni cudlik //stred pravy spodni cudlik if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){ spi.fillrect(214,200,320,240,Select); spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s); hold(); grafika(5); Menu(1); } //stred pravy spodni cudlik //MENU CUDLIKY********************************************************************************************************************************************************************************** //prvni if ((touch_x > cudlik_1[0]) && (touch_x < cudlik_1[2]) && (touch_y < cudlik_1[3]) && (touch_y > cudlik_1[1]) && (strana == 1)){ spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1s_vrch); spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1s_spodek); hold(); spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch); spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek); wait(0.2); grafika(7); grafika(9); Static(); } //prvni //druhy if ((touch_x > cudlik_2[0]) && (touch_x < cudlik_2[2]) && (touch_y < cudlik_2[3]) && (touch_y > cudlik_2[1]) && (strana == 1)){ spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2s_vrch); spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2s_spodek); hold(); spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2_vrch); spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2_spodek); grafika(7); grafika(9); set_fadeinout(); wait(0.2); } //druhy //treti if ((touch_x > cudlik_3[0]) && (touch_x < cudlik_3[2]) && (touch_y < cudlik_3[3]) && (touch_y > cudlik_3[1]) && (strana == 1)){ spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3s_vrch); spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3s_spodek); hold(); spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3_vrch); spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3_spodek); grafika(7); grafika(9); set_rainbow(); wait(0.2); } //treti //ctvrty if ((touch_x > cudlik_4[0]) && (touch_x < cudlik_4[2]) && (touch_y < cudlik_4[3]) && (touch_y > cudlik_4[1]) && (strana == 1)){ spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4s_vrch); spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4s_spodek); hold(); spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch); spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek); grafika(7); grafika(9); set_flash(); wait(0.2); } //ctvrty //paty if ((touch_x > cudlik_5[0]) && (touch_x < cudlik_5[2]) && (touch_y < cudlik_5[3]) && (touch_y > cudlik_5[1]) && (strana == 1)){ spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu_s); spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1s_spodek); hold(); spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu); spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek); grafika(7); grafika(9); set_change(); wait(0.2); } //paty } } } } void Menu(int strana = 0){ switch(strana) { case 1: spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); //CUDLIKY******************************************************************************* //prvni rada spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3_vrch); spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3_spodek); spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2_vrch); spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2_spodek); spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch); spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek); //prvni rada //druha rada //spi.Bitmap(213,76,48,24,(unsigned char*)gImage_cudlik1_vrch); //spi.Bitmap(213,100,48,24,(unsigned char*)gImage_cudlik1_spodek); spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu); spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek); spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch); spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek); // druha rada /* //treti rada spi.Bitmap(213,142,48,24,(unsigned char*)gImage_cudlik1_vrch); spi.Bitmap(213,166,48,24,(unsigned char*)gImage_cudlik1_spodek); spi.Bitmap(137,142,48,24,(unsigned char*)gImage_cudlik1_vrch); spi.Bitmap(137,166,48,24,(unsigned char*)gImage_cudlik1_spodek); spi.Bitmap(60,142,48,24,(unsigned char*)gImage_cudlik1_vrch); spi.Bitmap(60,166,48,24,(unsigned char*)gImage_cudlik1_spodek); // treti rada */ //CUDLIKY******************************************************************************* strana = 1; Button(strana); break; default: spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); strana = 0; Button(strana); } } void Static(){ int green1[] = {109,40,212,143}; int green[] = {40,109,143,212}; int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(green1[0],green1[1],green1[2],green1[3],White); int color_pick = White; spi.fillrect(0,200,320,240,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); thread.terminate(); switch (color_pick){ case Red: send_color(255,0,0,led_jas); break; case Orange: send_color(255,128,0,led_jas); break; case Yellow: send_color(255,255,0,led_jas); break; case GreenYellow: send_color(127,255,0,led_jas); break; case Green: send_color(0,255,0,led_jas); break; case White: send_color(255,255,255,led_jas); break; case Cyan: send_color(0,255,255,led_jas); break; case DarkCyan: send_color(0,127,255,led_jas); break; case Blue: send_color(0,0,255,led_jas); break; case Purple: send_color(127,0,255,led_jas); break; case Magenta: send_color(255,0,255,led_jas); break; case Pink: send_color(255,0,127,led_jas); break; default: send_color(0,0,0,led_jas); } grafika(); Menu(); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(); Menu(); } //levý čudlik //levý spodni čudlik if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ spi.fillrect(0,200,320,240,Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(117,210); spi.printf(jazyk[3]); hold(); led_jas = brightness_led(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick); spi.fillrect(0,200,320,240,Black); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); } //levý spodni čudlik if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){ hold(); color_pick = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick); } } } } } void set_fadeinout(){ int pole3[] = {213,76,260,124}; int pole2[] = {137,76,184,124}; int pole1[] = {60,76,107,124}; int pole1_t[] = {76,213,124,260}; int pole2_t[] = {76,137,124,184}; int pole3_t[] = {76,60,124,107}; int pick_time_t[] = {142,137,189,184}; int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); int color_pick1 = Black; int color_pick2 = Black; int color_pick3 = Black; int time_picked = 1; float rychlost_tady = 0.01; spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.fillrect(0,200,320,240,Black); spi.fillrect(137,142,184,189,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); spi.set_font((unsigned char*) Arial28x28); spi.locate(153,155); spi.printf("%d",time_picked); while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); thread.terminate(); int p = 0; while(p < 9){ barvy[p] = 0; p++; } rychlost = rychlost_tady; switch (color_pick1){ case Red: barvy[0] = 255; barvy[1] = 0; barvy[2] = 0; break; case Orange: barvy[0] = 255; barvy[1] = 128; barvy[2] = 0; break; case Yellow: barvy[0] = 255; barvy[1] = 255; barvy[2] = 0; break; case GreenYellow: barvy[0] = 128; barvy[1] = 255; barvy[2] = 0; break; case Green: barvy[0] = 0; barvy[1] = 255; barvy[2] = 0; break; case White: barvy[0] = 255; barvy[1] = 255; barvy[2] = 255; break; case Cyan: barvy[0] = 0; barvy[1] = 255; barvy[2] = 255; break; case DarkCyan: barvy[0] = 0; barvy[1] = 127; barvy[2] = 255; break; case Blue: barvy[0] = 0; barvy[1] = 0; barvy[2] = 255; break; case Purple: barvy[0] = 128; barvy[1] = 0; barvy[2] = 255; break; case Magenta: barvy[0] = 255; barvy[1] = 0; barvy[2] = 255; break; case Pink: barvy[0] = 255; barvy[1] = 0; barvy[2] = 127; break; default: printf("err"); } switch (color_pick2){ case Red: barvy[3] = 255; barvy[4] = 0; barvy[5] = 0; break; case Orange: barvy[3] = 255; barvy[4] = 128; barvy[5] = 0; break; case Yellow: barvy[3] = 255; barvy[4] = 255; barvy[5] = 0; break; case GreenYellow: barvy[3] = 128; barvy[4] = 255; barvy[5] = 0; break; case Green: barvy[3] = 0; barvy[4] = 255; barvy[5] = 0; break; case White: barvy[3] = 255; barvy[4] = 255; barvy[5] = 255; break; case Cyan: barvy[3] = 0; barvy[4] = 255; barvy[5] = 255; break; case DarkCyan: barvy[3] = 0; barvy[4] = 127; barvy[5] = 255; break; case Blue: barvy[3] = 0; barvy[4] = 0; barvy[5] = 255; break; case Purple: barvy[3] = 128; barvy[4] = 0; barvy[5] = 255; break; case Magenta: barvy[3] = 255; barvy[4] = 0; barvy[5] = 255; break; case Pink: barvy[3] = 255; barvy[4] = 0; barvy[5] = 127; break; default: printf("err"); } switch (color_pick3){ case Red: barvy[6] = 255; barvy[7] = 0; barvy[8] = 0; break; case Orange: barvy[6] = 255; barvy[7] = 128; barvy[8] = 0; break; case Yellow: barvy[6] = 255; barvy[7] = 255; barvy[8] = 0; break; case GreenYellow: barvy[6] = 128; barvy[7] = 255; barvy[8] = 0; break; case Green: barvy[6] = 0; barvy[7] = 255; barvy[8] = 0; break; case White: barvy[6] = 255; barvy[7] = 255; barvy[8] = 255; break; case Cyan: barvy[6] = 0; barvy[7] = 255; barvy[8] = 255; break; case DarkCyan: barvy[6] = 0; barvy[7] = 127; barvy[8] = 255; break; case Blue: barvy[6] = 0; barvy[7] = 0; barvy[8] = 255; break; case Purple: barvy[6] = 128; barvy[7] = 0; barvy[8] = 255; break; case Magenta: barvy[6] = 255; barvy[7] = 0; barvy[8] = 255; break; case Pink: barvy[6] = 255; barvy[7] = 0; barvy[8] = 127; break; default: printf("err"); } thread.start(fadeinout); grafika(); Menu(); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(); Menu(); } //levý čudlik //levý spodni čudlik if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ spi.fillrect(0,200,320,240,Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(117,210); spi.printf(jazyk[3]); hold(); led_jas = brightness_led(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.background(Black); spi.locate(153,155); spi.printf("%d",time_picked); spi.fillrect(0,200,320,240,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); } //levý spodni čudlik if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){ hold(); color_pick1 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){ hold(); color_pick2 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){ hold(); color_pick3 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pick_time_t[0]) && (touch_x < pick_time_t[2]) && (touch_y < pick_time_t[3]) && (touch_y > pick_time_t[1])){ spi.fillrect(137,142,184,189,Select); spi.background(Select); spi.set_font((unsigned char*) Arial28x28); spi.locate(153,155); spi.printf("%d",time_picked); hold(); time_picked++; switch(time_picked){ case 1: rychlost_tady = 0.01; break; case 2: rychlost_tady = 0.03; break; case 3: rychlost_tady = 0.06; break; case 4: rychlost_tady = 0.1; break; default: time_picked = 1; rychlost_tady = 0.01; } spi.fillrect(137,142,184,189,Black); spi.background(Black); spi.locate(153,155); spi.printf("%d",time_picked); } } } } } void set_flash(){ int pole3[] = {213,76,260,124}; int pole2[] = {137,76,184,124}; int pole1[] = {60,76,107,124}; int pole1_t[] = {76,213,124,260}; int pole2_t[] = {76,137,124,184}; int pole3_t[] = {76,60,124,107}; int pick_time_t[] = {142,137,189,184}; int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); int color_pick1 = Black; int color_pick2 = Black; int color_pick3 = Black; int time_picked = 1; float rychlost_tady = 1; spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.fillrect(0,200,320,240,Black); spi.fillrect(137,142,184,189,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); spi.set_font((unsigned char*) Arial28x28); spi.locate(153,155); spi.printf("%d",time_picked); while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); thread.terminate(); int p = 0; while(p < 9){ barvy[p] = 0; p++; } rychlost = rychlost_tady; switch (color_pick1){ case Red: barvy[0] = 255; barvy[1] = 0; barvy[2] = 0; break; case Orange: barvy[0] = 255; barvy[1] = 128; barvy[2] = 0; break; case Yellow: barvy[0] = 255; barvy[1] = 255; barvy[2] = 0; break; case GreenYellow: barvy[0] = 128; barvy[1] = 255; barvy[2] = 0; break; case Green: barvy[0] = 0; barvy[1] = 255; barvy[2] = 0; break; case White: barvy[0] = 255; barvy[1] = 255; barvy[2] = 255; break; case Cyan: barvy[0] = 0; barvy[1] = 255; barvy[2] = 255; break; case DarkCyan: barvy[0] = 0; barvy[1] = 127; barvy[2] = 255; break; case Blue: barvy[0] = 0; barvy[1] = 0; barvy[2] = 255; break; case Purple: barvy[0] = 128; barvy[1] = 0; barvy[2] = 255; break; case Magenta: barvy[0] = 255; barvy[1] = 0; barvy[2] = 255; break; case Pink: barvy[0] = 255; barvy[1] = 0; barvy[2] = 127; break; default: printf("err"); } switch (color_pick2){ case Red: barvy[3] = 255; barvy[4] = 0; barvy[5] = 0; break; case Orange: barvy[3] = 255; barvy[4] = 128; barvy[5] = 0; break; case Yellow: barvy[3] = 255; barvy[4] = 255; barvy[5] = 0; break; case GreenYellow: barvy[3] = 128; barvy[4] = 255; barvy[5] = 0; break; case Green: barvy[3] = 0; barvy[4] = 255; barvy[5] = 0; break; case White: barvy[3] = 255; barvy[4] = 255; barvy[5] = 255; break; case Cyan: barvy[3] = 0; barvy[4] = 255; barvy[5] = 255; break; case DarkCyan: barvy[3] = 0; barvy[4] = 127; barvy[5] = 255; break; case Blue: barvy[3] = 0; barvy[4] = 0; barvy[5] = 255; break; case Purple: barvy[3] = 128; barvy[4] = 0; barvy[5] = 255; break; case Magenta: barvy[3] = 255; barvy[4] = 0; barvy[5] = 255; break; case Pink: barvy[3] = 255; barvy[4] = 0; barvy[5] = 127; break; default: printf("err"); } switch (color_pick3){ case Red: barvy[6] = 255; barvy[7] = 0; barvy[8] = 0; break; case Orange: barvy[6] = 255; barvy[7] = 128; barvy[8] = 0; break; case Yellow: barvy[6] = 255; barvy[7] = 255; barvy[8] = 0; break; case GreenYellow: barvy[6] = 128; barvy[7] = 255; barvy[8] = 0; break; case Green: barvy[6] = 0; barvy[7] = 255; barvy[8] = 0; break; case White: barvy[6] = 255; barvy[7] = 255; barvy[8] = 255; break; case Cyan: barvy[6] = 0; barvy[7] = 255; barvy[8] = 255; break; case DarkCyan: barvy[6] = 0; barvy[7] = 127; barvy[8] = 255; break; case Blue: barvy[6] = 0; barvy[7] = 0; barvy[8] = 255; break; case Purple: barvy[6] = 128; barvy[7] = 0; barvy[8] = 255; break; case Magenta: barvy[6] = 255; barvy[7] = 0; barvy[8] = 255; break; case Pink: barvy[6] = 255; barvy[7] = 0; barvy[8] = 127; break; default: printf("err"); } thread.start(flash); grafika(); Menu(); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(); Menu(); } //levý čudlik //levý spodni čudlik if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ spi.fillrect(0,200,320,240,Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(117,210); spi.printf(jazyk[3]); hold(); led_jas = brightness_led(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.background(Black); spi.locate(153,155); spi.printf("%d",time_picked); spi.fillrect(0,200,320,240,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); } //levý spodni čudlik if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){ hold(); color_pick1 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){ hold(); color_pick2 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){ hold(); color_pick3 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pick_time_t[0]) && (touch_x < pick_time_t[2]) && (touch_y < pick_time_t[3]) && (touch_y > pick_time_t[1])){ spi.fillrect(137,142,184,189,Select); spi.background(Select); spi.set_font((unsigned char*) Arial28x28); spi.locate(153,155); spi.printf("%d",time_picked); hold(); time_picked++; switch(time_picked){ case 1: rychlost_tady = 1; break; case 2: rychlost_tady = 4; break; case 3: rychlost_tady = 8; break; case 4: rychlost_tady = 12; break; default: time_picked = 1; rychlost_tady = 1; } spi.fillrect(137,142,184,189,Black); spi.background(Black); spi.locate(153,155); spi.printf("%d",time_picked); } } } } } void set_rainbow(){ int green1[] = {109,40,212,143}; int green[] = {40,109,143,212}; int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black); int time_picked = 1; float rychlost_tady = 0.0015; spi.fillrect(0,200,320,240,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); spi.set_font((unsigned char*) Arial48x47); spi.locate(147,70); spi.printf("%d",time_picked); while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); thread.terminate(); rychlost = rychlost_tady; thread.start(rainbow); grafika(); Menu(); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(); Menu(); } //levý čudlik //levý spodni čudlik if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ spi.fillrect(0,200,320,240,Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(117,210); spi.printf(jazyk[3]); hold(); led_jas = brightness_led(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.set_font((unsigned char*) Arial48x47); spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black); spi.background(Black); spi.locate(147,70); spi.printf("%d",time_picked); spi.fillrect(0,200,320,240,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); } //levý spodni čudlik if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){ spi.fillrect(green1[0],green1[1],green1[2],green1[3],Select); spi.background(Select); spi.set_font((unsigned char*) Arial48x47);; spi.locate(147,70); spi.printf("%d",time_picked); hold(); time_picked++; switch(time_picked){ case 1: rychlost_tady = 0.0015; break; case 2: rychlost_tady = 0.0050; break; case 3: rychlost_tady = 0.01; break; case 4: rychlost_tady = 0.05; break; default: time_picked = 1; rychlost_tady = 0.05; } spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black); spi.background(Black); spi.locate(147,70); spi.printf("%d",time_picked); } } } } } void set_change(){ int pole3[] = {213,76,260,124}; int pole2[] = {137,76,184,124}; int pole1[] = {60,76,107,124}; int pole1_t[] = {76,213,124,260}; int pole2_t[] = {76,137,124,184}; int pole3_t[] = {76,60,124,107}; int pick_time_t[] = {142,137,189,184}; int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); int color_pick1 = Black; int color_pick2 = Black; int color_pick3 = Black; int time_picked = 1; float rychlost_tady = 0.5; spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.fillrect(0,200,320,240,Black); spi.fillrect(137,142,184,189,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); spi.set_font((unsigned char*) Arial28x28); spi.locate(153,155); spi.printf("%d",time_picked); while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); thread.terminate(); int p = 0; while(p < 9){ barvy[p] = 0; p++; } rychlost = rychlost_tady; switch (color_pick1){ case Red: barvy[0] = 255; barvy[1] = 0; barvy[2] = 0; break; case Orange: barvy[0] = 255; barvy[1] = 128; barvy[2] = 0; break; case Yellow: barvy[0] = 255; barvy[1] = 255; barvy[2] = 0; break; case GreenYellow: barvy[0] = 128; barvy[1] = 255; barvy[2] = 0; break; case Green: barvy[0] = 0; barvy[1] = 255; barvy[2] = 0; break; case White: barvy[0] = 255; barvy[1] = 255; barvy[2] = 255; break; case Cyan: barvy[0] = 0; barvy[1] = 255; barvy[2] = 255; break; case DarkCyan: barvy[0] = 0; barvy[1] = 127; barvy[2] = 255; break; case Blue: barvy[0] = 0; barvy[1] = 0; barvy[2] = 255; break; case Purple: barvy[0] = 128; barvy[1] = 0; barvy[2] = 255; break; case Magenta: barvy[0] = 255; barvy[1] = 0; barvy[2] = 255; break; case Pink: barvy[0] = 255; barvy[1] = 0; barvy[2] = 127; break; default: printf("err"); } switch (color_pick2){ case Red: barvy[3] = 255; barvy[4] = 0; barvy[5] = 0; break; case Orange: barvy[3] = 255; barvy[4] = 128; barvy[5] = 0; break; case Yellow: barvy[3] = 255; barvy[4] = 255; barvy[5] = 0; break; case GreenYellow: barvy[3] = 128; barvy[4] = 255; barvy[5] = 0; break; case Green: barvy[3] = 0; barvy[4] = 255; barvy[5] = 0; break; case White: barvy[3] = 255; barvy[4] = 255; barvy[5] = 255; break; case Cyan: barvy[3] = 0; barvy[4] = 255; barvy[5] = 255; break; case DarkCyan: barvy[3] = 0; barvy[4] = 127; barvy[5] = 255; break; case Blue: barvy[3] = 0; barvy[4] = 0; barvy[5] = 255; break; case Purple: barvy[3] = 128; barvy[4] = 0; barvy[5] = 255; break; case Magenta: barvy[3] = 255; barvy[4] = 0; barvy[5] = 255; break; case Pink: barvy[3] = 255; barvy[4] = 0; barvy[5] = 127; break; default: printf("err"); } switch (color_pick3){ case Red: barvy[6] = 255; barvy[7] = 0; barvy[8] = 0; break; case Orange: barvy[6] = 255; barvy[7] = 128; barvy[8] = 0; break; case Yellow: barvy[6] = 255; barvy[7] = 255; barvy[8] = 0; break; case GreenYellow: barvy[6] = 128; barvy[7] = 255; barvy[8] = 0; break; case Green: barvy[6] = 0; barvy[7] = 255; barvy[8] = 0; break; case White: barvy[6] = 255; barvy[7] = 255; barvy[8] = 255; break; case Cyan: barvy[6] = 0; barvy[7] = 255; barvy[8] = 255; break; case DarkCyan: barvy[6] = 0; barvy[7] = 127; barvy[8] = 255; break; case Blue: barvy[6] = 0; barvy[7] = 0; barvy[8] = 255; break; case Purple: barvy[6] = 128; barvy[7] = 0; barvy[8] = 255; break; case Magenta: barvy[6] = 255; barvy[7] = 0; barvy[8] = 255; break; case Pink: barvy[6] = 255; barvy[7] = 0; barvy[8] = 127; break; default: printf("err"); } thread.start(change); grafika(); Menu(); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(); Menu(); } //levý čudlik //levý spodni čudlik if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ spi.fillrect(0,200,320,240,Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(117,210); spi.printf(jazyk[3]); hold(); led_jas = brightness_led(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.background(Black); spi.locate(153,155); spi.printf("%d",time_picked); spi.fillrect(0,200,320,240,Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(117,210); spi.printf(jazyk[3]); } //levý spodni čudlik if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){ hold(); color_pick1 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){ hold(); color_pick2 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){ hold(); color_pick3 = color_picker(); spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); spi.set_font((unsigned char*) Arial28x28); spi.fillrect(137,142,184,189,Black); spi.locate(153,155); spi.printf("%d",time_picked); } if((touch_x > pick_time_t[0]) && (touch_x < pick_time_t[2]) && (touch_y < pick_time_t[3]) && (touch_y > pick_time_t[1])){ spi.fillrect(137,142,184,189,Select); spi.background(Select); spi.set_font((unsigned char*) Arial28x28); spi.locate(153,155); spi.printf("%d",time_picked); hold(); time_picked++; switch(time_picked){ case 1: rychlost_tady = 0.5; break; case 2: rychlost_tady = 1; break; case 3: rychlost_tady = 3; break; case 4: rychlost_tady = 7; break; default: time_picked = 1; rychlost_tady = 0.5; } spi.fillrect(137,142,184,189,Black); spi.background(Black); spi.locate(153,155); spi.printf("%d",time_picked); } } } } } void change(){ while(1){ if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){ }else{ send_color(barvy[0],barvy[1],barvy[2],led_jas); wait(rychlost); } if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){ }else{ send_color(barvy[3],barvy[4],barvy[5],led_jas); wait(rychlost); } if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){ }else{ send_color(barvy[6],barvy[7],barvy[8],led_jas); wait_ms(rychlost); } } } void flash(){ while(1){ if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){ }else{ send_color(barvy[0],barvy[1],barvy[2],led_jas); wait_ms(100); send_color(barvy[0],barvy[1],barvy[2],0); wait_ms(100); send_color(barvy[0],barvy[1],barvy[2],led_jas); wait_ms(100); send_color(barvy[0],barvy[1],barvy[2],0); wait(rychlost); } if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){ }else{ send_color(barvy[3],barvy[4],barvy[5],led_jas); wait_ms(100); send_color(barvy[3],barvy[4],barvy[5],0); wait_ms(100); send_color(barvy[3],barvy[4],barvy[5],led_jas); wait_ms(100); send_color(barvy[3],barvy[4],barvy[5],0); wait(rychlost); } if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){ }else{ send_color(barvy[6],barvy[7],barvy[8],led_jas); wait_ms(100); send_color(barvy[6],barvy[7],barvy[8],0); wait_ms(100); send_color(barvy[6],barvy[7],barvy[8],led_jas); wait_ms(100); send_color(barvy[6],barvy[7],barvy[8],0); wait(rychlost); } } } void rainbow(){ int i = 0; int j = 0; int k = 0; while(1){ i = 0; j = 0; k = 255; while(i < 255) { i = i + 1; k = k - 1; send_color(i,j,k,led_jas); wait(rychlost); } while(i > 0){ i = i - 1; j = j + 1; send_color(i,j,k,led_jas); wait(rychlost); } while(j > 0){ j = j - 1; k = k + 1; send_color(i,j,k,led_jas); wait(rychlost); } } } void fadeinout(){ int br = 0; while(1){ if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){ }else{ while(br < led_jas) { br = br + 1; send_color(barvy[0],barvy[1],barvy[2],br); wait(rychlost); } while(br > 0){ br = br - 1; send_color(barvy[0],barvy[1],barvy[2],br); wait(rychlost); } } if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){ }else{ while(br < led_jas) { br = br + 1; send_color(barvy[3],barvy[4],barvy[5],br); wait(rychlost); } while(br > 0){ br = br - 1; send_color(barvy[3],barvy[4],barvy[5],br); wait(rychlost); } } if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){ }else{ while(br < led_jas) { br = br + 1; send_color(barvy[6],barvy[7],barvy[8],br); wait(rychlost); } while(br > 0){ br = br - 1; send_color(barvy[6],barvy[7],barvy[8],br); wait(rychlost); } } } } int color_picker(){ int levy[] = {34,274,165,320}; //levý čudlík int pole1[] = {69,29,116,76}; int pole2[] = {117,29,163,76}; int pole3[] = {164,29,210,76}; int pole4[] = {211,29,257,76}; int pole5[] = {69,77,116,123}; int pole6[] = {117,77,163,123}; int pole7[] = {164,77,210,123}; int pole8[] = {211,77,257,123}; int pole9[] = {69,124,116,170}; int pole10[] = {117,124,163,170}; int pole11[] = {164,124,210,170}; int pole12[] = {211,124,257,170}; int pole4t[] = {29,69,76,116}; int pole3t[] = {29,117,76,163}; int pole2t[] = {29,164,76,210}; int pole1t[] = {29,211,76,257}; int pole8t[] = {77,69,123,116}; int pole7t[] = {77,117,123,163}; int pole6t[] = {77,164,123,210}; int pole5t[] = {77,211,123,257}; int pole12t[] = {124,69,170,116}; int pole11t[] = {124,117,170,163}; int pole10t[] = {124,164,170,210}; int pole9t[] = {124,211,170,257}; spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],Red); spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],Orange); spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],Yellow); spi.fillrect(pole4[0],pole4[1],pole4[2],pole4[3],GreenYellow); spi.fillrect(pole5[0],pole5[1],pole5[2],pole5[3],Green); spi.fillrect(pole6[0],pole6[1],pole6[2],pole6[3],White); spi.fillrect(pole7[0],pole7[1],pole7[2],pole7[3],Cyan); spi.fillrect(pole8[0],pole8[1],pole8[2],pole8[3],DarkCyan); spi.fillrect(pole9[0],pole9[1],pole9[2],pole9[3],Blue); spi.fillrect(pole10[0],pole10[1],pole10[2],pole10[3],Purple); spi.fillrect(pole11[0],pole11[1],pole11[2],pole11[3],Magenta); spi.fillrect(pole12[0],pole12[1],pole12[2],pole12[3],Pink); while(1) { if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); return Black; } //levý čudlik if((touch_x > pole1t[0]) && (touch_x < pole1t[2]) && (touch_y < pole1t[3]) && (touch_y > pole1t[1])){ hold(); return Red; } if((touch_x > pole2t[0]) && (touch_x < pole2t[2]) && (touch_y < pole2t[3]) && (touch_y > pole2t[1])){ hold(); return Orange; } if((touch_x > pole3t[0]) && (touch_x < pole3t[2]) && (touch_y < pole3t[3]) && (touch_y > pole3t[1])){ hold(); return Yellow; } if((touch_x > pole4t[0]) && (touch_x < pole4t[2]) && (touch_y < pole4t[3]) && (touch_y > pole4t[1])){ hold(); return GreenYellow; } if((touch_x > pole5t[0]) && (touch_x < pole5t[2]) && (touch_y < pole5t[3]) && (touch_y > pole5t[1])){ hold(); return Green; } if((touch_x > pole6t[0]) && (touch_x < pole6t[2]) && (touch_y < pole6t[3]) && (touch_y > pole6t[1])){ hold(); return White; } if((touch_x > pole7t[0]) && (touch_x < pole7t[2]) && (touch_y < pole7t[3]) && (touch_y > pole7t[1])){ hold(); return Cyan; } if((touch_x > pole8t[0]) && (touch_x < pole8t[2]) && (touch_y < pole8t[3]) && (touch_y > pole8t[1])){ hold(); return DarkCyan; } if((touch_x > pole9t[0]) && (touch_x < pole9t[2]) && (touch_y < pole9t[3]) && (touch_y > pole9t[1])){ hold(); return Blue; } if((touch_x > pole10t[0]) && (touch_x < pole10t[2]) && (touch_y < pole10t[3]) && (touch_y > pole10t[1])){ hold(); return Purple; } if((touch_x > pole11t[0]) && (touch_x < pole11t[2]) && (touch_y < pole11t[3]) && (touch_y > pole11t[1])){ hold(); return Magenta; } if((touch_x > pole12t[0]) && (touch_x < pole12t[2]) && (touch_y < pole12t[3]) && (touch_y > pole12t[1])){ hold(); return Pink; } } } } } int brightness_led(){ spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík int jas_temp = led_jas; int p10t[] = {229,52,264,147}; int p30t[] = {186,52,221,147}; int p50t[] = {143,52,178,147}; int p70t[] = {100,52,135,147}; int p90t[] = {57,52,92,147}; int p10[] = {57,52,92,147}; int p30[] = {100,52,135,147}; int p50[] = {143,52,178,147}; int p70[] = {186,52,221,147}; int p90[] = {229,52,264,147}; int change = jas_led; switch(jas_led){ case 0: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 1: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 2: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 3: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 4: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]); break; default: printf("err"); } while(1){ if(change == jas_led){ }else{ change = jas_led; switch(jas_led){ case 0: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 1: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 2: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 3: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 4: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]); break; default: printf("err"); } } if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(9); return jas_temp; } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); jas_temp = 0; grafika(7); return jas_led; } //levý čudlik if((touch_x > p10t[1]) && (touch_x < p10t[3]) && (touch_y < p10t[2]) && (touch_y > p10t[0])){ hold(); jas_led = 0; jas_temp = 10; } if((touch_x > p30t[1]) && (touch_x < p30t[3]) && (touch_y < p30t[2]) && (touch_y > p30t[0])){ hold(); jas_led = 1; jas_temp = 30; } if((touch_x > p50t[1]) && (touch_x < p50t[3]) && (touch_y < p50t[2]) && (touch_y > p50t[0])){ hold(); jas_led = 2; jas_temp = 50; } if((touch_x > p70t[1]) && (touch_x < p70t[3]) && (touch_y < p70t[2]) && (touch_y > p70t[0])){ hold(); jas_led = 3; jas_temp = 70; } if((touch_x > p90t[1]) && (touch_x < p90t[3]) && (touch_y < p90t[2]) && (touch_y > p90t[0])){ hold(); jas_led = 4; jas_temp = 90; } } } } } void nastaveni(){ int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík int i = 0; int stredni_pravy[] = {200,0,240,106}; //stred levy spodni cudlik spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); int check1[] = {66,10,96,40}; int check2[] = {66,56,96,86}; int prvni[] = {46,0,273,46}; //prvni čudlík int druhy[] = {46,46,273,92}; //druhy čudlík int treti[] = {46,92,273,138}; //treti čudlík int ctvrty[] = {46,138,273,184}; //treti čudlík spi.background(MojeSeda); spi.fillrect(prvni[0],prvni[1],prvni[2],prvni[3],MojeSeda); //prvni spi.rect(prvni[0],prvni[1],prvni[2],prvni[3],White); //prvni spi.set_font((unsigned char*) Arial28x28); spi.locate(140,14); spi.printf(jazyk[0]); spi.fillrect(druhy[0],druhy[1],druhy[2],druhy[3],MojeSeda); //druhy spi.rect(druhy[0],druhy[1],druhy[2],druhy[3],White); //druhy spi.locate(140,60); spi.printf(jazyk[1]); switch(lang) { case 1: spi.fillrect(check1[0],check1[1],check1[2],check1[3],Green); spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red); break; default: spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red); spi.fillrect(check2[0],check2[1],check2[2],check2[3],Green); } spi.fillrect(treti[0],treti[1],treti[2],treti[3],MojeSeda); //treti spi.rect(treti[0],treti[1],treti[2],treti[3],White); //treti spi.locate(90,106); spi.printf(jazyk[2]); spi.fillrect(ctvrty[0],ctvrty[1],ctvrty[2],ctvrty[3],MojeSeda); //ctvrty spi.rect(ctvrty[0],ctvrty[1],ctvrty[2],ctvrty[3],White); //ctvrty spi.locate(95,152); spi.printf(jazyk[3]); while(1){ if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); switch(jazyk_s) { case 1: while(i < 6){ strcpy(jazyk[i], cz[i]); i++; } break; default: while(i < 6){ strcpy(jazyk[i], en[i]); i++; } } i = 0; grafika(1); grafika(2); Menu(); wait(0.2); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(2); grafika(1); Menu(); wait(0.2); } //levý čudlik //stred pravy spodni cudlik if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){ spi.fillrect(214,200,320,240,Select); spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s); hold(); grafika(5); Menu(1); } //stred pravy spodni cudlik if((touch_x > prvni[1]) && (touch_x < prvni[3]) && (touch_y < prvni[2]) && (touch_y > prvni[0])){ hold(); jazyk_s = 1; lang = jazyk_s; spi.fillrect(check1[0],check1[1],check1[2],check1[3],Green); spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red); wait(0.2); } if((touch_x > druhy[1]) && (touch_x < druhy[3]) && (touch_y < druhy[2]) && (touch_y > druhy[0])){ hold(); jazyk_s = 0; lang = jazyk_s; spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red); spi.fillrect(check2[0],check2[1],check2[2],check2[3],Green); wait(0.2); } if((touch_x > treti[1]) && (touch_x < treti[3]) && (touch_y < treti[2]) && (touch_y > treti[0])){ hold(); nastavit_hodiny(); } if((touch_x > ctvrty[1]) && (touch_x < ctvrty[3]) && (touch_y < ctvrty[2]) && (touch_y > ctvrty[0])){ hold(); brightness(); } } } } } void brightness(){ spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík int p10t[] = {229,52,264,147}; int p30t[] = {186,52,221,147}; int p50t[] = {143,52,178,147}; int p70t[] = {100,52,135,147}; int p90t[] = {57,52,92,147}; int p10[] = {57,52,92,147}; int p30[] = {100,52,135,147}; int p50[] = {143,52,178,147}; int p70[] = {186,52,221,147}; int p90[] = {229,52,264,147}; switch(jas_s){ case 0: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 1: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 2: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 3: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); break; case 4: spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]); break; default: printf("err"); } while(1){ if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(9); br.write(lcd_jas); nastaveni(); wait(0.2); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); lcd_jas = 0.00f; grafika(7); nastaveni(); wait(0.2); } //levý čudlik if((touch_x > p10t[1]) && (touch_x < p10t[3]) && (touch_y < p10t[2]) && (touch_y > p10t[0])){ hold(); jas_s = 0; lcd_jas = 0.10f; brightness(); } if((touch_x > p30t[1]) && (touch_x < p30t[3]) && (touch_y < p30t[2]) && (touch_y > p30t[0])){ hold(); jas_s = 1; lcd_jas = 0.30f; brightness(); } if((touch_x > p50t[1]) && (touch_x < p50t[3]) && (touch_y < p50t[2]) && (touch_y > p50t[0])){ hold(); jas_s = 2; lcd_jas = 0.50f; brightness(); } if((touch_x > p70t[1]) && (touch_x < p70t[3]) && (touch_y < p70t[2]) && (touch_y > p70t[0])){ hold(); jas_s = 3; lcd_jas = 0.70f; brightness(); } if((touch_x > p90t[1]) && (touch_x < p90t[3]) && (touch_y < p90t[2]) && (touch_y > p90t[0])){ hold(); jas_s = 4; lcd_jas = 0.90f; brightness(); } } } } } void on_off(){ int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík int up1[] = {172,28,258,57}; int down1[] = {172,142,258,171}; int up2[] = {62,28,148,57}; int down2[] = {62,142,148,171}; bool a = true; cas_hodiny_on = 0; cas_minuty_on = 0; cas_hodiny_off = 0; cas_minuty_off = 0; int h1_on = cas_hodiny_on / 10; int h2_on = cas_hodiny_on % 10; int h1_off = cas_hodiny_off / 10; int h2_off = cas_hodiny_off % 10; char cisla[10][3] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; int m1_on = cas_minuty_on / 10; int m2_on = cas_minuty_on % 10; int m1_off = cas_minuty_off / 10; int m2_off = cas_minuty_off % 10; int blue1[] = {71,65,249,134}; int bar2[] = {159,200,320,240}; int bar1[] = {0,200,160,240}; int b1[] = {200,159,240,320}; int b2[] = {200,0,240,160}; spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); spi.fillrect(bar1[0],bar1[1],bar1[2],bar1[3],Select); spi.fillrect(bar2[0],bar2[1],bar2[2],bar2[3],Black); spi.fillrect(blue1[0],blue1[1],blue1[2],blue1[3],MojeSeda); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(55,210); spi.printf(jazyk[4]); spi.background(Black); spi.locate(215,210); spi.printf(jazyk[5]); spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_on]); spi.locate(110,80); spi.printf(cisla[h2_on]); spi.locate(155,80); spi.printf(":"); spi.locate(189,80); spi.printf(cisla[m1_on]); spi.locate(219,80); spi.printf(cisla[m2_on]); grafika(9); grafika(7); while(1){ if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); time_on = 1037059200 + (cas_hodiny_on * 3600) + (cas_minuty_on * 60); time_off = 1037059200 + (cas_hodiny_off * 3600) + (cas_minuty_off * 60); grafika(); Button(); wait(0.2); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(); Button(); wait(0.2); } //levý čudlik //ON if ((touch_x > b1[0]) && (touch_x < b1[2]) && (touch_y < b1[3]) && (touch_y > b1[1])){ spi.fillrect(bar1[0],bar1[1],bar1[2],bar1[3],Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(55,210); spi.printf(jazyk[4]); spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_on]); spi.locate(110,80); spi.printf(cisla[h2_on]); spi.locate(189,80); spi.printf(cisla[m1_on]); spi.locate(219,80); spi.printf(cisla[m2_on]); spi.fillrect(bar2[0],bar2[1],bar2[2],bar2[3],Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(215,210); spi.printf(jazyk[5]); a = true; hold(); wait(0.2); } //ON //OFF if ((touch_x > b2[0]) && (touch_x < b2[2]) && (touch_y < b2[3]) && (touch_y > b2[1])){ spi.fillrect(bar1[0],bar1[1],bar1[2],bar1[3],Black); spi.set_font((unsigned char*) Arial21x21); spi.background(Black); spi.locate(55,210); spi.printf(jazyk[4]); spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_off]); spi.locate(110,80); spi.printf(cisla[h2_off]); spi.locate(189,80); spi.printf(cisla[m1_off]); spi.locate(219,80); spi.printf(cisla[m2_off]); spi.fillrect(bar2[0],bar2[1],bar2[2],bar2[3],Select); spi.set_font((unsigned char*) Arial21x21); spi.background(Select); spi.locate(215,210); spi.printf(jazyk[5]); a = false; hold(); wait(0.2); } //OFF if(a == true){////////////////////////////////////ON if((touch_x > up1[1]) && (touch_x < up1[3]) && (touch_y < up1[2]) && (touch_y > up1[0])){ spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru_s); while ((touch.DataAvailable()) && (h2_on < 10)){ h2_on++; cas_hodiny_on++; if(cas_hodiny_on == 24){ cas_hodiny_on = 0; } if(h2_on == 10){ h2_on = 0; h1_on++; } if((h1_on == 2)&&(h2_on == 4)){ h2_on = 0; h1_on = 0; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_on]); spi.locate(110,80); spi.printf(cisla[h2_on]); wait(0.1); } spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); } if((touch_x > down1[1]) && (touch_x < down1[3]) && (touch_y < down1[2]) && (touch_y > down1[0])){ spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu_s); while ((touch.DataAvailable()) && (h2_on < 10)){ h2_on--; if((h2_on < 0)&&(h1_on == 0)){ h2_on = 3; h1_on = 2; } if(h2_on < 0){ h2_on = 9; h1_on--; } cas_hodiny_on--; if(cas_hodiny_on < 0){ cas_hodiny_on = 23; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_on]); spi.locate(110,80); spi.printf(cisla[h2_on]); wait(0.1); } spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); } if((touch_x > up2[1]) && (touch_x < up2[3]) && (touch_y < up2[2]) && (touch_y > up2[0])){ spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru_s); while ((touch.DataAvailable()) && (m2_on < 10)){ m2_on++; cas_minuty_on++; if(cas_minuty_on == 60){ cas_minuty_on = 0; } if((m1_on == 5)&&(m2_on == 10)){ m2_on = 0; m1_on = 0; } if(m2_on == 10){ m2_on = 0; m1_on++; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(189,80); spi.printf(cisla[m1_on]); spi.locate(219,80); spi.printf(cisla[m2_on]); wait(0.1); } spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); } if((touch_x > down2[1]) && (touch_x < down2[3]) && (touch_y < down2[2]) && (touch_y > down2[0])){ spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu_s); while ((touch.DataAvailable()) && (m2_on < 10)){ m2_on--; if((m2_on < 0)&&(m1_on == 0)){ m2_on = 9; m1_on = 5; } if(m2_on < 0){ m2_on = 9; m1_on--; } cas_minuty_on--; if(cas_minuty_on < 0){ cas_minuty_on = 59; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(189,80); spi.printf(cisla[m1_on]); spi.locate(219,80); spi.printf(cisla[m2_on]); wait(0.1); } spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); } } else{////////////////////////////////////OFF if((touch_x > up1[1]) && (touch_x < up1[3]) && (touch_y < up1[2]) && (touch_y > up1[0])){ spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru_s); while ((touch.DataAvailable()) && (h2_off < 10)){ h2_off++; cas_hodiny_off++; if(cas_hodiny_off == 24){ cas_hodiny_off = 0; } if(h2_off == 10){ h2_off = 0; h1_off++; } if((h1_off == 2)&&(h2_off == 4)){ h2_off = 0; h1_off = 0; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_off]); spi.locate(110,80); spi.printf(cisla[h2_off]); wait(0.1); } spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); } if((touch_x > down1[1]) && (touch_x < down1[3]) && (touch_y < down1[2]) && (touch_y > down1[0])){ spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu_s); while ((touch.DataAvailable()) && (h2_off < 10)){ h2_off--; if((h2_off < 0)&&(h1_off == 0)){ h2_off = 3; h1_off = 2; } if(h2_off < 0){ h2_off = 9; h1_off--; } cas_hodiny_off--; if(cas_hodiny_off < 0){ cas_hodiny_off = 23; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1_off]); spi.locate(110,80); spi.printf(cisla[h2_off]); wait(0.1); } spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); } if((touch_x > up2[1]) && (touch_x < up2[3]) && (touch_y < up2[2]) && (touch_y > up2[0])){ spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru_s); while ((touch.DataAvailable()) && (m2_off < 10)){ m2_off++; cas_minuty_off++; if(cas_minuty_off == 60){ cas_minuty_off = 0; } if((m1_off == 5)&&(m2_off == 10)){ m2_off = 0; m1_off = 0; } if(m2_off == 10){ m2_off = 0; m1_off++; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(189,80); spi.printf(cisla[m1_off]); spi.locate(219,80); spi.printf(cisla[m2_off]); wait(0.1); } spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); } if((touch_x > down2[1]) && (touch_x < down2[3]) && (touch_y < down2[2]) && (touch_y > down2[0])){ spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu_s); while ((touch.DataAvailable()) && (m2_off < 10)){ m2_off--; if((m2_off < 0)&&(m1_off == 0)){ m2_off = 9; m1_off = 5; } if(m2_off < 0){ m2_off = 9; m1_off--; } cas_minuty_off--; if(cas_minuty_off < 0){ cas_minuty_off = 59; } spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(189,80); spi.printf(cisla[m1_off]); spi.locate(219,80); spi.printf(cisla[m2_off]); wait(0.1); } spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); } } } } } } void nastavit_hodiny(){ int pravy[] = {34,0,165,46}; //pravý čudlík int levy[] = {34,274,165,320}; //levý čudlík int up1[] = {172,28,258,57}; int down1[] = {172,142,258,171}; int up2[] = {62,28,148,57}; int down2[] = {62,142,148,171}; cas_hodiny = atoi(hodinka); cas_minuty = atoi(minutka); int h1 = cas_hodiny / 10; int h2 = cas_hodiny % 10; char cisla[10][3] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; int m1 = cas_minuty / 10; int m2 = cas_minuty % 10; int blue1[] = {71,65,249,134}; spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); spi.fillrect(blue1[0],blue1[1],blue1[2],blue1[3],MojeSeda); spi.set_font((unsigned char*) Arial48x47); spi.background(MojeSeda); spi.locate(80,80); spi.printf(cisla[h1]); spi.locate(110,80); spi.printf(cisla[h2]); spi.locate(155,80); spi.printf(":"); spi.locate(189,80); spi.printf(cisla[m1]); spi.locate(219,80); spi.printf(cisla[m2]); while(1){ if (touch.DataAvailable()) { if(touch.Read()) { unsigned short int touch_y = touch.GetX(); // 0-320 unsigned short int touch_x = touch.GetY(); // 0-240 //pravý čudlik if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ //GRAFIKA************************************************** spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); thread_h.terminate(); cas_nastavit = 1037059200 + (cas_hodiny * 3600) + (cas_minuty * 60); thread_h.start(hodiny); grafika(9); nastaveni(); wait(0.2); } //pravý čudlik //levý čudlik if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ //GRAFIKA************************************************** spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); //GRAFIKA************************************************** hold(); grafika(7); nastaveni(); wait(0.2); } //levý čudlik if((touch_x > up1[1]) && (touch_x < up1[3]) && (touch_y < up1[2]) && (touch_y > up1[0])){ spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru_s); while ((touch.DataAvailable()) && (h2 < 10)){ h2++; cas_hodiny++; if(cas_hodiny == 24){ cas_hodiny = 0; } if(h2 == 10){ h2 = 0; h1++; } if((h1 == 2)&&(h2 == 4)){ h2 = 0; h1 = 0; } spi.locate(80,80); spi.printf(cisla[h1]); spi.locate(110,80); spi.printf(cisla[h2]); wait(0.1); } spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); } if((touch_x > down1[1]) && (touch_x < down1[3]) && (touch_y < down1[2]) && (touch_y > down1[0])){ spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu_s); while ((touch.DataAvailable()) && (h2 < 10)){ h2--; if((h2 < 0)&&(h1 == 0)){ h2 = 3; h1 = 2; } if(h2 < 0){ h2 = 9; h1--; } cas_hodiny--; if(cas_hodiny < 0){ cas_hodiny = 23; } spi.locate(80,80); spi.printf(cisla[h1]); spi.locate(110,80); spi.printf(cisla[h2]); wait(0.1); } spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); } if((touch_x > up2[1]) && (touch_x < up2[3]) && (touch_y < up2[2]) && (touch_y > up2[0])){ spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru_s); while ((touch.DataAvailable()) && (m2 < 10)){ m2++; cas_minuty++; if(cas_minuty == 60){ cas_minuty = 0; } if((m1 == 5)&&(m2 == 10)){ m2 = 0; m1 = 0; } if(m2 == 10){ m2 = 0; m1++; } spi.locate(189,80); spi.printf(cisla[m1]); spi.locate(219,80); spi.printf(cisla[m2]); wait(0.1); } spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); } if((touch_x > down2[1]) && (touch_x < down2[3]) && (touch_y < down2[2]) && (touch_y > down2[0])){ spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu_s); while ((touch.DataAvailable()) && (m2 < 10)){ m2--; if((m2 < 0)&&(m1 == 0)){ m2 = 9; m1 = 5; } if(m2 < 0){ m2 = 9; m1--; } cas_minuty--; if(cas_minuty < 0){ cas_minuty = 59; } spi.locate(189,80); spi.printf(cisla[m1]); spi.locate(219,80); spi.printf(cisla[m2]); wait(0.1); } spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); } } } } } void hodiny(){ set_time(cas_nastavit); while(1){ time_t seconds = time(NULL); if(seconds == time_on){ rel.write(1); } if(seconds == time_off){ rel.write(0); } strftime(buffer, 32, "%R", localtime(&seconds)); strftime(hodinka, 32, "%H", localtime(&seconds)); strftime(minutka, 32, "%M", localtime(&seconds)); printf("%s\r\n",buffer); Thread::wait(1000); } } main(){ r.pulsewidth(5); g.pulsewidth(5); b.pulsewidth(5); spi.set_orientation(3); spi.FastWindow(true); touch.InitTouch(); touch.SetPrecision(PREC_EXTREME); spi.background(Black); spi.foreground(White); spi.cls(); send_color(255,255,255,led_jas); rel.write(1); grafika(); //br.period_us(1000); br.pulsewidth(5); br.write(lcd_jas); Button(); }