Toto je má konečná verze maturitního projektu
Dependencies: mbed mbed-rtos UTouch_vyrobek UniGraphic
display.cpp@13:4a5997f90d18, 2022-02-26 (annotated)
- Committer:
- smejky
- Date:
- Sat Feb 26 17:25:02 2022 +0000
- Revision:
- 13:4a5997f90d18
- Parent:
- 12:9bc02f9e16e3
- Child:
- 14:5e5fb33ba27e
Toto je finalni verze meho vyrobku;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
smejky | 7:91b982ccf255 | 1 | #include "display.h" |
smejky | 11:4ca8388080c6 | 2 | |
smejky | 8:b6e7401fdcfc | 3 | |
smejky | 11:4ca8388080c6 | 4 | UTouch touch(D5,D4,D3,D2,D1);//clk,chip_select,MOSI,miso,irq |
smejky | 11:4ca8388080c6 | 5 | ILI9341 spi(SPI_8,320000000,PTD2,PTD3,PTD1,PTE24, PTE25, PTC4, "TFT",240,320);// mosi, miso, sclk, chip_select, reset, dc |
smejky | 12:9bc02f9e16e3 | 6 | |
smejky | 7:91b982ccf255 | 7 | Thread thread; |
smejky | 11:4ca8388080c6 | 8 | Thread thread_h; |
smejky | 10:0176705be216 | 9 | PwmOut br(D10); |
smejky | 9:d1385f7171af | 10 | |
smejky | 12:9bc02f9e16e3 | 11 | DigitalOut rel(D0); |
smejky | 11:4ca8388080c6 | 12 | PwmOut r(PTC10); |
smejky | 11:4ca8388080c6 | 13 | PwmOut g(PTC3); |
smejky | 11:4ca8388080c6 | 14 | PwmOut b(PTC2); |
smejky | 11:4ca8388080c6 | 15 | |
smejky | 12:9bc02f9e16e3 | 16 | float rychlost = 0.05; |
smejky | 11:4ca8388080c6 | 17 | float led_jas = 80; |
smejky | 10:0176705be216 | 18 | float lcd_jas = 0.50f; |
smejky | 12:9bc02f9e16e3 | 19 | int barvy[9] = {}; |
smejky | 11:4ca8388080c6 | 20 | int jas[] = {Cyan,White}; |
smejky | 10:0176705be216 | 21 | int jas_s = 2; |
smejky | 12:9bc02f9e16e3 | 22 | int jas_led = 2; |
smejky | 10:0176705be216 | 23 | int jazyk_s = 0; |
smejky | 10:0176705be216 | 24 | int cas_hodiny = 0; |
smejky | 10:0176705be216 | 25 | int cas_minuty = 0; |
smejky | 11:4ca8388080c6 | 26 | int cas_hodiny_on = 0; |
smejky | 11:4ca8388080c6 | 27 | int cas_minuty_on = 0; |
smejky | 11:4ca8388080c6 | 28 | int cas_hodiny_off = 0; |
smejky | 11:4ca8388080c6 | 29 | int cas_minuty_off = 0; |
smejky | 9:d1385f7171af | 30 | int cas_nastavit = 1037059200; |
smejky | 13:4a5997f90d18 | 31 | int time_on = 0; |
smejky | 13:4a5997f90d18 | 32 | int time_off = 1; |
smejky | 9:d1385f7171af | 33 | int lang = 0; |
smejky | 10:0176705be216 | 34 | char minutka[32]; |
smejky | 10:0176705be216 | 35 | char hodinka[32]; |
smejky | 9:d1385f7171af | 36 | char buffer[32]; |
smejky | 12:9bc02f9e16e3 | 37 | char jazyk [6][150] = { |
smejky | 12:9bc02f9e16e3 | 38 | "Czech", |
smejky | 12:9bc02f9e16e3 | 39 | "English", |
smejky | 12:9bc02f9e16e3 | 40 | " Set Time", |
smejky | 12:9bc02f9e16e3 | 41 | "Brightness", |
smejky | 12:9bc02f9e16e3 | 42 | " ON", |
smejky | 12:9bc02f9e16e3 | 43 | " OFF" |
smejky | 12:9bc02f9e16e3 | 44 | }; |
smejky | 12:9bc02f9e16e3 | 45 | char en[6][150] = { |
smejky | 9:d1385f7171af | 46 | "Czech", |
smejky | 9:d1385f7171af | 47 | "English", |
smejky | 10:0176705be216 | 48 | " Set Time", |
smejky | 12:9bc02f9e16e3 | 49 | "Brightness", |
smejky | 12:9bc02f9e16e3 | 50 | " ON", |
smejky | 12:9bc02f9e16e3 | 51 | " OFF" |
smejky | 9:d1385f7171af | 52 | }; |
smejky | 12:9bc02f9e16e3 | 53 | char cz[6][150] = { |
smejky | 9:d1385f7171af | 54 | "Cestina", |
smejky | 9:d1385f7171af | 55 | "Anglictina", |
smejky | 10:0176705be216 | 56 | "Nastavit cas", |
smejky | 12:9bc02f9e16e3 | 57 | " Jas", |
smejky | 12:9bc02f9e16e3 | 58 | "Zap.", |
smejky | 12:9bc02f9e16e3 | 59 | "Vyp." |
smejky | 9:d1385f7171af | 60 | }; |
smejky | 9:d1385f7171af | 61 | |
smejky | 9:d1385f7171af | 62 | |
smejky | 9:d1385f7171af | 63 | |
smejky | 9:d1385f7171af | 64 | void hold(){ |
smejky | 9:d1385f7171af | 65 | int i = touch.DataAvailable(); |
smejky | 9:d1385f7171af | 66 | while (i){ |
smejky | 9:d1385f7171af | 67 | i = touch.DataAvailable(); |
smejky | 9:d1385f7171af | 68 | } |
smejky | 9:d1385f7171af | 69 | |
smejky | 9:d1385f7171af | 70 | } |
smejky | 11:4ca8388080c6 | 71 | |
smejky | 11:4ca8388080c6 | 72 | void send_color(float color_r = 255,float color_g = 255, float color_b = 255, float brightness = 0){ |
smejky | 11:4ca8388080c6 | 73 | |
smejky | 11:4ca8388080c6 | 74 | brightness = 100 - brightness; |
smejky | 11:4ca8388080c6 | 75 | |
smejky | 11:4ca8388080c6 | 76 | 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 |
smejky | 11:4ca8388080c6 | 77 | 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 |
smejky | 11:4ca8388080c6 | 78 | color_b = color_b * 0.00387855; |
smejky | 11:4ca8388080c6 | 79 | |
smejky | 11:4ca8388080c6 | 80 | 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 |
smejky | 11:4ca8388080c6 | 81 | 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 |
smejky | 11:4ca8388080c6 | 82 | color_b = color_b - ((color_b*0.01)*brightness); |
smejky | 11:4ca8388080c6 | 83 | write_color(color_r,color_g,color_b); |
smejky | 11:4ca8388080c6 | 84 | } |
smejky | 3:dadb214885c1 | 85 | |
smejky | 11:4ca8388080c6 | 86 | void write_color(float red,float green, float blue){ |
smejky | 11:4ca8388080c6 | 87 | r.write(red); |
smejky | 11:4ca8388080c6 | 88 | g.write(green); |
smejky | 11:4ca8388080c6 | 89 | b.write(blue); |
smejky | 7:91b982ccf255 | 90 | } |
smejky | 0:6abf63b83992 | 91 | |
smejky | 0:6abf63b83992 | 92 | /* |
smejky | 0:6abf63b83992 | 93 | v ILI9341.cpp zmeneny framerate ze 70 na 100, toto pomohlo problemu blikání displeje |
smejky | 3:dadb214885c1 | 94 | velikost fotky pro čudlik 180x70 |
smejky | 3:dadb214885c1 | 95 | 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 |
smejky | 0:6abf63b83992 | 96 | |
smejky | 10:0176705be216 | 97 | 4x doprava jas pro cudliky v menu |
smejky | 10:0176705be216 | 98 | |
smejky | 11:4ca8388080c6 | 99 | predelat na konci jmena cudliku |
smejky | 0:6abf63b83992 | 100 | */ |
smejky | 0:6abf63b83992 | 101 | |
smejky | 7:91b982ccf255 | 102 | |
smejky | 11:4ca8388080c6 | 103 | void grafika(unsigned short int press = 0){ |
smejky | 2:0629f1ddaa92 | 104 | switch(press) |
smejky | 2:0629f1ddaa92 | 105 | { |
smejky | 2:0629f1ddaa92 | 106 | case 1: |
smejky | 9:d1385f7171af | 107 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 9:d1385f7171af | 108 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc); // pravy |
smejky | 9:d1385f7171af | 109 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 110 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy |
smejky | 7:91b982ccf255 | 111 | |
smejky | 2:0629f1ddaa92 | 112 | break; |
smejky | 4:c7ca936cdd1f | 113 | case 2: |
smejky | 9:d1385f7171af | 114 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 9:d1385f7171af | 115 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik);// levy |
smejky | 9:d1385f7171af | 116 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 117 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 118 | break; |
smejky | 9:d1385f7171af | 119 | case 7: //zrusit |
smejky | 9:d1385f7171af | 120 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 10:0176705be216 | 121 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit); |
smejky | 9:d1385f7171af | 122 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 123 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 124 | break; |
smejky | 9:d1385f7171af | 125 | case 9: //potvrdit |
smejky | 9:d1385f7171af | 126 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 10:0176705be216 | 127 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit); |
smejky | 9:d1385f7171af | 128 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 10:0176705be216 | 129 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); |
smejky | 4:c7ca936cdd1f | 130 | break; |
smejky | 4:c7ca936cdd1f | 131 | case 3: |
smejky | 11:4ca8388080c6 | 132 | spi.fillrect(0,200,106,240,Black); |
smejky | 11:4ca8388080c6 | 133 | spi.Bitmap(13,200,80,40,(unsigned char*)gImage_spodni_levy); |
smejky | 2:0629f1ddaa92 | 134 | break; |
smejky | 4:c7ca936cdd1f | 135 | case 4: |
smejky | 11:4ca8388080c6 | 136 | spi.fillrect(107,200,213,240,Black); |
smejky | 11:4ca8388080c6 | 137 | spi.Bitmap(120,200,80,40,(unsigned char*)gImage_stredni_levy);//prostredni |
smejky | 4:c7ca936cdd1f | 138 | break; |
smejky | 4:c7ca936cdd1f | 139 | case 5: |
smejky | 11:4ca8388080c6 | 140 | spi.fillrect(214,200,320,240,Black); |
smejky | 11:4ca8388080c6 | 141 | spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy);//pravy spodni |
smejky | 11:4ca8388080c6 | 142 | break; |
smejky | 4:c7ca936cdd1f | 143 | |
smejky | 4:c7ca936cdd1f | 144 | default: |
smejky | 9:d1385f7171af | 145 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 7:91b982ccf255 | 146 | |
smejky | 9:d1385f7171af | 147 | spi.Bitmap(274,0,46,36,(unsigned char*)gImage_vypln);//pravy |
smejky | 9:d1385f7171af | 148 | spi.Bitmap(274,165,46,36,(unsigned char*)gImage_vypln);//pravy |
smejky | 9:d1385f7171af | 149 | spi.Bitmap(0,0,46,36,(unsigned char*)gImage_vypln);//levy |
smejky | 9:d1385f7171af | 150 | spi.Bitmap(0,165,46,36,(unsigned char*)gImage_vypln);//levy |
smejky | 7:91b982ccf255 | 151 | |
smejky | 9:d1385f7171af | 152 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 9:d1385f7171af | 153 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc); // pravy |
smejky | 9:d1385f7171af | 154 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 155 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy |
smejky | 7:91b982ccf255 | 156 | |
smejky | 9:d1385f7171af | 157 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 9:d1385f7171af | 158 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik);// levy |
smejky | 9:d1385f7171af | 159 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 160 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); |
smejky | 9:d1385f7171af | 161 | |
smejky | 11:4ca8388080c6 | 162 | spi.fillrect(0,200,106,240,Black); |
smejky | 11:4ca8388080c6 | 163 | spi.Bitmap(13,200,80,40,(unsigned char*)gImage_spodni_levy); |
smejky | 11:4ca8388080c6 | 164 | |
smejky | 11:4ca8388080c6 | 165 | spi.fillrect(107,200,213,240,Black); |
smejky | 11:4ca8388080c6 | 166 | spi.Bitmap(120,200,80,40,(unsigned char*)gImage_stredni_levy);//prostredni |
smejky | 11:4ca8388080c6 | 167 | |
smejky | 11:4ca8388080c6 | 168 | spi.fillrect(214,200,320,240,Black); |
smejky | 11:4ca8388080c6 | 169 | spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy);//pravy spodni |
smejky | 11:4ca8388080c6 | 170 | |
smejky | 2:0629f1ddaa92 | 171 | } |
smejky | 2:0629f1ddaa92 | 172 | } |
smejky | 2:0629f1ddaa92 | 173 | |
smejky | 2:0629f1ddaa92 | 174 | void malovani(){ |
smejky | 2:0629f1ddaa92 | 175 | |
smejky | 1:4dd546219e30 | 176 | while(1==1) |
smejky | 1:4dd546219e30 | 177 | { |
smejky | 0:6abf63b83992 | 178 | if (touch.DataAvailable()) |
smejky | 0:6abf63b83992 | 179 | { |
smejky | 0:6abf63b83992 | 180 | if(touch.Read()) |
smejky | 0:6abf63b83992 | 181 | { |
smejky | 0:6abf63b83992 | 182 | unsigned short int touch_y = touch.GetX(); |
smejky | 1:4dd546219e30 | 183 | unsigned short int touch_x = touch.GetY(); |
smejky | 0:6abf63b83992 | 184 | touch_x = touch_x - 10; |
smejky | 2:0629f1ddaa92 | 185 | touch_y = touch_y + 10; |
smejky | 2:0629f1ddaa92 | 186 | spi.pixel(touch_x,touch_y,Blue); |
smejky | 2:0629f1ddaa92 | 187 | } |
smejky | 2:0629f1ddaa92 | 188 | } |
smejky | 2:0629f1ddaa92 | 189 | } |
smejky | 2:0629f1ddaa92 | 190 | } |
smejky | 2:0629f1ddaa92 | 191 | |
smejky | 5:7c757a7c97c5 | 192 | /* |
smejky | 5:7c757a7c97c5 | 193 | else if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy [1])){ |
smejky | 5:7c757a7c97c5 | 194 | R_is_pressed = 1; |
smejky | 5:7c757a7c97c5 | 195 | spi.fillrect(pravy[0],pravy[1],pravy[2],pravy[3],pravy[4]); |
smejky | 5:7c757a7c97c5 | 196 | wait(0.1); |
smejky | 5:7c757a7c97c5 | 197 | } |
smejky | 5:7c757a7c97c5 | 198 | |
smejky | 5:7c757a7c97c5 | 199 | */ |
smejky | 5:7c757a7c97c5 | 200 | |
smejky | 5:7c757a7c97c5 | 201 | |
smejky | 5:7c757a7c97c5 | 202 | |
smejky | 7:91b982ccf255 | 203 | |
smejky | 7:91b982ccf255 | 204 | |
smejky | 7:91b982ccf255 | 205 | void Button(int strana = 0){ |
smejky | 7:91b982ccf255 | 206 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 9:d1385f7171af | 207 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 4:c7ca936cdd1f | 208 | //int cudlik[] = {20,80,42,130,Orange}; //slider nepovedeny projekt |
smejky | 4:c7ca936cdd1f | 209 | //int stred_cudliku[] = {30,105,Blue}; //střed čudliku |
smejky | 11:4ca8388080c6 | 210 | int spodni_levy[] = {200,214,240,320}; // pravy spodni cudlik |
smejky | 11:4ca8388080c6 | 211 | int stredni_levy[] = {200,107,240,213}; //stred spodni cudlik |
smejky | 11:4ca8388080c6 | 212 | int stredni_pravy[] = {200,0,240,106}; //stred levy spodni cudlik |
smejky | 7:91b982ccf255 | 213 | |
smejky | 7:91b982ccf255 | 214 | int cudlik_1[] = {10,213,58,260}; |
smejky | 8:b6e7401fdcfc | 215 | int cudlik_2[] = {10,137,58,184}; |
smejky | 12:9bc02f9e16e3 | 216 | int cudlik_3[] = {10,60,58,107}; |
smejky | 12:9bc02f9e16e3 | 217 | int cudlik_4[] = {76,213,123,260}; |
smejky | 12:9bc02f9e16e3 | 218 | int cudlik_5[] = {76,137,123,184}; |
smejky | 7:91b982ccf255 | 219 | |
smejky | 9:d1385f7171af | 220 | |
smejky | 3:dadb214885c1 | 221 | while(1) |
smejky | 2:0629f1ddaa92 | 222 | { |
smejky | 2:0629f1ddaa92 | 223 | if (touch.DataAvailable()) |
smejky | 2:0629f1ddaa92 | 224 | { |
smejky | 2:0629f1ddaa92 | 225 | if(touch.Read()) |
smejky | 2:0629f1ddaa92 | 226 | { |
smejky | 5:7c757a7c97c5 | 227 | |
smejky | 5:7c757a7c97c5 | 228 | |
smejky | 3:dadb214885c1 | 229 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 3:dadb214885c1 | 230 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 3:dadb214885c1 | 231 | touch_x = touch_x - 5; |
smejky | 2:0629f1ddaa92 | 232 | touch_y = touch_y + 10; |
smejky | 3:dadb214885c1 | 233 | //spi.pixel(touch_x,touch_y,Blue); |
smejky | 5:7c757a7c97c5 | 234 | //printf("x %d ,y %d\r\n",touch_x,touch_y); |
smejky | 3:dadb214885c1 | 235 | |
smejky | 3:dadb214885c1 | 236 | //pravý čudlik |
smejky | 5:7c757a7c97c5 | 237 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 7:91b982ccf255 | 238 | int m = strana; |
smejky | 7:91b982ccf255 | 239 | switch(strana){ |
smejky | 7:91b982ccf255 | 240 | case 0: |
smejky | 7:91b982ccf255 | 241 | m++; |
smejky | 7:91b982ccf255 | 242 | break; |
smejky | 7:91b982ccf255 | 243 | case 1: |
smejky | 7:91b982ccf255 | 244 | m++; |
smejky | 7:91b982ccf255 | 245 | break; |
smejky | 7:91b982ccf255 | 246 | default: |
smejky | 7:91b982ccf255 | 247 | m = 0; |
smejky | 7:91b982ccf255 | 248 | } |
smejky | 7:91b982ccf255 | 249 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 250 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 9:d1385f7171af | 251 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc_s); |
smejky | 9:d1385f7171af | 252 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 253 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 7:91b982ccf255 | 254 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 255 | hold(); |
smejky | 5:7c757a7c97c5 | 256 | grafika(1); |
smejky | 7:91b982ccf255 | 257 | Menu(m); |
smejky | 5:7c757a7c97c5 | 258 | } |
smejky | 5:7c757a7c97c5 | 259 | |
smejky | 3:dadb214885c1 | 260 | //pravý čudlik |
smejky | 3:dadb214885c1 | 261 | |
smejky | 4:c7ca936cdd1f | 262 | //levý čudlik |
smejky | 5:7c757a7c97c5 | 263 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 7:91b982ccf255 | 264 | int m = strana; |
smejky | 7:91b982ccf255 | 265 | switch(strana){ |
smejky | 7:91b982ccf255 | 266 | case 1: |
smejky | 7:91b982ccf255 | 267 | m--; |
smejky | 7:91b982ccf255 | 268 | break; |
smejky | 7:91b982ccf255 | 269 | default: |
smejky | 8:b6e7401fdcfc | 270 | m = 1; |
smejky | 7:91b982ccf255 | 271 | } |
smejky | 7:91b982ccf255 | 272 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 273 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 9:d1385f7171af | 274 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik_s);// levy |
smejky | 9:d1385f7171af | 275 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 276 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 7:91b982ccf255 | 277 | //GRAFIKA************************************************** |
smejky | 7:91b982ccf255 | 278 | |
smejky | 9:d1385f7171af | 279 | hold(); |
smejky | 5:7c757a7c97c5 | 280 | grafika(2); |
smejky | 11:4ca8388080c6 | 281 | |
smejky | 7:91b982ccf255 | 282 | Menu(m); |
smejky | 5:7c757a7c97c5 | 283 | } |
smejky | 3:dadb214885c1 | 284 | //levý čudlik |
smejky | 4:c7ca936cdd1f | 285 | |
smejky | 4:c7ca936cdd1f | 286 | //levý spodni čudlik |
smejky | 5:7c757a7c97c5 | 287 | if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ |
smejky | 11:4ca8388080c6 | 288 | spi.fillrect(0,200,106,240,Select); |
smejky | 11:4ca8388080c6 | 289 | spi.Bitmap(13,200,80,40,(unsigned char*)gImage_spodni_levy_s); |
smejky | 9:d1385f7171af | 290 | |
smejky | 9:d1385f7171af | 291 | hold(); |
smejky | 9:d1385f7171af | 292 | |
smejky | 9:d1385f7171af | 293 | grafika(9); |
smejky | 11:4ca8388080c6 | 294 | grafika(3); |
smejky | 9:d1385f7171af | 295 | grafika(7); |
smejky | 9:d1385f7171af | 296 | nastaveni(); |
smejky | 11:4ca8388080c6 | 297 | |
smejky | 5:7c757a7c97c5 | 298 | } |
smejky | 4:c7ca936cdd1f | 299 | //levý spodni čudlik |
smejky | 3:dadb214885c1 | 300 | |
smejky | 4:c7ca936cdd1f | 301 | |
smejky | 4:c7ca936cdd1f | 302 | //stred levy spodni cudlik |
smejky | 5:7c757a7c97c5 | 303 | if ((touch_x > stredni_levy[0]) && (touch_x < stredni_levy[2]) && (touch_y < stredni_levy[3]) && (touch_y > stredni_levy[1])){ |
smejky | 9:d1385f7171af | 304 | |
smejky | 11:4ca8388080c6 | 305 | spi.fillrect(107,200,213,240,Select); |
smejky | 11:4ca8388080c6 | 306 | spi.Bitmap(120,200,80,40,(unsigned char*)gImage_stredni_levy_s); |
smejky | 9:d1385f7171af | 307 | |
smejky | 7:91b982ccf255 | 308 | |
smejky | 11:4ca8388080c6 | 309 | on_off(); |
smejky | 7:91b982ccf255 | 310 | |
smejky | 9:d1385f7171af | 311 | hold(); |
smejky | 5:7c757a7c97c5 | 312 | grafika(4); |
smejky | 11:4ca8388080c6 | 313 | |
smejky | 5:7c757a7c97c5 | 314 | } |
smejky | 4:c7ca936cdd1f | 315 | //stred levy spodni cudlik |
smejky | 4:c7ca936cdd1f | 316 | |
smejky | 4:c7ca936cdd1f | 317 | |
smejky | 4:c7ca936cdd1f | 318 | //stred pravy spodni cudlik |
smejky | 5:7c757a7c97c5 | 319 | if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){ |
smejky | 11:4ca8388080c6 | 320 | spi.fillrect(214,200,320,240,Select); |
smejky | 11:4ca8388080c6 | 321 | spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s); |
smejky | 11:4ca8388080c6 | 322 | hold(); |
smejky | 12:9bc02f9e16e3 | 323 | grafika(5); |
smejky | 12:9bc02f9e16e3 | 324 | Menu(1); |
smejky | 11:4ca8388080c6 | 325 | |
smejky | 5:7c757a7c97c5 | 326 | } |
smejky | 4:c7ca936cdd1f | 327 | //stred pravy spodni cudlik |
smejky | 7:91b982ccf255 | 328 | |
smejky | 7:91b982ccf255 | 329 | //MENU CUDLIKY********************************************************************************************************************************************************************************** |
smejky | 7:91b982ccf255 | 330 | //prvni |
smejky | 8:b6e7401fdcfc | 331 | if ((touch_x > cudlik_1[0]) && (touch_x < cudlik_1[2]) && (touch_y < cudlik_1[3]) && (touch_y > cudlik_1[1]) && (strana == 1)){ |
smejky | 9:d1385f7171af | 332 | spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1s_vrch); |
smejky | 9:d1385f7171af | 333 | spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1s_spodek); |
smejky | 9:d1385f7171af | 334 | hold(); |
smejky | 9:d1385f7171af | 335 | spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch); |
smejky | 9:d1385f7171af | 336 | spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 10:0176705be216 | 337 | wait(0.2); |
smejky | 10:0176705be216 | 338 | grafika(7); |
smejky | 10:0176705be216 | 339 | grafika(9); |
smejky | 8:b6e7401fdcfc | 340 | Static(); |
smejky | 7:91b982ccf255 | 341 | } |
smejky | 7:91b982ccf255 | 342 | |
smejky | 7:91b982ccf255 | 343 | |
smejky | 7:91b982ccf255 | 344 | //prvni |
smejky | 8:b6e7401fdcfc | 345 | //druhy |
smejky | 8:b6e7401fdcfc | 346 | if ((touch_x > cudlik_2[0]) && (touch_x < cudlik_2[2]) && (touch_y < cudlik_2[3]) && (touch_y > cudlik_2[1]) && (strana == 1)){ |
smejky | 12:9bc02f9e16e3 | 347 | spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2s_vrch); |
smejky | 12:9bc02f9e16e3 | 348 | spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2s_spodek); |
smejky | 9:d1385f7171af | 349 | hold(); |
smejky | 12:9bc02f9e16e3 | 350 | spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2_vrch); |
smejky | 12:9bc02f9e16e3 | 351 | spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2_spodek); |
smejky | 12:9bc02f9e16e3 | 352 | grafika(7); |
smejky | 12:9bc02f9e16e3 | 353 | grafika(9); |
smejky | 12:9bc02f9e16e3 | 354 | set_fadeinout(); |
smejky | 8:b6e7401fdcfc | 355 | wait(0.2); |
smejky | 8:b6e7401fdcfc | 356 | |
smejky | 8:b6e7401fdcfc | 357 | } |
smejky | 8:b6e7401fdcfc | 358 | |
smejky | 8:b6e7401fdcfc | 359 | |
smejky | 8:b6e7401fdcfc | 360 | //druhy |
smejky | 12:9bc02f9e16e3 | 361 | //treti |
smejky | 12:9bc02f9e16e3 | 362 | if ((touch_x > cudlik_3[0]) && (touch_x < cudlik_3[2]) && (touch_y < cudlik_3[3]) && (touch_y > cudlik_3[1]) && (strana == 1)){ |
smejky | 12:9bc02f9e16e3 | 363 | spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3s_vrch); |
smejky | 12:9bc02f9e16e3 | 364 | spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3s_spodek); |
smejky | 12:9bc02f9e16e3 | 365 | hold(); |
smejky | 12:9bc02f9e16e3 | 366 | spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3_vrch); |
smejky | 12:9bc02f9e16e3 | 367 | spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3_spodek); |
smejky | 12:9bc02f9e16e3 | 368 | grafika(7); |
smejky | 12:9bc02f9e16e3 | 369 | grafika(9); |
smejky | 12:9bc02f9e16e3 | 370 | set_rainbow(); |
smejky | 12:9bc02f9e16e3 | 371 | wait(0.2); |
smejky | 12:9bc02f9e16e3 | 372 | |
smejky | 12:9bc02f9e16e3 | 373 | } |
smejky | 12:9bc02f9e16e3 | 374 | |
smejky | 12:9bc02f9e16e3 | 375 | |
smejky | 12:9bc02f9e16e3 | 376 | //treti |
smejky | 12:9bc02f9e16e3 | 377 | //ctvrty |
smejky | 12:9bc02f9e16e3 | 378 | if ((touch_x > cudlik_4[0]) && (touch_x < cudlik_4[2]) && (touch_y < cudlik_4[3]) && (touch_y > cudlik_4[1]) && (strana == 1)){ |
smejky | 12:9bc02f9e16e3 | 379 | spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4s_vrch); |
smejky | 12:9bc02f9e16e3 | 380 | spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4s_spodek); |
smejky | 12:9bc02f9e16e3 | 381 | hold(); |
smejky | 12:9bc02f9e16e3 | 382 | spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch); |
smejky | 12:9bc02f9e16e3 | 383 | spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek); |
smejky | 12:9bc02f9e16e3 | 384 | grafika(7); |
smejky | 12:9bc02f9e16e3 | 385 | grafika(9); |
smejky | 12:9bc02f9e16e3 | 386 | set_flash(); |
smejky | 12:9bc02f9e16e3 | 387 | wait(0.2); |
smejky | 12:9bc02f9e16e3 | 388 | |
smejky | 12:9bc02f9e16e3 | 389 | } |
smejky | 12:9bc02f9e16e3 | 390 | |
smejky | 12:9bc02f9e16e3 | 391 | |
smejky | 12:9bc02f9e16e3 | 392 | //ctvrty |
smejky | 12:9bc02f9e16e3 | 393 | //paty |
smejky | 12:9bc02f9e16e3 | 394 | if ((touch_x > cudlik_5[0]) && (touch_x < cudlik_5[2]) && (touch_y < cudlik_5[3]) && (touch_y > cudlik_5[1]) && (strana == 1)){ |
smejky | 12:9bc02f9e16e3 | 395 | spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu_s); |
smejky | 12:9bc02f9e16e3 | 396 | spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1s_spodek); |
smejky | 12:9bc02f9e16e3 | 397 | hold(); |
smejky | 12:9bc02f9e16e3 | 398 | spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu); |
smejky | 12:9bc02f9e16e3 | 399 | spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 12:9bc02f9e16e3 | 400 | grafika(7); |
smejky | 12:9bc02f9e16e3 | 401 | grafika(9); |
smejky | 12:9bc02f9e16e3 | 402 | set_change(); |
smejky | 12:9bc02f9e16e3 | 403 | wait(0.2); |
smejky | 12:9bc02f9e16e3 | 404 | |
smejky | 12:9bc02f9e16e3 | 405 | } |
smejky | 12:9bc02f9e16e3 | 406 | |
smejky | 12:9bc02f9e16e3 | 407 | |
smejky | 12:9bc02f9e16e3 | 408 | //paty |
smejky | 1:4dd546219e30 | 409 | } |
smejky | 1:4dd546219e30 | 410 | } |
smejky | 1:4dd546219e30 | 411 | } |
smejky | 1:4dd546219e30 | 412 | } |
smejky | 0:6abf63b83992 | 413 | |
smejky | 0:6abf63b83992 | 414 | |
smejky | 0:6abf63b83992 | 415 | |
smejky | 2:0629f1ddaa92 | 416 | |
smejky | 7:91b982ccf255 | 417 | |
smejky | 8:b6e7401fdcfc | 418 | void Menu(int strana = 0){ |
smejky | 7:91b982ccf255 | 419 | switch(strana) |
smejky | 7:91b982ccf255 | 420 | { |
smejky | 7:91b982ccf255 | 421 | case 1: |
smejky | 9:d1385f7171af | 422 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 7:91b982ccf255 | 423 | |
smejky | 7:91b982ccf255 | 424 | |
smejky | 7:91b982ccf255 | 425 | //CUDLIKY******************************************************************************* |
smejky | 7:91b982ccf255 | 426 | //prvni rada |
smejky | 9:d1385f7171af | 427 | spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3_vrch); |
smejky | 9:d1385f7171af | 428 | spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3_spodek); |
smejky | 7:91b982ccf255 | 429 | |
smejky | 9:d1385f7171af | 430 | spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2_vrch); |
smejky | 9:d1385f7171af | 431 | spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2_spodek); |
smejky | 8:b6e7401fdcfc | 432 | |
smejky | 9:d1385f7171af | 433 | spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch); |
smejky | 9:d1385f7171af | 434 | spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 9:d1385f7171af | 435 | |
smejky | 7:91b982ccf255 | 436 | //prvni rada |
smejky | 7:91b982ccf255 | 437 | |
smejky | 7:91b982ccf255 | 438 | //druha rada |
smejky | 12:9bc02f9e16e3 | 439 | //spi.Bitmap(213,76,48,24,(unsigned char*)gImage_cudlik1_vrch); |
smejky | 12:9bc02f9e16e3 | 440 | //spi.Bitmap(213,100,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 7:91b982ccf255 | 441 | |
smejky | 12:9bc02f9e16e3 | 442 | spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu); |
smejky | 9:d1385f7171af | 443 | spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 7:91b982ccf255 | 444 | |
smejky | 9:d1385f7171af | 445 | spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch); |
smejky | 9:d1385f7171af | 446 | spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek); |
smejky | 7:91b982ccf255 | 447 | // druha rada |
smejky | 12:9bc02f9e16e3 | 448 | /* |
smejky | 7:91b982ccf255 | 449 | //treti rada |
smejky | 9:d1385f7171af | 450 | spi.Bitmap(213,142,48,24,(unsigned char*)gImage_cudlik1_vrch); |
smejky | 9:d1385f7171af | 451 | spi.Bitmap(213,166,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 7:91b982ccf255 | 452 | |
smejky | 9:d1385f7171af | 453 | spi.Bitmap(137,142,48,24,(unsigned char*)gImage_cudlik1_vrch); |
smejky | 9:d1385f7171af | 454 | spi.Bitmap(137,166,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 7:91b982ccf255 | 455 | |
smejky | 9:d1385f7171af | 456 | spi.Bitmap(60,142,48,24,(unsigned char*)gImage_cudlik1_vrch); |
smejky | 9:d1385f7171af | 457 | spi.Bitmap(60,166,48,24,(unsigned char*)gImage_cudlik1_spodek); |
smejky | 7:91b982ccf255 | 458 | // treti rada |
smejky | 7:91b982ccf255 | 459 | |
smejky | 12:9bc02f9e16e3 | 460 | */ |
smejky | 12:9bc02f9e16e3 | 461 | |
smejky | 7:91b982ccf255 | 462 | //CUDLIKY******************************************************************************* |
smejky | 8:b6e7401fdcfc | 463 | |
smejky | 8:b6e7401fdcfc | 464 | strana = 1; |
smejky | 8:b6e7401fdcfc | 465 | Button(strana); |
smejky | 8:b6e7401fdcfc | 466 | |
smejky | 8:b6e7401fdcfc | 467 | break; |
smejky | 7:91b982ccf255 | 468 | default: |
smejky | 9:d1385f7171af | 469 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 7:91b982ccf255 | 470 | strana = 0; |
smejky | 7:91b982ccf255 | 471 | Button(strana); |
smejky | 7:91b982ccf255 | 472 | } |
smejky | 7:91b982ccf255 | 473 | } |
smejky | 7:91b982ccf255 | 474 | |
smejky | 8:b6e7401fdcfc | 475 | void Static(){ |
smejky | 12:9bc02f9e16e3 | 476 | |
smejky | 12:9bc02f9e16e3 | 477 | |
smejky | 11:4ca8388080c6 | 478 | int green1[] = {109,40,212,143}; |
smejky | 11:4ca8388080c6 | 479 | int green[] = {40,109,143,212}; |
smejky | 9:d1385f7171af | 480 | |
smejky | 12:9bc02f9e16e3 | 481 | int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik |
smejky | 8:b6e7401fdcfc | 482 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 8:b6e7401fdcfc | 483 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 8:b6e7401fdcfc | 484 | |
smejky | 9:d1385f7171af | 485 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 11:4ca8388080c6 | 486 | |
smejky | 11:4ca8388080c6 | 487 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],White); |
smejky | 11:4ca8388080c6 | 488 | |
smejky | 11:4ca8388080c6 | 489 | int color_pick = White; |
smejky | 8:b6e7401fdcfc | 490 | |
smejky | 12:9bc02f9e16e3 | 491 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 492 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 493 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 494 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 495 | spi.printf(jazyk[3]); |
smejky | 8:b6e7401fdcfc | 496 | while(1) |
smejky | 8:b6e7401fdcfc | 497 | { |
smejky | 8:b6e7401fdcfc | 498 | if (touch.DataAvailable()) |
smejky | 8:b6e7401fdcfc | 499 | { |
smejky | 8:b6e7401fdcfc | 500 | if(touch.Read()) |
smejky | 8:b6e7401fdcfc | 501 | { |
smejky | 8:b6e7401fdcfc | 502 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 8:b6e7401fdcfc | 503 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 8:b6e7401fdcfc | 504 | |
smejky | 8:b6e7401fdcfc | 505 | //pravý čudlik |
smejky | 8:b6e7401fdcfc | 506 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 9:d1385f7171af | 507 | |
smejky | 8:b6e7401fdcfc | 508 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 509 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 10:0176705be216 | 510 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 9:d1385f7171af | 511 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 512 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 8:b6e7401fdcfc | 513 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 514 | hold(); |
smejky | 11:4ca8388080c6 | 515 | thread.terminate(); |
smejky | 11:4ca8388080c6 | 516 | switch (color_pick){ |
smejky | 11:4ca8388080c6 | 517 | case Red: |
smejky | 11:4ca8388080c6 | 518 | send_color(255,0,0,led_jas); |
smejky | 11:4ca8388080c6 | 519 | break; |
smejky | 11:4ca8388080c6 | 520 | case Orange: |
smejky | 11:4ca8388080c6 | 521 | send_color(255,128,0,led_jas); |
smejky | 11:4ca8388080c6 | 522 | break; |
smejky | 11:4ca8388080c6 | 523 | case Yellow: |
smejky | 11:4ca8388080c6 | 524 | send_color(255,255,0,led_jas); |
smejky | 11:4ca8388080c6 | 525 | break; |
smejky | 11:4ca8388080c6 | 526 | case GreenYellow: |
smejky | 11:4ca8388080c6 | 527 | send_color(127,255,0,led_jas); |
smejky | 11:4ca8388080c6 | 528 | break; |
smejky | 11:4ca8388080c6 | 529 | case Green: |
smejky | 11:4ca8388080c6 | 530 | send_color(0,255,0,led_jas); |
smejky | 11:4ca8388080c6 | 531 | break; |
smejky | 11:4ca8388080c6 | 532 | case White: |
smejky | 11:4ca8388080c6 | 533 | send_color(255,255,255,led_jas); |
smejky | 11:4ca8388080c6 | 534 | break; |
smejky | 11:4ca8388080c6 | 535 | case Cyan: |
smejky | 11:4ca8388080c6 | 536 | send_color(0,255,255,led_jas); |
smejky | 11:4ca8388080c6 | 537 | break; |
smejky | 11:4ca8388080c6 | 538 | case DarkCyan: |
smejky | 11:4ca8388080c6 | 539 | send_color(0,127,255,led_jas); |
smejky | 11:4ca8388080c6 | 540 | break; |
smejky | 11:4ca8388080c6 | 541 | case Blue: |
smejky | 11:4ca8388080c6 | 542 | send_color(0,0,255,led_jas); |
smejky | 11:4ca8388080c6 | 543 | break; |
smejky | 11:4ca8388080c6 | 544 | case Purple: |
smejky | 11:4ca8388080c6 | 545 | send_color(127,0,255,led_jas); |
smejky | 11:4ca8388080c6 | 546 | break; |
smejky | 11:4ca8388080c6 | 547 | case Magenta: |
smejky | 11:4ca8388080c6 | 548 | send_color(255,0,255,led_jas); |
smejky | 11:4ca8388080c6 | 549 | break; |
smejky | 11:4ca8388080c6 | 550 | case Pink: |
smejky | 11:4ca8388080c6 | 551 | send_color(255,0,127,led_jas); |
smejky | 11:4ca8388080c6 | 552 | break; |
smejky | 11:4ca8388080c6 | 553 | default: |
smejky | 12:9bc02f9e16e3 | 554 | send_color(0,0,0,led_jas); |
smejky | 11:4ca8388080c6 | 555 | } |
smejky | 11:4ca8388080c6 | 556 | |
smejky | 12:9bc02f9e16e3 | 557 | grafika(); |
smejky | 12:9bc02f9e16e3 | 558 | Menu(); |
smejky | 12:9bc02f9e16e3 | 559 | } |
smejky | 12:9bc02f9e16e3 | 560 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 561 | |
smejky | 12:9bc02f9e16e3 | 562 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 563 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 12:9bc02f9e16e3 | 564 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 565 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 566 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 12:9bc02f9e16e3 | 567 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 568 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 569 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 570 | |
smejky | 12:9bc02f9e16e3 | 571 | hold(); |
smejky | 12:9bc02f9e16e3 | 572 | grafika(); |
smejky | 12:9bc02f9e16e3 | 573 | Menu(); |
smejky | 12:9bc02f9e16e3 | 574 | } |
smejky | 12:9bc02f9e16e3 | 575 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 576 | |
smejky | 12:9bc02f9e16e3 | 577 | |
smejky | 12:9bc02f9e16e3 | 578 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 579 | if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ |
smejky | 12:9bc02f9e16e3 | 580 | spi.fillrect(0,200,320,240,Select); |
smejky | 12:9bc02f9e16e3 | 581 | |
smejky | 12:9bc02f9e16e3 | 582 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 583 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 584 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 585 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 586 | |
smejky | 12:9bc02f9e16e3 | 587 | hold(); |
smejky | 12:9bc02f9e16e3 | 588 | led_jas = brightness_led(); |
smejky | 12:9bc02f9e16e3 | 589 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 590 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick); |
smejky | 12:9bc02f9e16e3 | 591 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 592 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 593 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 594 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 595 | } |
smejky | 12:9bc02f9e16e3 | 596 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 597 | |
smejky | 12:9bc02f9e16e3 | 598 | if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){ |
smejky | 12:9bc02f9e16e3 | 599 | hold(); |
smejky | 12:9bc02f9e16e3 | 600 | color_pick = color_picker(); |
smejky | 12:9bc02f9e16e3 | 601 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 602 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick); |
smejky | 12:9bc02f9e16e3 | 603 | } |
smejky | 12:9bc02f9e16e3 | 604 | } |
smejky | 12:9bc02f9e16e3 | 605 | } |
smejky | 12:9bc02f9e16e3 | 606 | } |
smejky | 12:9bc02f9e16e3 | 607 | |
smejky | 12:9bc02f9e16e3 | 608 | } |
smejky | 12:9bc02f9e16e3 | 609 | |
smejky | 12:9bc02f9e16e3 | 610 | |
smejky | 12:9bc02f9e16e3 | 611 | |
smejky | 12:9bc02f9e16e3 | 612 | void set_fadeinout(){ |
smejky | 12:9bc02f9e16e3 | 613 | |
smejky | 12:9bc02f9e16e3 | 614 | int pole3[] = {213,76,260,124}; |
smejky | 12:9bc02f9e16e3 | 615 | int pole2[] = {137,76,184,124}; |
smejky | 12:9bc02f9e16e3 | 616 | int pole1[] = {60,76,107,124}; |
smejky | 12:9bc02f9e16e3 | 617 | |
smejky | 12:9bc02f9e16e3 | 618 | int pole1_t[] = {76,213,124,260}; |
smejky | 12:9bc02f9e16e3 | 619 | int pole2_t[] = {76,137,124,184}; |
smejky | 12:9bc02f9e16e3 | 620 | int pole3_t[] = {76,60,124,107}; |
smejky | 12:9bc02f9e16e3 | 621 | |
smejky | 12:9bc02f9e16e3 | 622 | int pick_time_t[] = {142,137,189,184}; |
smejky | 12:9bc02f9e16e3 | 623 | |
smejky | 12:9bc02f9e16e3 | 624 | int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik |
smejky | 12:9bc02f9e16e3 | 625 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 12:9bc02f9e16e3 | 626 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 12:9bc02f9e16e3 | 627 | |
smejky | 12:9bc02f9e16e3 | 628 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 629 | |
smejky | 12:9bc02f9e16e3 | 630 | int color_pick1 = Black; |
smejky | 12:9bc02f9e16e3 | 631 | int color_pick2 = Black; |
smejky | 12:9bc02f9e16e3 | 632 | int color_pick3 = Black; |
smejky | 12:9bc02f9e16e3 | 633 | |
smejky | 12:9bc02f9e16e3 | 634 | int time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 635 | float rychlost_tady = 0.01; |
smejky | 12:9bc02f9e16e3 | 636 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 637 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 638 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 639 | |
smejky | 12:9bc02f9e16e3 | 640 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 641 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 642 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 643 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 644 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 645 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 646 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 647 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 648 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 649 | while(1) |
smejky | 12:9bc02f9e16e3 | 650 | { |
smejky | 12:9bc02f9e16e3 | 651 | if (touch.DataAvailable()) |
smejky | 12:9bc02f9e16e3 | 652 | { |
smejky | 12:9bc02f9e16e3 | 653 | if(touch.Read()) |
smejky | 12:9bc02f9e16e3 | 654 | { |
smejky | 12:9bc02f9e16e3 | 655 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 12:9bc02f9e16e3 | 656 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 12:9bc02f9e16e3 | 657 | |
smejky | 12:9bc02f9e16e3 | 658 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 659 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 12:9bc02f9e16e3 | 660 | |
smejky | 12:9bc02f9e16e3 | 661 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 662 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 663 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 12:9bc02f9e16e3 | 664 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 665 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 666 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 667 | hold(); |
smejky | 12:9bc02f9e16e3 | 668 | thread.terminate(); |
smejky | 12:9bc02f9e16e3 | 669 | int p = 0; |
smejky | 12:9bc02f9e16e3 | 670 | while(p < 9){ |
smejky | 12:9bc02f9e16e3 | 671 | barvy[p] = 0; |
smejky | 12:9bc02f9e16e3 | 672 | p++; |
smejky | 12:9bc02f9e16e3 | 673 | } |
smejky | 12:9bc02f9e16e3 | 674 | rychlost = rychlost_tady; |
smejky | 12:9bc02f9e16e3 | 675 | switch (color_pick1){ |
smejky | 12:9bc02f9e16e3 | 676 | case Red: |
smejky | 12:9bc02f9e16e3 | 677 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 678 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 679 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 680 | break; |
smejky | 12:9bc02f9e16e3 | 681 | case Orange: |
smejky | 12:9bc02f9e16e3 | 682 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 683 | barvy[1] = 128; |
smejky | 12:9bc02f9e16e3 | 684 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 685 | break; |
smejky | 12:9bc02f9e16e3 | 686 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 687 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 688 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 689 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 690 | break; |
smejky | 12:9bc02f9e16e3 | 691 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 692 | barvy[0] = 128; |
smejky | 12:9bc02f9e16e3 | 693 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 694 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 695 | break; |
smejky | 12:9bc02f9e16e3 | 696 | case Green: |
smejky | 12:9bc02f9e16e3 | 697 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 698 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 699 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 700 | break; |
smejky | 12:9bc02f9e16e3 | 701 | case White: |
smejky | 12:9bc02f9e16e3 | 702 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 703 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 704 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 705 | break; |
smejky | 12:9bc02f9e16e3 | 706 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 707 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 708 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 709 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 710 | break; |
smejky | 12:9bc02f9e16e3 | 711 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 712 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 713 | barvy[1] = 127; |
smejky | 12:9bc02f9e16e3 | 714 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 715 | break; |
smejky | 12:9bc02f9e16e3 | 716 | case Blue: |
smejky | 12:9bc02f9e16e3 | 717 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 718 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 719 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 720 | break; |
smejky | 12:9bc02f9e16e3 | 721 | case Purple: |
smejky | 12:9bc02f9e16e3 | 722 | barvy[0] = 128; |
smejky | 12:9bc02f9e16e3 | 723 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 724 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 725 | break; |
smejky | 12:9bc02f9e16e3 | 726 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 727 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 728 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 729 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 730 | break; |
smejky | 12:9bc02f9e16e3 | 731 | case Pink: |
smejky | 12:9bc02f9e16e3 | 732 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 733 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 734 | barvy[2] = 127; |
smejky | 12:9bc02f9e16e3 | 735 | break; |
smejky | 12:9bc02f9e16e3 | 736 | default: |
smejky | 12:9bc02f9e16e3 | 737 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 738 | } |
smejky | 12:9bc02f9e16e3 | 739 | switch (color_pick2){ |
smejky | 12:9bc02f9e16e3 | 740 | case Red: |
smejky | 12:9bc02f9e16e3 | 741 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 742 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 743 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 744 | |
smejky | 12:9bc02f9e16e3 | 745 | break; |
smejky | 12:9bc02f9e16e3 | 746 | case Orange: |
smejky | 12:9bc02f9e16e3 | 747 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 748 | barvy[4] = 128; |
smejky | 12:9bc02f9e16e3 | 749 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 750 | |
smejky | 12:9bc02f9e16e3 | 751 | break; |
smejky | 12:9bc02f9e16e3 | 752 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 753 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 754 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 755 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 756 | |
smejky | 12:9bc02f9e16e3 | 757 | break; |
smejky | 12:9bc02f9e16e3 | 758 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 759 | barvy[3] = 128; |
smejky | 12:9bc02f9e16e3 | 760 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 761 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 762 | break; |
smejky | 12:9bc02f9e16e3 | 763 | case Green: |
smejky | 12:9bc02f9e16e3 | 764 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 765 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 766 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 767 | |
smejky | 12:9bc02f9e16e3 | 768 | break; |
smejky | 12:9bc02f9e16e3 | 769 | case White: |
smejky | 12:9bc02f9e16e3 | 770 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 771 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 772 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 773 | |
smejky | 12:9bc02f9e16e3 | 774 | break; |
smejky | 12:9bc02f9e16e3 | 775 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 776 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 777 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 778 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 779 | |
smejky | 12:9bc02f9e16e3 | 780 | break; |
smejky | 12:9bc02f9e16e3 | 781 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 782 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 783 | barvy[4] = 127; |
smejky | 12:9bc02f9e16e3 | 784 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 785 | |
smejky | 12:9bc02f9e16e3 | 786 | break; |
smejky | 12:9bc02f9e16e3 | 787 | case Blue: |
smejky | 12:9bc02f9e16e3 | 788 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 789 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 790 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 791 | |
smejky | 12:9bc02f9e16e3 | 792 | break; |
smejky | 12:9bc02f9e16e3 | 793 | case Purple: |
smejky | 12:9bc02f9e16e3 | 794 | barvy[3] = 128; |
smejky | 12:9bc02f9e16e3 | 795 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 796 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 797 | |
smejky | 12:9bc02f9e16e3 | 798 | break; |
smejky | 12:9bc02f9e16e3 | 799 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 800 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 801 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 802 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 803 | |
smejky | 12:9bc02f9e16e3 | 804 | break; |
smejky | 12:9bc02f9e16e3 | 805 | case Pink: |
smejky | 12:9bc02f9e16e3 | 806 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 807 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 808 | barvy[5] = 127; |
smejky | 12:9bc02f9e16e3 | 809 | |
smejky | 12:9bc02f9e16e3 | 810 | break; |
smejky | 12:9bc02f9e16e3 | 811 | default: |
smejky | 12:9bc02f9e16e3 | 812 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 813 | } |
smejky | 12:9bc02f9e16e3 | 814 | switch (color_pick3){ |
smejky | 12:9bc02f9e16e3 | 815 | case Red: |
smejky | 12:9bc02f9e16e3 | 816 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 817 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 818 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 819 | break; |
smejky | 12:9bc02f9e16e3 | 820 | case Orange: |
smejky | 12:9bc02f9e16e3 | 821 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 822 | barvy[7] = 128; |
smejky | 12:9bc02f9e16e3 | 823 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 824 | |
smejky | 12:9bc02f9e16e3 | 825 | break; |
smejky | 12:9bc02f9e16e3 | 826 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 827 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 828 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 829 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 830 | |
smejky | 12:9bc02f9e16e3 | 831 | break; |
smejky | 12:9bc02f9e16e3 | 832 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 833 | barvy[6] = 128; |
smejky | 12:9bc02f9e16e3 | 834 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 835 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 836 | |
smejky | 12:9bc02f9e16e3 | 837 | break; |
smejky | 12:9bc02f9e16e3 | 838 | case Green: |
smejky | 12:9bc02f9e16e3 | 839 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 840 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 841 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 842 | |
smejky | 12:9bc02f9e16e3 | 843 | break; |
smejky | 12:9bc02f9e16e3 | 844 | case White: |
smejky | 12:9bc02f9e16e3 | 845 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 846 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 847 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 848 | |
smejky | 12:9bc02f9e16e3 | 849 | break; |
smejky | 12:9bc02f9e16e3 | 850 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 851 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 852 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 853 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 854 | |
smejky | 12:9bc02f9e16e3 | 855 | break; |
smejky | 12:9bc02f9e16e3 | 856 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 857 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 858 | barvy[7] = 127; |
smejky | 12:9bc02f9e16e3 | 859 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 860 | |
smejky | 12:9bc02f9e16e3 | 861 | break; |
smejky | 12:9bc02f9e16e3 | 862 | case Blue: |
smejky | 12:9bc02f9e16e3 | 863 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 864 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 865 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 866 | |
smejky | 12:9bc02f9e16e3 | 867 | break; |
smejky | 12:9bc02f9e16e3 | 868 | case Purple: |
smejky | 12:9bc02f9e16e3 | 869 | barvy[6] = 128; |
smejky | 12:9bc02f9e16e3 | 870 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 871 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 872 | |
smejky | 12:9bc02f9e16e3 | 873 | break; |
smejky | 12:9bc02f9e16e3 | 874 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 875 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 876 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 877 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 878 | |
smejky | 12:9bc02f9e16e3 | 879 | break; |
smejky | 12:9bc02f9e16e3 | 880 | case Pink: |
smejky | 12:9bc02f9e16e3 | 881 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 882 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 883 | barvy[8] = 127; |
smejky | 12:9bc02f9e16e3 | 884 | |
smejky | 12:9bc02f9e16e3 | 885 | break; |
smejky | 12:9bc02f9e16e3 | 886 | default: |
smejky | 12:9bc02f9e16e3 | 887 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 888 | } |
smejky | 12:9bc02f9e16e3 | 889 | thread.start(fadeinout); |
smejky | 12:9bc02f9e16e3 | 890 | grafika(); |
smejky | 12:9bc02f9e16e3 | 891 | Menu(); |
smejky | 12:9bc02f9e16e3 | 892 | } |
smejky | 12:9bc02f9e16e3 | 893 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 894 | |
smejky | 12:9bc02f9e16e3 | 895 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 896 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 12:9bc02f9e16e3 | 897 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 898 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 899 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 12:9bc02f9e16e3 | 900 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 901 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 902 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 903 | |
smejky | 12:9bc02f9e16e3 | 904 | hold(); |
smejky | 12:9bc02f9e16e3 | 905 | grafika(); |
smejky | 12:9bc02f9e16e3 | 906 | Menu(); |
smejky | 12:9bc02f9e16e3 | 907 | } |
smejky | 12:9bc02f9e16e3 | 908 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 909 | |
smejky | 12:9bc02f9e16e3 | 910 | |
smejky | 12:9bc02f9e16e3 | 911 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 912 | if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ |
smejky | 12:9bc02f9e16e3 | 913 | spi.fillrect(0,200,320,240,Select); |
smejky | 12:9bc02f9e16e3 | 914 | |
smejky | 12:9bc02f9e16e3 | 915 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 916 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 917 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 918 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 919 | |
smejky | 12:9bc02f9e16e3 | 920 | hold(); |
smejky | 12:9bc02f9e16e3 | 921 | led_jas = brightness_led(); |
smejky | 12:9bc02f9e16e3 | 922 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 923 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 924 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 925 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 926 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 927 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 928 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 929 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 930 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 931 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 932 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 933 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 934 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 935 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 936 | } |
smejky | 12:9bc02f9e16e3 | 937 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 938 | |
smejky | 12:9bc02f9e16e3 | 939 | if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){ |
smejky | 12:9bc02f9e16e3 | 940 | hold(); |
smejky | 12:9bc02f9e16e3 | 941 | color_pick1 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 942 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 943 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 944 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 945 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 946 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 947 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 948 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 949 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 950 | } |
smejky | 12:9bc02f9e16e3 | 951 | |
smejky | 12:9bc02f9e16e3 | 952 | if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){ |
smejky | 12:9bc02f9e16e3 | 953 | hold(); |
smejky | 12:9bc02f9e16e3 | 954 | color_pick2 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 955 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 956 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 957 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 958 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 959 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 960 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 961 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 962 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 963 | } |
smejky | 12:9bc02f9e16e3 | 964 | |
smejky | 12:9bc02f9e16e3 | 965 | if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){ |
smejky | 12:9bc02f9e16e3 | 966 | hold(); |
smejky | 12:9bc02f9e16e3 | 967 | color_pick3 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 968 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 969 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 970 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 971 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 972 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 973 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 974 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 975 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 976 | } |
smejky | 12:9bc02f9e16e3 | 977 | |
smejky | 12:9bc02f9e16e3 | 978 | |
smejky | 12:9bc02f9e16e3 | 979 | 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])){ |
smejky | 12:9bc02f9e16e3 | 980 | spi.fillrect(137,142,184,189,Select); |
smejky | 12:9bc02f9e16e3 | 981 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 982 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 983 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 984 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 985 | hold(); |
smejky | 12:9bc02f9e16e3 | 986 | time_picked++; |
smejky | 12:9bc02f9e16e3 | 987 | switch(time_picked){ |
smejky | 12:9bc02f9e16e3 | 988 | case 1: |
smejky | 12:9bc02f9e16e3 | 989 | rychlost_tady = 0.01; |
smejky | 12:9bc02f9e16e3 | 990 | break; |
smejky | 12:9bc02f9e16e3 | 991 | case 2: |
smejky | 12:9bc02f9e16e3 | 992 | rychlost_tady = 0.03; |
smejky | 12:9bc02f9e16e3 | 993 | break; |
smejky | 12:9bc02f9e16e3 | 994 | case 3: |
smejky | 12:9bc02f9e16e3 | 995 | rychlost_tady = 0.06; |
smejky | 12:9bc02f9e16e3 | 996 | break; |
smejky | 12:9bc02f9e16e3 | 997 | case 4: |
smejky | 12:9bc02f9e16e3 | 998 | rychlost_tady = 0.1; |
smejky | 12:9bc02f9e16e3 | 999 | break; |
smejky | 12:9bc02f9e16e3 | 1000 | default: |
smejky | 12:9bc02f9e16e3 | 1001 | time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1002 | rychlost_tady = 0.01; |
smejky | 12:9bc02f9e16e3 | 1003 | } |
smejky | 12:9bc02f9e16e3 | 1004 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1005 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1006 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1007 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1008 | } |
smejky | 12:9bc02f9e16e3 | 1009 | } |
smejky | 12:9bc02f9e16e3 | 1010 | } |
smejky | 12:9bc02f9e16e3 | 1011 | } |
smejky | 12:9bc02f9e16e3 | 1012 | |
smejky | 12:9bc02f9e16e3 | 1013 | } |
smejky | 12:9bc02f9e16e3 | 1014 | |
smejky | 12:9bc02f9e16e3 | 1015 | void set_flash(){ |
smejky | 12:9bc02f9e16e3 | 1016 | |
smejky | 12:9bc02f9e16e3 | 1017 | int pole3[] = {213,76,260,124}; |
smejky | 12:9bc02f9e16e3 | 1018 | int pole2[] = {137,76,184,124}; |
smejky | 12:9bc02f9e16e3 | 1019 | int pole1[] = {60,76,107,124}; |
smejky | 12:9bc02f9e16e3 | 1020 | |
smejky | 12:9bc02f9e16e3 | 1021 | int pole1_t[] = {76,213,124,260}; |
smejky | 12:9bc02f9e16e3 | 1022 | int pole2_t[] = {76,137,124,184}; |
smejky | 12:9bc02f9e16e3 | 1023 | int pole3_t[] = {76,60,124,107}; |
smejky | 12:9bc02f9e16e3 | 1024 | |
smejky | 12:9bc02f9e16e3 | 1025 | int pick_time_t[] = {142,137,189,184}; |
smejky | 12:9bc02f9e16e3 | 1026 | |
smejky | 12:9bc02f9e16e3 | 1027 | int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik |
smejky | 12:9bc02f9e16e3 | 1028 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 12:9bc02f9e16e3 | 1029 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 12:9bc02f9e16e3 | 1030 | |
smejky | 12:9bc02f9e16e3 | 1031 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1032 | |
smejky | 12:9bc02f9e16e3 | 1033 | int color_pick1 = Black; |
smejky | 12:9bc02f9e16e3 | 1034 | int color_pick2 = Black; |
smejky | 12:9bc02f9e16e3 | 1035 | int color_pick3 = Black; |
smejky | 12:9bc02f9e16e3 | 1036 | |
smejky | 12:9bc02f9e16e3 | 1037 | int time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1038 | float rychlost_tady = 1; |
smejky | 12:9bc02f9e16e3 | 1039 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1040 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1041 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1042 | |
smejky | 12:9bc02f9e16e3 | 1043 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 1044 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1045 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1046 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1047 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1048 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1049 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1050 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1051 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1052 | while(1) |
smejky | 12:9bc02f9e16e3 | 1053 | { |
smejky | 12:9bc02f9e16e3 | 1054 | if (touch.DataAvailable()) |
smejky | 12:9bc02f9e16e3 | 1055 | { |
smejky | 12:9bc02f9e16e3 | 1056 | if(touch.Read()) |
smejky | 12:9bc02f9e16e3 | 1057 | { |
smejky | 12:9bc02f9e16e3 | 1058 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 12:9bc02f9e16e3 | 1059 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 12:9bc02f9e16e3 | 1060 | |
smejky | 12:9bc02f9e16e3 | 1061 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 1062 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 12:9bc02f9e16e3 | 1063 | |
smejky | 12:9bc02f9e16e3 | 1064 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1065 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 1066 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 12:9bc02f9e16e3 | 1067 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1068 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1069 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1070 | hold(); |
smejky | 12:9bc02f9e16e3 | 1071 | thread.terminate(); |
smejky | 12:9bc02f9e16e3 | 1072 | int p = 0; |
smejky | 12:9bc02f9e16e3 | 1073 | while(p < 9){ |
smejky | 12:9bc02f9e16e3 | 1074 | barvy[p] = 0; |
smejky | 12:9bc02f9e16e3 | 1075 | p++; |
smejky | 12:9bc02f9e16e3 | 1076 | } |
smejky | 12:9bc02f9e16e3 | 1077 | rychlost = rychlost_tady; |
smejky | 12:9bc02f9e16e3 | 1078 | switch (color_pick1){ |
smejky | 12:9bc02f9e16e3 | 1079 | case Red: |
smejky | 12:9bc02f9e16e3 | 1080 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1081 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1082 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1083 | break; |
smejky | 12:9bc02f9e16e3 | 1084 | case Orange: |
smejky | 12:9bc02f9e16e3 | 1085 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1086 | barvy[1] = 128; |
smejky | 12:9bc02f9e16e3 | 1087 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1088 | break; |
smejky | 12:9bc02f9e16e3 | 1089 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 1090 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1091 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1092 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1093 | break; |
smejky | 12:9bc02f9e16e3 | 1094 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 1095 | barvy[0] = 128; |
smejky | 12:9bc02f9e16e3 | 1096 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1097 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1098 | break; |
smejky | 12:9bc02f9e16e3 | 1099 | case Green: |
smejky | 12:9bc02f9e16e3 | 1100 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1101 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1102 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1103 | break; |
smejky | 12:9bc02f9e16e3 | 1104 | case White: |
smejky | 12:9bc02f9e16e3 | 1105 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1106 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1107 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1108 | break; |
smejky | 12:9bc02f9e16e3 | 1109 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 1110 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1111 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1112 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1113 | break; |
smejky | 12:9bc02f9e16e3 | 1114 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 1115 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1116 | barvy[1] = 127; |
smejky | 12:9bc02f9e16e3 | 1117 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1118 | break; |
smejky | 12:9bc02f9e16e3 | 1119 | case Blue: |
smejky | 12:9bc02f9e16e3 | 1120 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1121 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1122 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1123 | break; |
smejky | 12:9bc02f9e16e3 | 1124 | case Purple: |
smejky | 12:9bc02f9e16e3 | 1125 | barvy[0] = 128; |
smejky | 12:9bc02f9e16e3 | 1126 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1127 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1128 | break; |
smejky | 12:9bc02f9e16e3 | 1129 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 1130 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1131 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1132 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1133 | break; |
smejky | 12:9bc02f9e16e3 | 1134 | case Pink: |
smejky | 12:9bc02f9e16e3 | 1135 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1136 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1137 | barvy[2] = 127; |
smejky | 12:9bc02f9e16e3 | 1138 | break; |
smejky | 12:9bc02f9e16e3 | 1139 | default: |
smejky | 12:9bc02f9e16e3 | 1140 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 1141 | } |
smejky | 12:9bc02f9e16e3 | 1142 | switch (color_pick2){ |
smejky | 12:9bc02f9e16e3 | 1143 | case Red: |
smejky | 12:9bc02f9e16e3 | 1144 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1145 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1146 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1147 | |
smejky | 12:9bc02f9e16e3 | 1148 | break; |
smejky | 12:9bc02f9e16e3 | 1149 | case Orange: |
smejky | 12:9bc02f9e16e3 | 1150 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1151 | barvy[4] = 128; |
smejky | 12:9bc02f9e16e3 | 1152 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1153 | |
smejky | 12:9bc02f9e16e3 | 1154 | break; |
smejky | 12:9bc02f9e16e3 | 1155 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 1156 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1157 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1158 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1159 | |
smejky | 12:9bc02f9e16e3 | 1160 | break; |
smejky | 12:9bc02f9e16e3 | 1161 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 1162 | barvy[3] = 128; |
smejky | 12:9bc02f9e16e3 | 1163 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1164 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1165 | break; |
smejky | 12:9bc02f9e16e3 | 1166 | case Green: |
smejky | 12:9bc02f9e16e3 | 1167 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1168 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1169 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1170 | |
smejky | 12:9bc02f9e16e3 | 1171 | break; |
smejky | 12:9bc02f9e16e3 | 1172 | case White: |
smejky | 12:9bc02f9e16e3 | 1173 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1174 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1175 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1176 | |
smejky | 12:9bc02f9e16e3 | 1177 | break; |
smejky | 12:9bc02f9e16e3 | 1178 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 1179 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1180 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1181 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1182 | |
smejky | 12:9bc02f9e16e3 | 1183 | break; |
smejky | 12:9bc02f9e16e3 | 1184 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 1185 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1186 | barvy[4] = 127; |
smejky | 12:9bc02f9e16e3 | 1187 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1188 | |
smejky | 12:9bc02f9e16e3 | 1189 | break; |
smejky | 12:9bc02f9e16e3 | 1190 | case Blue: |
smejky | 12:9bc02f9e16e3 | 1191 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1192 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1193 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1194 | |
smejky | 12:9bc02f9e16e3 | 1195 | break; |
smejky | 12:9bc02f9e16e3 | 1196 | case Purple: |
smejky | 12:9bc02f9e16e3 | 1197 | barvy[3] = 128; |
smejky | 12:9bc02f9e16e3 | 1198 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1199 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1200 | |
smejky | 12:9bc02f9e16e3 | 1201 | break; |
smejky | 12:9bc02f9e16e3 | 1202 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 1203 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1204 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1205 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1206 | |
smejky | 12:9bc02f9e16e3 | 1207 | break; |
smejky | 12:9bc02f9e16e3 | 1208 | case Pink: |
smejky | 12:9bc02f9e16e3 | 1209 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1210 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1211 | barvy[5] = 127; |
smejky | 12:9bc02f9e16e3 | 1212 | |
smejky | 12:9bc02f9e16e3 | 1213 | break; |
smejky | 12:9bc02f9e16e3 | 1214 | default: |
smejky | 12:9bc02f9e16e3 | 1215 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 1216 | } |
smejky | 12:9bc02f9e16e3 | 1217 | switch (color_pick3){ |
smejky | 12:9bc02f9e16e3 | 1218 | case Red: |
smejky | 12:9bc02f9e16e3 | 1219 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1220 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1221 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1222 | break; |
smejky | 12:9bc02f9e16e3 | 1223 | case Orange: |
smejky | 12:9bc02f9e16e3 | 1224 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1225 | barvy[7] = 128; |
smejky | 12:9bc02f9e16e3 | 1226 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1227 | |
smejky | 12:9bc02f9e16e3 | 1228 | break; |
smejky | 12:9bc02f9e16e3 | 1229 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 1230 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1231 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1232 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1233 | |
smejky | 12:9bc02f9e16e3 | 1234 | break; |
smejky | 12:9bc02f9e16e3 | 1235 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 1236 | barvy[6] = 128; |
smejky | 12:9bc02f9e16e3 | 1237 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1238 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1239 | |
smejky | 12:9bc02f9e16e3 | 1240 | break; |
smejky | 12:9bc02f9e16e3 | 1241 | case Green: |
smejky | 12:9bc02f9e16e3 | 1242 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1243 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1244 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1245 | |
smejky | 12:9bc02f9e16e3 | 1246 | break; |
smejky | 12:9bc02f9e16e3 | 1247 | case White: |
smejky | 12:9bc02f9e16e3 | 1248 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1249 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1250 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1251 | |
smejky | 12:9bc02f9e16e3 | 1252 | break; |
smejky | 12:9bc02f9e16e3 | 1253 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 1254 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1255 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1256 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1257 | |
smejky | 12:9bc02f9e16e3 | 1258 | break; |
smejky | 12:9bc02f9e16e3 | 1259 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 1260 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1261 | barvy[7] = 127; |
smejky | 12:9bc02f9e16e3 | 1262 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1263 | |
smejky | 12:9bc02f9e16e3 | 1264 | break; |
smejky | 12:9bc02f9e16e3 | 1265 | case Blue: |
smejky | 12:9bc02f9e16e3 | 1266 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1267 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1268 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1269 | |
smejky | 12:9bc02f9e16e3 | 1270 | break; |
smejky | 12:9bc02f9e16e3 | 1271 | case Purple: |
smejky | 12:9bc02f9e16e3 | 1272 | barvy[6] = 128; |
smejky | 12:9bc02f9e16e3 | 1273 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1274 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1275 | |
smejky | 12:9bc02f9e16e3 | 1276 | break; |
smejky | 12:9bc02f9e16e3 | 1277 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 1278 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1279 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1280 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1281 | |
smejky | 12:9bc02f9e16e3 | 1282 | break; |
smejky | 12:9bc02f9e16e3 | 1283 | case Pink: |
smejky | 12:9bc02f9e16e3 | 1284 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1285 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1286 | barvy[8] = 127; |
smejky | 12:9bc02f9e16e3 | 1287 | |
smejky | 12:9bc02f9e16e3 | 1288 | break; |
smejky | 12:9bc02f9e16e3 | 1289 | default: |
smejky | 12:9bc02f9e16e3 | 1290 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 1291 | } |
smejky | 12:9bc02f9e16e3 | 1292 | thread.start(flash); |
smejky | 12:9bc02f9e16e3 | 1293 | grafika(); |
smejky | 8:b6e7401fdcfc | 1294 | Menu(); |
smejky | 8:b6e7401fdcfc | 1295 | } |
smejky | 8:b6e7401fdcfc | 1296 | //pravý čudlik |
smejky | 8:b6e7401fdcfc | 1297 | |
smejky | 8:b6e7401fdcfc | 1298 | //levý čudlik |
smejky | 8:b6e7401fdcfc | 1299 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 8:b6e7401fdcfc | 1300 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 1301 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 10:0176705be216 | 1302 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 9:d1385f7171af | 1303 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 1304 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 8:b6e7401fdcfc | 1305 | //GRAFIKA************************************************** |
smejky | 8:b6e7401fdcfc | 1306 | |
smejky | 9:d1385f7171af | 1307 | hold(); |
smejky | 12:9bc02f9e16e3 | 1308 | grafika(); |
smejky | 8:b6e7401fdcfc | 1309 | Menu(); |
smejky | 8:b6e7401fdcfc | 1310 | } |
smejky | 8:b6e7401fdcfc | 1311 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 1312 | |
smejky | 8:b6e7401fdcfc | 1313 | |
smejky | 12:9bc02f9e16e3 | 1314 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 1315 | if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ |
smejky | 12:9bc02f9e16e3 | 1316 | spi.fillrect(0,200,320,240,Select); |
smejky | 12:9bc02f9e16e3 | 1317 | |
smejky | 12:9bc02f9e16e3 | 1318 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1319 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 1320 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1321 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1322 | |
smejky | 12:9bc02f9e16e3 | 1323 | hold(); |
smejky | 12:9bc02f9e16e3 | 1324 | led_jas = brightness_led(); |
smejky | 12:9bc02f9e16e3 | 1325 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1326 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1327 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1328 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1329 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1330 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1331 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1332 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1333 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1334 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 1335 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1336 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1337 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1338 | spi.printf(jazyk[3]); |
smejky | 11:4ca8388080c6 | 1339 | } |
smejky | 12:9bc02f9e16e3 | 1340 | //levý spodni čudlik |
smejky | 11:4ca8388080c6 | 1341 | |
smejky | 12:9bc02f9e16e3 | 1342 | if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){ |
smejky | 12:9bc02f9e16e3 | 1343 | hold(); |
smejky | 12:9bc02f9e16e3 | 1344 | color_pick1 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 1345 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1346 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1347 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1348 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1349 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1350 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1351 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1352 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1353 | } |
smejky | 12:9bc02f9e16e3 | 1354 | |
smejky | 12:9bc02f9e16e3 | 1355 | if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){ |
smejky | 12:9bc02f9e16e3 | 1356 | hold(); |
smejky | 12:9bc02f9e16e3 | 1357 | color_pick2 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 1358 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1359 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1360 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1361 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1362 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1363 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1364 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1365 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1366 | } |
smejky | 12:9bc02f9e16e3 | 1367 | |
smejky | 12:9bc02f9e16e3 | 1368 | if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){ |
smejky | 9:d1385f7171af | 1369 | hold(); |
smejky | 12:9bc02f9e16e3 | 1370 | color_pick3 = color_picker(); |
smejky | 11:4ca8388080c6 | 1371 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1372 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1373 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1374 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1375 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1376 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1377 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1378 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1379 | } |
smejky | 12:9bc02f9e16e3 | 1380 | |
smejky | 12:9bc02f9e16e3 | 1381 | |
smejky | 12:9bc02f9e16e3 | 1382 | 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])){ |
smejky | 12:9bc02f9e16e3 | 1383 | spi.fillrect(137,142,184,189,Select); |
smejky | 12:9bc02f9e16e3 | 1384 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 1385 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1386 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1387 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1388 | hold(); |
smejky | 12:9bc02f9e16e3 | 1389 | time_picked++; |
smejky | 12:9bc02f9e16e3 | 1390 | switch(time_picked){ |
smejky | 12:9bc02f9e16e3 | 1391 | case 1: |
smejky | 12:9bc02f9e16e3 | 1392 | rychlost_tady = 1; |
smejky | 12:9bc02f9e16e3 | 1393 | break; |
smejky | 12:9bc02f9e16e3 | 1394 | case 2: |
smejky | 12:9bc02f9e16e3 | 1395 | rychlost_tady = 4; |
smejky | 12:9bc02f9e16e3 | 1396 | break; |
smejky | 12:9bc02f9e16e3 | 1397 | case 3: |
smejky | 12:9bc02f9e16e3 | 1398 | rychlost_tady = 8; |
smejky | 12:9bc02f9e16e3 | 1399 | break; |
smejky | 12:9bc02f9e16e3 | 1400 | case 4: |
smejky | 12:9bc02f9e16e3 | 1401 | rychlost_tady = 12; |
smejky | 12:9bc02f9e16e3 | 1402 | break; |
smejky | 12:9bc02f9e16e3 | 1403 | default: |
smejky | 12:9bc02f9e16e3 | 1404 | time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1405 | rychlost_tady = 1; |
smejky | 12:9bc02f9e16e3 | 1406 | } |
smejky | 12:9bc02f9e16e3 | 1407 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1408 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1409 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1410 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1411 | } |
smejky | 12:9bc02f9e16e3 | 1412 | } |
smejky | 12:9bc02f9e16e3 | 1413 | } |
smejky | 12:9bc02f9e16e3 | 1414 | } |
smejky | 12:9bc02f9e16e3 | 1415 | |
smejky | 12:9bc02f9e16e3 | 1416 | } |
smejky | 12:9bc02f9e16e3 | 1417 | |
smejky | 12:9bc02f9e16e3 | 1418 | |
smejky | 12:9bc02f9e16e3 | 1419 | void set_rainbow(){ |
smejky | 12:9bc02f9e16e3 | 1420 | |
smejky | 12:9bc02f9e16e3 | 1421 | int green1[] = {109,40,212,143}; |
smejky | 12:9bc02f9e16e3 | 1422 | int green[] = {40,109,143,212}; |
smejky | 12:9bc02f9e16e3 | 1423 | |
smejky | 12:9bc02f9e16e3 | 1424 | int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik |
smejky | 12:9bc02f9e16e3 | 1425 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 12:9bc02f9e16e3 | 1426 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 12:9bc02f9e16e3 | 1427 | |
smejky | 12:9bc02f9e16e3 | 1428 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1429 | |
smejky | 12:9bc02f9e16e3 | 1430 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black); |
smejky | 12:9bc02f9e16e3 | 1431 | int time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1432 | float rychlost_tady = 0.0015; |
smejky | 12:9bc02f9e16e3 | 1433 | |
smejky | 12:9bc02f9e16e3 | 1434 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 1435 | |
smejky | 12:9bc02f9e16e3 | 1436 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1437 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1438 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1439 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1440 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 12:9bc02f9e16e3 | 1441 | spi.locate(147,70); |
smejky | 12:9bc02f9e16e3 | 1442 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1443 | while(1) |
smejky | 12:9bc02f9e16e3 | 1444 | { |
smejky | 12:9bc02f9e16e3 | 1445 | if (touch.DataAvailable()) |
smejky | 12:9bc02f9e16e3 | 1446 | { |
smejky | 12:9bc02f9e16e3 | 1447 | if(touch.Read()) |
smejky | 12:9bc02f9e16e3 | 1448 | { |
smejky | 12:9bc02f9e16e3 | 1449 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 12:9bc02f9e16e3 | 1450 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 12:9bc02f9e16e3 | 1451 | |
smejky | 12:9bc02f9e16e3 | 1452 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 1453 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 12:9bc02f9e16e3 | 1454 | |
smejky | 12:9bc02f9e16e3 | 1455 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1456 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 1457 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 12:9bc02f9e16e3 | 1458 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1459 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1460 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1461 | hold(); |
smejky | 12:9bc02f9e16e3 | 1462 | thread.terminate(); |
smejky | 12:9bc02f9e16e3 | 1463 | rychlost = rychlost_tady; |
smejky | 12:9bc02f9e16e3 | 1464 | thread.start(rainbow); |
smejky | 12:9bc02f9e16e3 | 1465 | grafika(); |
smejky | 12:9bc02f9e16e3 | 1466 | Menu(); |
smejky | 12:9bc02f9e16e3 | 1467 | } |
smejky | 12:9bc02f9e16e3 | 1468 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 1469 | |
smejky | 12:9bc02f9e16e3 | 1470 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 1471 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 12:9bc02f9e16e3 | 1472 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1473 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 1474 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 12:9bc02f9e16e3 | 1475 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1476 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1477 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1478 | |
smejky | 12:9bc02f9e16e3 | 1479 | hold(); |
smejky | 12:9bc02f9e16e3 | 1480 | grafika(); |
smejky | 12:9bc02f9e16e3 | 1481 | Menu(); |
smejky | 12:9bc02f9e16e3 | 1482 | } |
smejky | 12:9bc02f9e16e3 | 1483 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 1484 | |
smejky | 12:9bc02f9e16e3 | 1485 | |
smejky | 12:9bc02f9e16e3 | 1486 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 1487 | if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ |
smejky | 12:9bc02f9e16e3 | 1488 | spi.fillrect(0,200,320,240,Select); |
smejky | 12:9bc02f9e16e3 | 1489 | |
smejky | 12:9bc02f9e16e3 | 1490 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1491 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 1492 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1493 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1494 | |
smejky | 12:9bc02f9e16e3 | 1495 | hold(); |
smejky | 12:9bc02f9e16e3 | 1496 | led_jas = brightness_led(); |
smejky | 12:9bc02f9e16e3 | 1497 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1498 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 12:9bc02f9e16e3 | 1499 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black); |
smejky | 12:9bc02f9e16e3 | 1500 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1501 | spi.locate(147,70); |
smejky | 12:9bc02f9e16e3 | 1502 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1503 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 1504 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1505 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1506 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1507 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1508 | } |
smejky | 12:9bc02f9e16e3 | 1509 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 1510 | |
smejky | 12:9bc02f9e16e3 | 1511 | if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){ |
smejky | 12:9bc02f9e16e3 | 1512 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],Select); |
smejky | 12:9bc02f9e16e3 | 1513 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 1514 | spi.set_font((unsigned char*) Arial48x47);; |
smejky | 12:9bc02f9e16e3 | 1515 | spi.locate(147,70); |
smejky | 12:9bc02f9e16e3 | 1516 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1517 | hold(); |
smejky | 12:9bc02f9e16e3 | 1518 | time_picked++; |
smejky | 12:9bc02f9e16e3 | 1519 | switch(time_picked){ |
smejky | 12:9bc02f9e16e3 | 1520 | case 1: |
smejky | 12:9bc02f9e16e3 | 1521 | rychlost_tady = 0.0015; |
smejky | 12:9bc02f9e16e3 | 1522 | break; |
smejky | 12:9bc02f9e16e3 | 1523 | case 2: |
smejky | 12:9bc02f9e16e3 | 1524 | rychlost_tady = 0.0050; |
smejky | 12:9bc02f9e16e3 | 1525 | break; |
smejky | 12:9bc02f9e16e3 | 1526 | case 3: |
smejky | 12:9bc02f9e16e3 | 1527 | rychlost_tady = 0.01; |
smejky | 12:9bc02f9e16e3 | 1528 | break; |
smejky | 12:9bc02f9e16e3 | 1529 | case 4: |
smejky | 12:9bc02f9e16e3 | 1530 | rychlost_tady = 0.05; |
smejky | 12:9bc02f9e16e3 | 1531 | break; |
smejky | 12:9bc02f9e16e3 | 1532 | default: |
smejky | 12:9bc02f9e16e3 | 1533 | time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1534 | rychlost_tady = 0.05; |
smejky | 12:9bc02f9e16e3 | 1535 | } |
smejky | 12:9bc02f9e16e3 | 1536 | spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black); |
smejky | 12:9bc02f9e16e3 | 1537 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1538 | spi.locate(147,70); |
smejky | 12:9bc02f9e16e3 | 1539 | spi.printf("%d",time_picked); |
smejky | 8:b6e7401fdcfc | 1540 | } |
smejky | 8:b6e7401fdcfc | 1541 | } |
smejky | 8:b6e7401fdcfc | 1542 | } |
smejky | 8:b6e7401fdcfc | 1543 | } |
smejky | 8:b6e7401fdcfc | 1544 | |
smejky | 8:b6e7401fdcfc | 1545 | } |
smejky | 8:b6e7401fdcfc | 1546 | |
smejky | 12:9bc02f9e16e3 | 1547 | void set_change(){ |
smejky | 12:9bc02f9e16e3 | 1548 | |
smejky | 12:9bc02f9e16e3 | 1549 | int pole3[] = {213,76,260,124}; |
smejky | 12:9bc02f9e16e3 | 1550 | int pole2[] = {137,76,184,124}; |
smejky | 12:9bc02f9e16e3 | 1551 | int pole1[] = {60,76,107,124}; |
smejky | 12:9bc02f9e16e3 | 1552 | |
smejky | 12:9bc02f9e16e3 | 1553 | int pole1_t[] = {76,213,124,260}; |
smejky | 12:9bc02f9e16e3 | 1554 | int pole2_t[] = {76,137,124,184}; |
smejky | 12:9bc02f9e16e3 | 1555 | int pole3_t[] = {76,60,124,107}; |
smejky | 12:9bc02f9e16e3 | 1556 | |
smejky | 12:9bc02f9e16e3 | 1557 | int pick_time_t[] = {142,137,189,184}; |
smejky | 12:9bc02f9e16e3 | 1558 | |
smejky | 12:9bc02f9e16e3 | 1559 | int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik |
smejky | 12:9bc02f9e16e3 | 1560 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 12:9bc02f9e16e3 | 1561 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 12:9bc02f9e16e3 | 1562 | |
smejky | 12:9bc02f9e16e3 | 1563 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1564 | |
smejky | 12:9bc02f9e16e3 | 1565 | int color_pick1 = Black; |
smejky | 12:9bc02f9e16e3 | 1566 | int color_pick2 = Black; |
smejky | 12:9bc02f9e16e3 | 1567 | int color_pick3 = Black; |
smejky | 12:9bc02f9e16e3 | 1568 | |
smejky | 12:9bc02f9e16e3 | 1569 | int time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1570 | float rychlost_tady = 0.5; |
smejky | 12:9bc02f9e16e3 | 1571 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1572 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1573 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1574 | |
smejky | 12:9bc02f9e16e3 | 1575 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 1576 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1577 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1578 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1579 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1580 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1581 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1582 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1583 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1584 | while(1) |
smejky | 12:9bc02f9e16e3 | 1585 | { |
smejky | 12:9bc02f9e16e3 | 1586 | if (touch.DataAvailable()) |
smejky | 12:9bc02f9e16e3 | 1587 | { |
smejky | 12:9bc02f9e16e3 | 1588 | if(touch.Read()) |
smejky | 12:9bc02f9e16e3 | 1589 | { |
smejky | 12:9bc02f9e16e3 | 1590 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 12:9bc02f9e16e3 | 1591 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 12:9bc02f9e16e3 | 1592 | |
smejky | 12:9bc02f9e16e3 | 1593 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 1594 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 12:9bc02f9e16e3 | 1595 | |
smejky | 12:9bc02f9e16e3 | 1596 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1597 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 1598 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 12:9bc02f9e16e3 | 1599 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1600 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1601 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1602 | hold(); |
smejky | 12:9bc02f9e16e3 | 1603 | thread.terminate(); |
smejky | 12:9bc02f9e16e3 | 1604 | int p = 0; |
smejky | 12:9bc02f9e16e3 | 1605 | while(p < 9){ |
smejky | 12:9bc02f9e16e3 | 1606 | barvy[p] = 0; |
smejky | 12:9bc02f9e16e3 | 1607 | p++; |
smejky | 12:9bc02f9e16e3 | 1608 | } |
smejky | 12:9bc02f9e16e3 | 1609 | rychlost = rychlost_tady; |
smejky | 12:9bc02f9e16e3 | 1610 | switch (color_pick1){ |
smejky | 12:9bc02f9e16e3 | 1611 | case Red: |
smejky | 12:9bc02f9e16e3 | 1612 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1613 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1614 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1615 | break; |
smejky | 12:9bc02f9e16e3 | 1616 | case Orange: |
smejky | 12:9bc02f9e16e3 | 1617 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1618 | barvy[1] = 128; |
smejky | 12:9bc02f9e16e3 | 1619 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1620 | break; |
smejky | 12:9bc02f9e16e3 | 1621 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 1622 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1623 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1624 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1625 | break; |
smejky | 12:9bc02f9e16e3 | 1626 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 1627 | barvy[0] = 128; |
smejky | 12:9bc02f9e16e3 | 1628 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1629 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1630 | break; |
smejky | 12:9bc02f9e16e3 | 1631 | case Green: |
smejky | 12:9bc02f9e16e3 | 1632 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1633 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1634 | barvy[2] = 0; |
smejky | 12:9bc02f9e16e3 | 1635 | break; |
smejky | 12:9bc02f9e16e3 | 1636 | case White: |
smejky | 12:9bc02f9e16e3 | 1637 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1638 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1639 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1640 | break; |
smejky | 12:9bc02f9e16e3 | 1641 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 1642 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1643 | barvy[1] = 255; |
smejky | 12:9bc02f9e16e3 | 1644 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1645 | break; |
smejky | 12:9bc02f9e16e3 | 1646 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 1647 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1648 | barvy[1] = 127; |
smejky | 12:9bc02f9e16e3 | 1649 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1650 | break; |
smejky | 12:9bc02f9e16e3 | 1651 | case Blue: |
smejky | 12:9bc02f9e16e3 | 1652 | barvy[0] = 0; |
smejky | 12:9bc02f9e16e3 | 1653 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1654 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1655 | break; |
smejky | 12:9bc02f9e16e3 | 1656 | case Purple: |
smejky | 12:9bc02f9e16e3 | 1657 | barvy[0] = 128; |
smejky | 12:9bc02f9e16e3 | 1658 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1659 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1660 | break; |
smejky | 12:9bc02f9e16e3 | 1661 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 1662 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1663 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1664 | barvy[2] = 255; |
smejky | 12:9bc02f9e16e3 | 1665 | break; |
smejky | 12:9bc02f9e16e3 | 1666 | case Pink: |
smejky | 12:9bc02f9e16e3 | 1667 | barvy[0] = 255; |
smejky | 12:9bc02f9e16e3 | 1668 | barvy[1] = 0; |
smejky | 12:9bc02f9e16e3 | 1669 | barvy[2] = 127; |
smejky | 12:9bc02f9e16e3 | 1670 | break; |
smejky | 12:9bc02f9e16e3 | 1671 | default: |
smejky | 12:9bc02f9e16e3 | 1672 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 1673 | } |
smejky | 12:9bc02f9e16e3 | 1674 | switch (color_pick2){ |
smejky | 12:9bc02f9e16e3 | 1675 | case Red: |
smejky | 12:9bc02f9e16e3 | 1676 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1677 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1678 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1679 | |
smejky | 12:9bc02f9e16e3 | 1680 | break; |
smejky | 12:9bc02f9e16e3 | 1681 | case Orange: |
smejky | 12:9bc02f9e16e3 | 1682 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1683 | barvy[4] = 128; |
smejky | 12:9bc02f9e16e3 | 1684 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1685 | |
smejky | 12:9bc02f9e16e3 | 1686 | break; |
smejky | 12:9bc02f9e16e3 | 1687 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 1688 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1689 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1690 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1691 | |
smejky | 12:9bc02f9e16e3 | 1692 | break; |
smejky | 12:9bc02f9e16e3 | 1693 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 1694 | barvy[3] = 128; |
smejky | 12:9bc02f9e16e3 | 1695 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1696 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1697 | break; |
smejky | 12:9bc02f9e16e3 | 1698 | case Green: |
smejky | 12:9bc02f9e16e3 | 1699 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1700 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1701 | barvy[5] = 0; |
smejky | 12:9bc02f9e16e3 | 1702 | |
smejky | 12:9bc02f9e16e3 | 1703 | break; |
smejky | 12:9bc02f9e16e3 | 1704 | case White: |
smejky | 12:9bc02f9e16e3 | 1705 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1706 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1707 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1708 | |
smejky | 12:9bc02f9e16e3 | 1709 | break; |
smejky | 12:9bc02f9e16e3 | 1710 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 1711 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1712 | barvy[4] = 255; |
smejky | 12:9bc02f9e16e3 | 1713 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1714 | |
smejky | 12:9bc02f9e16e3 | 1715 | break; |
smejky | 12:9bc02f9e16e3 | 1716 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 1717 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1718 | barvy[4] = 127; |
smejky | 12:9bc02f9e16e3 | 1719 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1720 | |
smejky | 12:9bc02f9e16e3 | 1721 | break; |
smejky | 12:9bc02f9e16e3 | 1722 | case Blue: |
smejky | 12:9bc02f9e16e3 | 1723 | barvy[3] = 0; |
smejky | 12:9bc02f9e16e3 | 1724 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1725 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1726 | |
smejky | 12:9bc02f9e16e3 | 1727 | break; |
smejky | 12:9bc02f9e16e3 | 1728 | case Purple: |
smejky | 12:9bc02f9e16e3 | 1729 | barvy[3] = 128; |
smejky | 12:9bc02f9e16e3 | 1730 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1731 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1732 | |
smejky | 12:9bc02f9e16e3 | 1733 | break; |
smejky | 12:9bc02f9e16e3 | 1734 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 1735 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1736 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1737 | barvy[5] = 255; |
smejky | 12:9bc02f9e16e3 | 1738 | |
smejky | 12:9bc02f9e16e3 | 1739 | break; |
smejky | 12:9bc02f9e16e3 | 1740 | case Pink: |
smejky | 12:9bc02f9e16e3 | 1741 | barvy[3] = 255; |
smejky | 12:9bc02f9e16e3 | 1742 | barvy[4] = 0; |
smejky | 12:9bc02f9e16e3 | 1743 | barvy[5] = 127; |
smejky | 12:9bc02f9e16e3 | 1744 | |
smejky | 12:9bc02f9e16e3 | 1745 | break; |
smejky | 12:9bc02f9e16e3 | 1746 | default: |
smejky | 12:9bc02f9e16e3 | 1747 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 1748 | } |
smejky | 12:9bc02f9e16e3 | 1749 | switch (color_pick3){ |
smejky | 12:9bc02f9e16e3 | 1750 | case Red: |
smejky | 12:9bc02f9e16e3 | 1751 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1752 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1753 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1754 | break; |
smejky | 12:9bc02f9e16e3 | 1755 | case Orange: |
smejky | 12:9bc02f9e16e3 | 1756 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1757 | barvy[7] = 128; |
smejky | 12:9bc02f9e16e3 | 1758 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1759 | |
smejky | 12:9bc02f9e16e3 | 1760 | break; |
smejky | 12:9bc02f9e16e3 | 1761 | case Yellow: |
smejky | 12:9bc02f9e16e3 | 1762 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1763 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1764 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1765 | |
smejky | 12:9bc02f9e16e3 | 1766 | break; |
smejky | 12:9bc02f9e16e3 | 1767 | case GreenYellow: |
smejky | 12:9bc02f9e16e3 | 1768 | barvy[6] = 128; |
smejky | 12:9bc02f9e16e3 | 1769 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1770 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1771 | |
smejky | 12:9bc02f9e16e3 | 1772 | break; |
smejky | 12:9bc02f9e16e3 | 1773 | case Green: |
smejky | 12:9bc02f9e16e3 | 1774 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1775 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1776 | barvy[8] = 0; |
smejky | 12:9bc02f9e16e3 | 1777 | |
smejky | 12:9bc02f9e16e3 | 1778 | break; |
smejky | 12:9bc02f9e16e3 | 1779 | case White: |
smejky | 12:9bc02f9e16e3 | 1780 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1781 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1782 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1783 | |
smejky | 12:9bc02f9e16e3 | 1784 | break; |
smejky | 12:9bc02f9e16e3 | 1785 | case Cyan: |
smejky | 12:9bc02f9e16e3 | 1786 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1787 | barvy[7] = 255; |
smejky | 12:9bc02f9e16e3 | 1788 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1789 | |
smejky | 12:9bc02f9e16e3 | 1790 | break; |
smejky | 12:9bc02f9e16e3 | 1791 | case DarkCyan: |
smejky | 12:9bc02f9e16e3 | 1792 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1793 | barvy[7] = 127; |
smejky | 12:9bc02f9e16e3 | 1794 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1795 | |
smejky | 12:9bc02f9e16e3 | 1796 | break; |
smejky | 12:9bc02f9e16e3 | 1797 | case Blue: |
smejky | 12:9bc02f9e16e3 | 1798 | barvy[6] = 0; |
smejky | 12:9bc02f9e16e3 | 1799 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1800 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1801 | |
smejky | 12:9bc02f9e16e3 | 1802 | break; |
smejky | 12:9bc02f9e16e3 | 1803 | case Purple: |
smejky | 12:9bc02f9e16e3 | 1804 | barvy[6] = 128; |
smejky | 12:9bc02f9e16e3 | 1805 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1806 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1807 | |
smejky | 12:9bc02f9e16e3 | 1808 | break; |
smejky | 12:9bc02f9e16e3 | 1809 | case Magenta: |
smejky | 12:9bc02f9e16e3 | 1810 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1811 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1812 | barvy[8] = 255; |
smejky | 12:9bc02f9e16e3 | 1813 | |
smejky | 12:9bc02f9e16e3 | 1814 | break; |
smejky | 12:9bc02f9e16e3 | 1815 | case Pink: |
smejky | 12:9bc02f9e16e3 | 1816 | barvy[6] = 255; |
smejky | 12:9bc02f9e16e3 | 1817 | barvy[7] = 0; |
smejky | 12:9bc02f9e16e3 | 1818 | barvy[8] = 127; |
smejky | 12:9bc02f9e16e3 | 1819 | |
smejky | 12:9bc02f9e16e3 | 1820 | break; |
smejky | 12:9bc02f9e16e3 | 1821 | default: |
smejky | 12:9bc02f9e16e3 | 1822 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 1823 | } |
smejky | 12:9bc02f9e16e3 | 1824 | thread.start(change); |
smejky | 12:9bc02f9e16e3 | 1825 | grafika(); |
smejky | 12:9bc02f9e16e3 | 1826 | Menu(); |
smejky | 12:9bc02f9e16e3 | 1827 | } |
smejky | 12:9bc02f9e16e3 | 1828 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 1829 | |
smejky | 12:9bc02f9e16e3 | 1830 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 1831 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 12:9bc02f9e16e3 | 1832 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1833 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 1834 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 12:9bc02f9e16e3 | 1835 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1836 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 1837 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 1838 | |
smejky | 12:9bc02f9e16e3 | 1839 | hold(); |
smejky | 12:9bc02f9e16e3 | 1840 | grafika(); |
smejky | 12:9bc02f9e16e3 | 1841 | Menu(); |
smejky | 12:9bc02f9e16e3 | 1842 | } |
smejky | 12:9bc02f9e16e3 | 1843 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 1844 | |
smejky | 12:9bc02f9e16e3 | 1845 | |
smejky | 12:9bc02f9e16e3 | 1846 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 1847 | if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){ |
smejky | 12:9bc02f9e16e3 | 1848 | spi.fillrect(0,200,320,240,Select); |
smejky | 12:9bc02f9e16e3 | 1849 | |
smejky | 12:9bc02f9e16e3 | 1850 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1851 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 1852 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1853 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1854 | |
smejky | 12:9bc02f9e16e3 | 1855 | hold(); |
smejky | 12:9bc02f9e16e3 | 1856 | led_jas = brightness_led(); |
smejky | 12:9bc02f9e16e3 | 1857 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1858 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1859 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1860 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1861 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1862 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1863 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1864 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1865 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1866 | spi.fillrect(0,200,320,240,Black); |
smejky | 12:9bc02f9e16e3 | 1867 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 12:9bc02f9e16e3 | 1868 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1869 | spi.locate(117,210); |
smejky | 12:9bc02f9e16e3 | 1870 | spi.printf(jazyk[3]); |
smejky | 12:9bc02f9e16e3 | 1871 | } |
smejky | 12:9bc02f9e16e3 | 1872 | //levý spodni čudlik |
smejky | 12:9bc02f9e16e3 | 1873 | |
smejky | 12:9bc02f9e16e3 | 1874 | if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){ |
smejky | 12:9bc02f9e16e3 | 1875 | hold(); |
smejky | 12:9bc02f9e16e3 | 1876 | color_pick1 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 1877 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1878 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1879 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1880 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1881 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1882 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1883 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1884 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1885 | } |
smejky | 12:9bc02f9e16e3 | 1886 | |
smejky | 12:9bc02f9e16e3 | 1887 | if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){ |
smejky | 12:9bc02f9e16e3 | 1888 | hold(); |
smejky | 12:9bc02f9e16e3 | 1889 | color_pick2 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 1890 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1891 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1892 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1893 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1894 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1895 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1896 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1897 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1898 | } |
smejky | 12:9bc02f9e16e3 | 1899 | |
smejky | 12:9bc02f9e16e3 | 1900 | if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){ |
smejky | 12:9bc02f9e16e3 | 1901 | hold(); |
smejky | 12:9bc02f9e16e3 | 1902 | color_pick3 = color_picker(); |
smejky | 12:9bc02f9e16e3 | 1903 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 1904 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1); |
smejky | 12:9bc02f9e16e3 | 1905 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2); |
smejky | 12:9bc02f9e16e3 | 1906 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); |
smejky | 12:9bc02f9e16e3 | 1907 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1908 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1909 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1910 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1911 | } |
smejky | 12:9bc02f9e16e3 | 1912 | |
smejky | 12:9bc02f9e16e3 | 1913 | |
smejky | 12:9bc02f9e16e3 | 1914 | 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])){ |
smejky | 12:9bc02f9e16e3 | 1915 | spi.fillrect(137,142,184,189,Select); |
smejky | 12:9bc02f9e16e3 | 1916 | spi.background(Select); |
smejky | 12:9bc02f9e16e3 | 1917 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 12:9bc02f9e16e3 | 1918 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1919 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1920 | hold(); |
smejky | 12:9bc02f9e16e3 | 1921 | time_picked++; |
smejky | 12:9bc02f9e16e3 | 1922 | switch(time_picked){ |
smejky | 12:9bc02f9e16e3 | 1923 | case 1: |
smejky | 12:9bc02f9e16e3 | 1924 | rychlost_tady = 0.5; |
smejky | 12:9bc02f9e16e3 | 1925 | break; |
smejky | 12:9bc02f9e16e3 | 1926 | case 2: |
smejky | 12:9bc02f9e16e3 | 1927 | rychlost_tady = 1; |
smejky | 12:9bc02f9e16e3 | 1928 | break; |
smejky | 12:9bc02f9e16e3 | 1929 | case 3: |
smejky | 12:9bc02f9e16e3 | 1930 | rychlost_tady = 3; |
smejky | 12:9bc02f9e16e3 | 1931 | break; |
smejky | 12:9bc02f9e16e3 | 1932 | case 4: |
smejky | 12:9bc02f9e16e3 | 1933 | rychlost_tady = 7; |
smejky | 12:9bc02f9e16e3 | 1934 | break; |
smejky | 12:9bc02f9e16e3 | 1935 | default: |
smejky | 12:9bc02f9e16e3 | 1936 | time_picked = 1; |
smejky | 12:9bc02f9e16e3 | 1937 | rychlost_tady = 0.5; |
smejky | 12:9bc02f9e16e3 | 1938 | } |
smejky | 12:9bc02f9e16e3 | 1939 | spi.fillrect(137,142,184,189,Black); |
smejky | 12:9bc02f9e16e3 | 1940 | spi.background(Black); |
smejky | 12:9bc02f9e16e3 | 1941 | spi.locate(153,155); |
smejky | 12:9bc02f9e16e3 | 1942 | spi.printf("%d",time_picked); |
smejky | 12:9bc02f9e16e3 | 1943 | } |
smejky | 12:9bc02f9e16e3 | 1944 | } |
smejky | 12:9bc02f9e16e3 | 1945 | } |
smejky | 12:9bc02f9e16e3 | 1946 | } |
smejky | 12:9bc02f9e16e3 | 1947 | |
smejky | 12:9bc02f9e16e3 | 1948 | } |
smejky | 12:9bc02f9e16e3 | 1949 | |
smejky | 12:9bc02f9e16e3 | 1950 | |
smejky | 12:9bc02f9e16e3 | 1951 | void change(){ |
smejky | 12:9bc02f9e16e3 | 1952 | |
smejky | 12:9bc02f9e16e3 | 1953 | while(1){ |
smejky | 12:9bc02f9e16e3 | 1954 | if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){ |
smejky | 12:9bc02f9e16e3 | 1955 | |
smejky | 12:9bc02f9e16e3 | 1956 | }else{ |
smejky | 12:9bc02f9e16e3 | 1957 | send_color(barvy[0],barvy[1],barvy[2],led_jas); |
smejky | 12:9bc02f9e16e3 | 1958 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 1959 | } |
smejky | 12:9bc02f9e16e3 | 1960 | if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){ |
smejky | 12:9bc02f9e16e3 | 1961 | |
smejky | 12:9bc02f9e16e3 | 1962 | }else{ |
smejky | 12:9bc02f9e16e3 | 1963 | send_color(barvy[3],barvy[4],barvy[5],led_jas); |
smejky | 12:9bc02f9e16e3 | 1964 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 1965 | } |
smejky | 12:9bc02f9e16e3 | 1966 | |
smejky | 12:9bc02f9e16e3 | 1967 | |
smejky | 12:9bc02f9e16e3 | 1968 | if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){ |
smejky | 12:9bc02f9e16e3 | 1969 | |
smejky | 12:9bc02f9e16e3 | 1970 | }else{ |
smejky | 12:9bc02f9e16e3 | 1971 | send_color(barvy[6],barvy[7],barvy[8],led_jas); |
smejky | 12:9bc02f9e16e3 | 1972 | wait_ms(rychlost); |
smejky | 12:9bc02f9e16e3 | 1973 | } |
smejky | 12:9bc02f9e16e3 | 1974 | |
smejky | 12:9bc02f9e16e3 | 1975 | } |
smejky | 12:9bc02f9e16e3 | 1976 | } |
smejky | 12:9bc02f9e16e3 | 1977 | |
smejky | 12:9bc02f9e16e3 | 1978 | |
smejky | 12:9bc02f9e16e3 | 1979 | |
smejky | 12:9bc02f9e16e3 | 1980 | void flash(){ |
smejky | 12:9bc02f9e16e3 | 1981 | |
smejky | 12:9bc02f9e16e3 | 1982 | while(1){ |
smejky | 12:9bc02f9e16e3 | 1983 | if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){ |
smejky | 12:9bc02f9e16e3 | 1984 | |
smejky | 12:9bc02f9e16e3 | 1985 | }else{ |
smejky | 12:9bc02f9e16e3 | 1986 | send_color(barvy[0],barvy[1],barvy[2],led_jas); |
smejky | 12:9bc02f9e16e3 | 1987 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 1988 | send_color(barvy[0],barvy[1],barvy[2],0); |
smejky | 12:9bc02f9e16e3 | 1989 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 1990 | send_color(barvy[0],barvy[1],barvy[2],led_jas); |
smejky | 12:9bc02f9e16e3 | 1991 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 1992 | send_color(barvy[0],barvy[1],barvy[2],0); |
smejky | 12:9bc02f9e16e3 | 1993 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 1994 | } |
smejky | 12:9bc02f9e16e3 | 1995 | |
smejky | 12:9bc02f9e16e3 | 1996 | |
smejky | 12:9bc02f9e16e3 | 1997 | if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){ |
smejky | 12:9bc02f9e16e3 | 1998 | |
smejky | 12:9bc02f9e16e3 | 1999 | }else{ |
smejky | 12:9bc02f9e16e3 | 2000 | send_color(barvy[3],barvy[4],barvy[5],led_jas); |
smejky | 12:9bc02f9e16e3 | 2001 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 2002 | send_color(barvy[3],barvy[4],barvy[5],0); |
smejky | 12:9bc02f9e16e3 | 2003 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 2004 | send_color(barvy[3],barvy[4],barvy[5],led_jas); |
smejky | 12:9bc02f9e16e3 | 2005 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 2006 | send_color(barvy[3],barvy[4],barvy[5],0); |
smejky | 12:9bc02f9e16e3 | 2007 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2008 | } |
smejky | 12:9bc02f9e16e3 | 2009 | |
smejky | 12:9bc02f9e16e3 | 2010 | |
smejky | 12:9bc02f9e16e3 | 2011 | if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){ |
smejky | 12:9bc02f9e16e3 | 2012 | |
smejky | 12:9bc02f9e16e3 | 2013 | }else{ |
smejky | 12:9bc02f9e16e3 | 2014 | send_color(barvy[6],barvy[7],barvy[8],led_jas); |
smejky | 12:9bc02f9e16e3 | 2015 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 2016 | send_color(barvy[6],barvy[7],barvy[8],0); |
smejky | 12:9bc02f9e16e3 | 2017 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 2018 | send_color(barvy[6],barvy[7],barvy[8],led_jas); |
smejky | 12:9bc02f9e16e3 | 2019 | wait_ms(100); |
smejky | 12:9bc02f9e16e3 | 2020 | send_color(barvy[6],barvy[7],barvy[8],0); |
smejky | 12:9bc02f9e16e3 | 2021 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2022 | } |
smejky | 12:9bc02f9e16e3 | 2023 | |
smejky | 12:9bc02f9e16e3 | 2024 | } |
smejky | 12:9bc02f9e16e3 | 2025 | } |
smejky | 12:9bc02f9e16e3 | 2026 | |
smejky | 12:9bc02f9e16e3 | 2027 | void rainbow(){ |
smejky | 12:9bc02f9e16e3 | 2028 | int i = 0; |
smejky | 12:9bc02f9e16e3 | 2029 | int j = 0; |
smejky | 12:9bc02f9e16e3 | 2030 | int k = 0; |
smejky | 12:9bc02f9e16e3 | 2031 | |
smejky | 12:9bc02f9e16e3 | 2032 | while(1){ |
smejky | 12:9bc02f9e16e3 | 2033 | i = 0; |
smejky | 12:9bc02f9e16e3 | 2034 | j = 0; |
smejky | 12:9bc02f9e16e3 | 2035 | k = 255; |
smejky | 12:9bc02f9e16e3 | 2036 | |
smejky | 12:9bc02f9e16e3 | 2037 | while(i < 255) { |
smejky | 12:9bc02f9e16e3 | 2038 | i = i + 1; |
smejky | 12:9bc02f9e16e3 | 2039 | k = k - 1; |
smejky | 12:9bc02f9e16e3 | 2040 | send_color(i,j,k,led_jas); |
smejky | 12:9bc02f9e16e3 | 2041 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2042 | } |
smejky | 12:9bc02f9e16e3 | 2043 | |
smejky | 12:9bc02f9e16e3 | 2044 | while(i > 0){ |
smejky | 12:9bc02f9e16e3 | 2045 | i = i - 1; |
smejky | 12:9bc02f9e16e3 | 2046 | j = j + 1; |
smejky | 12:9bc02f9e16e3 | 2047 | send_color(i,j,k,led_jas); |
smejky | 12:9bc02f9e16e3 | 2048 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2049 | } |
smejky | 12:9bc02f9e16e3 | 2050 | |
smejky | 12:9bc02f9e16e3 | 2051 | while(j > 0){ |
smejky | 12:9bc02f9e16e3 | 2052 | j = j - 1; |
smejky | 12:9bc02f9e16e3 | 2053 | k = k + 1; |
smejky | 12:9bc02f9e16e3 | 2054 | send_color(i,j,k,led_jas); |
smejky | 12:9bc02f9e16e3 | 2055 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2056 | } |
smejky | 12:9bc02f9e16e3 | 2057 | } |
smejky | 12:9bc02f9e16e3 | 2058 | |
smejky | 12:9bc02f9e16e3 | 2059 | } |
smejky | 12:9bc02f9e16e3 | 2060 | |
smejky | 12:9bc02f9e16e3 | 2061 | |
smejky | 12:9bc02f9e16e3 | 2062 | |
smejky | 12:9bc02f9e16e3 | 2063 | void fadeinout(){ |
smejky | 12:9bc02f9e16e3 | 2064 | int br = 0; |
smejky | 12:9bc02f9e16e3 | 2065 | while(1){ |
smejky | 12:9bc02f9e16e3 | 2066 | if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){ |
smejky | 12:9bc02f9e16e3 | 2067 | |
smejky | 12:9bc02f9e16e3 | 2068 | }else{ |
smejky | 12:9bc02f9e16e3 | 2069 | while(br < led_jas) { |
smejky | 12:9bc02f9e16e3 | 2070 | br = br + 1; |
smejky | 12:9bc02f9e16e3 | 2071 | send_color(barvy[0],barvy[1],barvy[2],br); |
smejky | 12:9bc02f9e16e3 | 2072 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2073 | } |
smejky | 12:9bc02f9e16e3 | 2074 | while(br > 0){ |
smejky | 12:9bc02f9e16e3 | 2075 | br = br - 1; |
smejky | 12:9bc02f9e16e3 | 2076 | send_color(barvy[0],barvy[1],barvy[2],br); |
smejky | 12:9bc02f9e16e3 | 2077 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2078 | } |
smejky | 12:9bc02f9e16e3 | 2079 | } |
smejky | 12:9bc02f9e16e3 | 2080 | |
smejky | 12:9bc02f9e16e3 | 2081 | if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){ |
smejky | 12:9bc02f9e16e3 | 2082 | |
smejky | 12:9bc02f9e16e3 | 2083 | }else{ |
smejky | 12:9bc02f9e16e3 | 2084 | while(br < led_jas) { |
smejky | 12:9bc02f9e16e3 | 2085 | br = br + 1; |
smejky | 12:9bc02f9e16e3 | 2086 | send_color(barvy[3],barvy[4],barvy[5],br); |
smejky | 12:9bc02f9e16e3 | 2087 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2088 | } |
smejky | 12:9bc02f9e16e3 | 2089 | while(br > 0){ |
smejky | 12:9bc02f9e16e3 | 2090 | br = br - 1; |
smejky | 12:9bc02f9e16e3 | 2091 | send_color(barvy[3],barvy[4],barvy[5],br); |
smejky | 12:9bc02f9e16e3 | 2092 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2093 | } |
smejky | 12:9bc02f9e16e3 | 2094 | } |
smejky | 12:9bc02f9e16e3 | 2095 | |
smejky | 12:9bc02f9e16e3 | 2096 | if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){ |
smejky | 12:9bc02f9e16e3 | 2097 | }else{ |
smejky | 12:9bc02f9e16e3 | 2098 | while(br < led_jas) { |
smejky | 12:9bc02f9e16e3 | 2099 | br = br + 1; |
smejky | 12:9bc02f9e16e3 | 2100 | send_color(barvy[6],barvy[7],barvy[8],br); |
smejky | 12:9bc02f9e16e3 | 2101 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2102 | } |
smejky | 12:9bc02f9e16e3 | 2103 | while(br > 0){ |
smejky | 12:9bc02f9e16e3 | 2104 | br = br - 1; |
smejky | 12:9bc02f9e16e3 | 2105 | send_color(barvy[6],barvy[7],barvy[8],br); |
smejky | 12:9bc02f9e16e3 | 2106 | wait(rychlost); |
smejky | 12:9bc02f9e16e3 | 2107 | } |
smejky | 12:9bc02f9e16e3 | 2108 | } |
smejky | 12:9bc02f9e16e3 | 2109 | |
smejky | 12:9bc02f9e16e3 | 2110 | |
smejky | 12:9bc02f9e16e3 | 2111 | } |
smejky | 12:9bc02f9e16e3 | 2112 | } |
smejky | 12:9bc02f9e16e3 | 2113 | |
smejky | 11:4ca8388080c6 | 2114 | int color_picker(){ |
smejky | 11:4ca8388080c6 | 2115 | |
smejky | 12:9bc02f9e16e3 | 2116 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 12:9bc02f9e16e3 | 2117 | |
smejky | 11:4ca8388080c6 | 2118 | int pole1[] = {69,29,116,76}; |
smejky | 11:4ca8388080c6 | 2119 | int pole2[] = {117,29,163,76}; |
smejky | 11:4ca8388080c6 | 2120 | int pole3[] = {164,29,210,76}; |
smejky | 11:4ca8388080c6 | 2121 | int pole4[] = {211,29,257,76}; |
smejky | 11:4ca8388080c6 | 2122 | int pole5[] = {69,77,116,123}; |
smejky | 11:4ca8388080c6 | 2123 | int pole6[] = {117,77,163,123}; |
smejky | 11:4ca8388080c6 | 2124 | int pole7[] = {164,77,210,123}; |
smejky | 11:4ca8388080c6 | 2125 | int pole8[] = {211,77,257,123}; |
smejky | 11:4ca8388080c6 | 2126 | int pole9[] = {69,124,116,170}; |
smejky | 11:4ca8388080c6 | 2127 | int pole10[] = {117,124,163,170}; |
smejky | 11:4ca8388080c6 | 2128 | int pole11[] = {164,124,210,170}; |
smejky | 11:4ca8388080c6 | 2129 | int pole12[] = {211,124,257,170}; |
smejky | 11:4ca8388080c6 | 2130 | |
smejky | 11:4ca8388080c6 | 2131 | |
smejky | 11:4ca8388080c6 | 2132 | int pole4t[] = {29,69,76,116}; |
smejky | 11:4ca8388080c6 | 2133 | int pole3t[] = {29,117,76,163}; |
smejky | 11:4ca8388080c6 | 2134 | int pole2t[] = {29,164,76,210}; |
smejky | 11:4ca8388080c6 | 2135 | int pole1t[] = {29,211,76,257}; |
smejky | 11:4ca8388080c6 | 2136 | int pole8t[] = {77,69,123,116}; |
smejky | 11:4ca8388080c6 | 2137 | int pole7t[] = {77,117,123,163}; |
smejky | 11:4ca8388080c6 | 2138 | int pole6t[] = {77,164,123,210}; |
smejky | 11:4ca8388080c6 | 2139 | int pole5t[] = {77,211,123,257}; |
smejky | 11:4ca8388080c6 | 2140 | int pole12t[] = {124,69,170,116}; |
smejky | 11:4ca8388080c6 | 2141 | int pole11t[] = {124,117,170,163}; |
smejky | 11:4ca8388080c6 | 2142 | int pole10t[] = {124,164,170,210}; |
smejky | 11:4ca8388080c6 | 2143 | int pole9t[] = {124,211,170,257}; |
smejky | 11:4ca8388080c6 | 2144 | |
smejky | 11:4ca8388080c6 | 2145 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 11:4ca8388080c6 | 2146 | spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],Red); |
smejky | 11:4ca8388080c6 | 2147 | spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],Orange); |
smejky | 11:4ca8388080c6 | 2148 | spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],Yellow); |
smejky | 11:4ca8388080c6 | 2149 | spi.fillrect(pole4[0],pole4[1],pole4[2],pole4[3],GreenYellow); |
smejky | 11:4ca8388080c6 | 2150 | spi.fillrect(pole5[0],pole5[1],pole5[2],pole5[3],Green); |
smejky | 11:4ca8388080c6 | 2151 | spi.fillrect(pole6[0],pole6[1],pole6[2],pole6[3],White); |
smejky | 11:4ca8388080c6 | 2152 | spi.fillrect(pole7[0],pole7[1],pole7[2],pole7[3],Cyan); |
smejky | 11:4ca8388080c6 | 2153 | spi.fillrect(pole8[0],pole8[1],pole8[2],pole8[3],DarkCyan); |
smejky | 11:4ca8388080c6 | 2154 | spi.fillrect(pole9[0],pole9[1],pole9[2],pole9[3],Blue); |
smejky | 11:4ca8388080c6 | 2155 | spi.fillrect(pole10[0],pole10[1],pole10[2],pole10[3],Purple); |
smejky | 11:4ca8388080c6 | 2156 | spi.fillrect(pole11[0],pole11[1],pole11[2],pole11[3],Magenta); |
smejky | 11:4ca8388080c6 | 2157 | spi.fillrect(pole12[0],pole12[1],pole12[2],pole12[3],Pink); |
smejky | 11:4ca8388080c6 | 2158 | |
smejky | 11:4ca8388080c6 | 2159 | |
smejky | 11:4ca8388080c6 | 2160 | while(1) |
smejky | 11:4ca8388080c6 | 2161 | { |
smejky | 11:4ca8388080c6 | 2162 | if (touch.DataAvailable()) |
smejky | 11:4ca8388080c6 | 2163 | { |
smejky | 11:4ca8388080c6 | 2164 | if(touch.Read()) |
smejky | 11:4ca8388080c6 | 2165 | { |
smejky | 11:4ca8388080c6 | 2166 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 11:4ca8388080c6 | 2167 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 12:9bc02f9e16e3 | 2168 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 2169 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 12:9bc02f9e16e3 | 2170 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 2171 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 2172 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 12:9bc02f9e16e3 | 2173 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 2174 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 2175 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 2176 | |
smejky | 12:9bc02f9e16e3 | 2177 | hold(); |
smejky | 12:9bc02f9e16e3 | 2178 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch); |
smejky | 12:9bc02f9e16e3 | 2179 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit);// levy |
smejky | 12:9bc02f9e16e3 | 2180 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek); |
smejky | 12:9bc02f9e16e3 | 2181 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek); |
smejky | 12:9bc02f9e16e3 | 2182 | return Black; |
smejky | 12:9bc02f9e16e3 | 2183 | } |
smejky | 12:9bc02f9e16e3 | 2184 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 2185 | |
smejky | 12:9bc02f9e16e3 | 2186 | |
smejky | 11:4ca8388080c6 | 2187 | |
smejky | 11:4ca8388080c6 | 2188 | if((touch_x > pole1t[0]) && (touch_x < pole1t[2]) && (touch_y < pole1t[3]) && (touch_y > pole1t[1])){ |
smejky | 11:4ca8388080c6 | 2189 | hold(); |
smejky | 11:4ca8388080c6 | 2190 | return Red; |
smejky | 11:4ca8388080c6 | 2191 | } |
smejky | 11:4ca8388080c6 | 2192 | |
smejky | 11:4ca8388080c6 | 2193 | if((touch_x > pole2t[0]) && (touch_x < pole2t[2]) && (touch_y < pole2t[3]) && (touch_y > pole2t[1])){ |
smejky | 11:4ca8388080c6 | 2194 | hold(); |
smejky | 11:4ca8388080c6 | 2195 | return Orange; |
smejky | 11:4ca8388080c6 | 2196 | } |
smejky | 11:4ca8388080c6 | 2197 | |
smejky | 11:4ca8388080c6 | 2198 | if((touch_x > pole3t[0]) && (touch_x < pole3t[2]) && (touch_y < pole3t[3]) && (touch_y > pole3t[1])){ |
smejky | 11:4ca8388080c6 | 2199 | hold(); |
smejky | 11:4ca8388080c6 | 2200 | return Yellow; |
smejky | 11:4ca8388080c6 | 2201 | } |
smejky | 11:4ca8388080c6 | 2202 | |
smejky | 11:4ca8388080c6 | 2203 | if((touch_x > pole4t[0]) && (touch_x < pole4t[2]) && (touch_y < pole4t[3]) && (touch_y > pole4t[1])){ |
smejky | 11:4ca8388080c6 | 2204 | hold(); |
smejky | 11:4ca8388080c6 | 2205 | return GreenYellow; |
smejky | 11:4ca8388080c6 | 2206 | } |
smejky | 11:4ca8388080c6 | 2207 | |
smejky | 11:4ca8388080c6 | 2208 | if((touch_x > pole5t[0]) && (touch_x < pole5t[2]) && (touch_y < pole5t[3]) && (touch_y > pole5t[1])){ |
smejky | 11:4ca8388080c6 | 2209 | hold(); |
smejky | 11:4ca8388080c6 | 2210 | return Green; |
smejky | 11:4ca8388080c6 | 2211 | } |
smejky | 11:4ca8388080c6 | 2212 | |
smejky | 11:4ca8388080c6 | 2213 | if((touch_x > pole6t[0]) && (touch_x < pole6t[2]) && (touch_y < pole6t[3]) && (touch_y > pole6t[1])){ |
smejky | 11:4ca8388080c6 | 2214 | hold(); |
smejky | 11:4ca8388080c6 | 2215 | return White; |
smejky | 11:4ca8388080c6 | 2216 | } |
smejky | 11:4ca8388080c6 | 2217 | |
smejky | 11:4ca8388080c6 | 2218 | if((touch_x > pole7t[0]) && (touch_x < pole7t[2]) && (touch_y < pole7t[3]) && (touch_y > pole7t[1])){ |
smejky | 11:4ca8388080c6 | 2219 | hold(); |
smejky | 11:4ca8388080c6 | 2220 | return Cyan; |
smejky | 11:4ca8388080c6 | 2221 | } |
smejky | 11:4ca8388080c6 | 2222 | |
smejky | 11:4ca8388080c6 | 2223 | if((touch_x > pole8t[0]) && (touch_x < pole8t[2]) && (touch_y < pole8t[3]) && (touch_y > pole8t[1])){ |
smejky | 11:4ca8388080c6 | 2224 | hold(); |
smejky | 11:4ca8388080c6 | 2225 | return DarkCyan; |
smejky | 11:4ca8388080c6 | 2226 | } |
smejky | 11:4ca8388080c6 | 2227 | |
smejky | 11:4ca8388080c6 | 2228 | if((touch_x > pole9t[0]) && (touch_x < pole9t[2]) && (touch_y < pole9t[3]) && (touch_y > pole9t[1])){ |
smejky | 11:4ca8388080c6 | 2229 | hold(); |
smejky | 11:4ca8388080c6 | 2230 | return Blue; |
smejky | 11:4ca8388080c6 | 2231 | } |
smejky | 11:4ca8388080c6 | 2232 | |
smejky | 11:4ca8388080c6 | 2233 | if((touch_x > pole10t[0]) && (touch_x < pole10t[2]) && (touch_y < pole10t[3]) && (touch_y > pole10t[1])){ |
smejky | 11:4ca8388080c6 | 2234 | hold(); |
smejky | 11:4ca8388080c6 | 2235 | return Purple; |
smejky | 11:4ca8388080c6 | 2236 | } |
smejky | 11:4ca8388080c6 | 2237 | |
smejky | 11:4ca8388080c6 | 2238 | if((touch_x > pole11t[0]) && (touch_x < pole11t[2]) && (touch_y < pole11t[3]) && (touch_y > pole11t[1])){ |
smejky | 11:4ca8388080c6 | 2239 | hold(); |
smejky | 11:4ca8388080c6 | 2240 | return Magenta; |
smejky | 11:4ca8388080c6 | 2241 | } |
smejky | 11:4ca8388080c6 | 2242 | |
smejky | 11:4ca8388080c6 | 2243 | if((touch_x > pole12t[0]) && (touch_x < pole12t[2]) && (touch_y < pole12t[3]) && (touch_y > pole12t[1])){ |
smejky | 11:4ca8388080c6 | 2244 | hold(); |
smejky | 11:4ca8388080c6 | 2245 | return Pink; |
smejky | 11:4ca8388080c6 | 2246 | } |
smejky | 11:4ca8388080c6 | 2247 | } |
smejky | 11:4ca8388080c6 | 2248 | } |
smejky | 11:4ca8388080c6 | 2249 | } |
smejky | 11:4ca8388080c6 | 2250 | |
smejky | 11:4ca8388080c6 | 2251 | } |
smejky | 11:4ca8388080c6 | 2252 | |
smejky | 12:9bc02f9e16e3 | 2253 | int brightness_led(){ |
smejky | 12:9bc02f9e16e3 | 2254 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 12:9bc02f9e16e3 | 2255 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 12:9bc02f9e16e3 | 2256 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 12:9bc02f9e16e3 | 2257 | |
smejky | 12:9bc02f9e16e3 | 2258 | int jas_temp = led_jas; |
smejky | 12:9bc02f9e16e3 | 2259 | |
smejky | 12:9bc02f9e16e3 | 2260 | int p10t[] = {229,52,264,147}; |
smejky | 12:9bc02f9e16e3 | 2261 | int p30t[] = {186,52,221,147}; |
smejky | 12:9bc02f9e16e3 | 2262 | int p50t[] = {143,52,178,147}; |
smejky | 12:9bc02f9e16e3 | 2263 | int p70t[] = {100,52,135,147}; |
smejky | 12:9bc02f9e16e3 | 2264 | int p90t[] = {57,52,92,147}; |
smejky | 12:9bc02f9e16e3 | 2265 | |
smejky | 12:9bc02f9e16e3 | 2266 | int p10[] = {57,52,92,147}; |
smejky | 12:9bc02f9e16e3 | 2267 | int p30[] = {100,52,135,147}; |
smejky | 12:9bc02f9e16e3 | 2268 | int p50[] = {143,52,178,147}; |
smejky | 12:9bc02f9e16e3 | 2269 | int p70[] = {186,52,221,147}; |
smejky | 12:9bc02f9e16e3 | 2270 | int p90[] = {229,52,264,147}; |
smejky | 12:9bc02f9e16e3 | 2271 | |
smejky | 12:9bc02f9e16e3 | 2272 | int change = jas_led; |
smejky | 12:9bc02f9e16e3 | 2273 | |
smejky | 12:9bc02f9e16e3 | 2274 | switch(jas_led){ |
smejky | 12:9bc02f9e16e3 | 2275 | case 0: |
smejky | 12:9bc02f9e16e3 | 2276 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2277 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2278 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2279 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2280 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2281 | break; |
smejky | 12:9bc02f9e16e3 | 2282 | case 1: |
smejky | 12:9bc02f9e16e3 | 2283 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2284 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2285 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2286 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2287 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2288 | break; |
smejky | 12:9bc02f9e16e3 | 2289 | case 2: |
smejky | 12:9bc02f9e16e3 | 2290 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2291 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2292 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2293 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2294 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2295 | break; |
smejky | 12:9bc02f9e16e3 | 2296 | case 3: |
smejky | 12:9bc02f9e16e3 | 2297 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2298 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2299 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2300 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2301 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2302 | break; |
smejky | 12:9bc02f9e16e3 | 2303 | case 4: |
smejky | 12:9bc02f9e16e3 | 2304 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2305 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2306 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2307 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2308 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2309 | break; |
smejky | 12:9bc02f9e16e3 | 2310 | default: |
smejky | 12:9bc02f9e16e3 | 2311 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 2312 | |
smejky | 12:9bc02f9e16e3 | 2313 | } |
smejky | 12:9bc02f9e16e3 | 2314 | |
smejky | 12:9bc02f9e16e3 | 2315 | while(1){ |
smejky | 12:9bc02f9e16e3 | 2316 | if(change == jas_led){ |
smejky | 12:9bc02f9e16e3 | 2317 | }else{ |
smejky | 12:9bc02f9e16e3 | 2318 | change = jas_led; |
smejky | 12:9bc02f9e16e3 | 2319 | switch(jas_led){ |
smejky | 12:9bc02f9e16e3 | 2320 | case 0: |
smejky | 12:9bc02f9e16e3 | 2321 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2322 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2323 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2324 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2325 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2326 | break; |
smejky | 12:9bc02f9e16e3 | 2327 | case 1: |
smejky | 12:9bc02f9e16e3 | 2328 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2329 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2330 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2331 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2332 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2333 | break; |
smejky | 12:9bc02f9e16e3 | 2334 | case 2: |
smejky | 12:9bc02f9e16e3 | 2335 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2336 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2337 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2338 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2339 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2340 | break; |
smejky | 12:9bc02f9e16e3 | 2341 | case 3: |
smejky | 12:9bc02f9e16e3 | 2342 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2343 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2344 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2345 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2346 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 12:9bc02f9e16e3 | 2347 | break; |
smejky | 12:9bc02f9e16e3 | 2348 | case 4: |
smejky | 12:9bc02f9e16e3 | 2349 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2350 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2351 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2352 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2353 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]); |
smejky | 12:9bc02f9e16e3 | 2354 | break; |
smejky | 12:9bc02f9e16e3 | 2355 | default: |
smejky | 12:9bc02f9e16e3 | 2356 | printf("err"); |
smejky | 12:9bc02f9e16e3 | 2357 | |
smejky | 12:9bc02f9e16e3 | 2358 | } |
smejky | 12:9bc02f9e16e3 | 2359 | |
smejky | 12:9bc02f9e16e3 | 2360 | } |
smejky | 12:9bc02f9e16e3 | 2361 | |
smejky | 12:9bc02f9e16e3 | 2362 | if (touch.DataAvailable()) |
smejky | 12:9bc02f9e16e3 | 2363 | { |
smejky | 12:9bc02f9e16e3 | 2364 | if(touch.Read()) |
smejky | 12:9bc02f9e16e3 | 2365 | { |
smejky | 12:9bc02f9e16e3 | 2366 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 12:9bc02f9e16e3 | 2367 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 12:9bc02f9e16e3 | 2368 | |
smejky | 12:9bc02f9e16e3 | 2369 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 2370 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 12:9bc02f9e16e3 | 2371 | |
smejky | 12:9bc02f9e16e3 | 2372 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 2373 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 2374 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 12:9bc02f9e16e3 | 2375 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 2376 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 2377 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 2378 | hold(); |
smejky | 12:9bc02f9e16e3 | 2379 | |
smejky | 12:9bc02f9e16e3 | 2380 | grafika(9); |
smejky | 12:9bc02f9e16e3 | 2381 | return jas_temp; |
smejky | 12:9bc02f9e16e3 | 2382 | } |
smejky | 12:9bc02f9e16e3 | 2383 | //pravý čudlik |
smejky | 12:9bc02f9e16e3 | 2384 | |
smejky | 12:9bc02f9e16e3 | 2385 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 2386 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 12:9bc02f9e16e3 | 2387 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 2388 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 12:9bc02f9e16e3 | 2389 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 12:9bc02f9e16e3 | 2390 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 2391 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 12:9bc02f9e16e3 | 2392 | //GRAFIKA************************************************** |
smejky | 12:9bc02f9e16e3 | 2393 | |
smejky | 12:9bc02f9e16e3 | 2394 | hold(); |
smejky | 12:9bc02f9e16e3 | 2395 | jas_temp = 0; |
smejky | 12:9bc02f9e16e3 | 2396 | grafika(7); |
smejky | 12:9bc02f9e16e3 | 2397 | return jas_led; |
smejky | 12:9bc02f9e16e3 | 2398 | } |
smejky | 12:9bc02f9e16e3 | 2399 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 2400 | |
smejky | 12:9bc02f9e16e3 | 2401 | if((touch_x > p10t[1]) && (touch_x < p10t[3]) && (touch_y < p10t[2]) && (touch_y > p10t[0])){ |
smejky | 12:9bc02f9e16e3 | 2402 | hold(); |
smejky | 12:9bc02f9e16e3 | 2403 | jas_led = 0; |
smejky | 12:9bc02f9e16e3 | 2404 | jas_temp = 10; |
smejky | 12:9bc02f9e16e3 | 2405 | } |
smejky | 12:9bc02f9e16e3 | 2406 | |
smejky | 12:9bc02f9e16e3 | 2407 | if((touch_x > p30t[1]) && (touch_x < p30t[3]) && (touch_y < p30t[2]) && (touch_y > p30t[0])){ |
smejky | 12:9bc02f9e16e3 | 2408 | hold(); |
smejky | 12:9bc02f9e16e3 | 2409 | jas_led = 1; |
smejky | 12:9bc02f9e16e3 | 2410 | jas_temp = 30; |
smejky | 12:9bc02f9e16e3 | 2411 | } |
smejky | 12:9bc02f9e16e3 | 2412 | if((touch_x > p50t[1]) && (touch_x < p50t[3]) && (touch_y < p50t[2]) && (touch_y > p50t[0])){ |
smejky | 12:9bc02f9e16e3 | 2413 | hold(); |
smejky | 12:9bc02f9e16e3 | 2414 | jas_led = 2; |
smejky | 12:9bc02f9e16e3 | 2415 | jas_temp = 50; |
smejky | 12:9bc02f9e16e3 | 2416 | |
smejky | 12:9bc02f9e16e3 | 2417 | } |
smejky | 12:9bc02f9e16e3 | 2418 | if((touch_x > p70t[1]) && (touch_x < p70t[3]) && (touch_y < p70t[2]) && (touch_y > p70t[0])){ |
smejky | 12:9bc02f9e16e3 | 2419 | hold(); |
smejky | 12:9bc02f9e16e3 | 2420 | jas_led = 3; |
smejky | 12:9bc02f9e16e3 | 2421 | jas_temp = 70; |
smejky | 12:9bc02f9e16e3 | 2422 | } |
smejky | 12:9bc02f9e16e3 | 2423 | if((touch_x > p90t[1]) && (touch_x < p90t[3]) && (touch_y < p90t[2]) && (touch_y > p90t[0])){ |
smejky | 12:9bc02f9e16e3 | 2424 | hold(); |
smejky | 12:9bc02f9e16e3 | 2425 | jas_led = 4; |
smejky | 12:9bc02f9e16e3 | 2426 | jas_temp = 90; |
smejky | 12:9bc02f9e16e3 | 2427 | } |
smejky | 12:9bc02f9e16e3 | 2428 | |
smejky | 12:9bc02f9e16e3 | 2429 | |
smejky | 12:9bc02f9e16e3 | 2430 | } |
smejky | 12:9bc02f9e16e3 | 2431 | } |
smejky | 12:9bc02f9e16e3 | 2432 | } |
smejky | 12:9bc02f9e16e3 | 2433 | } |
smejky | 12:9bc02f9e16e3 | 2434 | |
smejky | 12:9bc02f9e16e3 | 2435 | |
smejky | 12:9bc02f9e16e3 | 2436 | |
smejky | 11:4ca8388080c6 | 2437 | |
smejky | 9:d1385f7171af | 2438 | void nastaveni(){ |
smejky | 9:d1385f7171af | 2439 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 9:d1385f7171af | 2440 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 9:d1385f7171af | 2441 | int i = 0; |
smejky | 12:9bc02f9e16e3 | 2442 | int stredni_pravy[] = {200,0,240,106}; //stred levy spodni cudlik |
smejky | 9:d1385f7171af | 2443 | |
smejky | 9:d1385f7171af | 2444 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 9:d1385f7171af | 2445 | int check1[] = {66,10,96,40}; |
smejky | 9:d1385f7171af | 2446 | int check2[] = {66,56,96,86}; |
smejky | 9:d1385f7171af | 2447 | |
smejky | 10:0176705be216 | 2448 | int prvni[] = {46,0,273,46}; //prvni čudlík |
smejky | 10:0176705be216 | 2449 | int druhy[] = {46,46,273,92}; //druhy čudlík |
smejky | 10:0176705be216 | 2450 | int treti[] = {46,92,273,138}; //treti čudlík |
smejky | 10:0176705be216 | 2451 | int ctvrty[] = {46,138,273,184}; //treti čudlík |
smejky | 10:0176705be216 | 2452 | |
smejky | 9:d1385f7171af | 2453 | |
smejky | 9:d1385f7171af | 2454 | spi.background(MojeSeda); |
smejky | 9:d1385f7171af | 2455 | spi.fillrect(prvni[0],prvni[1],prvni[2],prvni[3],MojeSeda); //prvni |
smejky | 9:d1385f7171af | 2456 | spi.rect(prvni[0],prvni[1],prvni[2],prvni[3],White); //prvni |
smejky | 9:d1385f7171af | 2457 | spi.set_font((unsigned char*) Arial28x28); |
smejky | 9:d1385f7171af | 2458 | spi.locate(140,14); |
smejky | 9:d1385f7171af | 2459 | spi.printf(jazyk[0]); |
smejky | 9:d1385f7171af | 2460 | |
smejky | 9:d1385f7171af | 2461 | spi.fillrect(druhy[0],druhy[1],druhy[2],druhy[3],MojeSeda); //druhy |
smejky | 9:d1385f7171af | 2462 | spi.rect(druhy[0],druhy[1],druhy[2],druhy[3],White); //druhy |
smejky | 9:d1385f7171af | 2463 | spi.locate(140,60); |
smejky | 9:d1385f7171af | 2464 | spi.printf(jazyk[1]); |
smejky | 9:d1385f7171af | 2465 | |
smejky | 9:d1385f7171af | 2466 | switch(lang) |
smejky | 9:d1385f7171af | 2467 | { |
smejky | 9:d1385f7171af | 2468 | case 1: |
smejky | 9:d1385f7171af | 2469 | spi.fillrect(check1[0],check1[1],check1[2],check1[3],Green); |
smejky | 9:d1385f7171af | 2470 | spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red); |
smejky | 9:d1385f7171af | 2471 | break; |
smejky | 9:d1385f7171af | 2472 | default: |
smejky | 9:d1385f7171af | 2473 | spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red); |
smejky | 9:d1385f7171af | 2474 | spi.fillrect(check2[0],check2[1],check2[2],check2[3],Green); |
smejky | 9:d1385f7171af | 2475 | } |
smejky | 9:d1385f7171af | 2476 | |
smejky | 9:d1385f7171af | 2477 | |
smejky | 9:d1385f7171af | 2478 | spi.fillrect(treti[0],treti[1],treti[2],treti[3],MojeSeda); //treti |
smejky | 9:d1385f7171af | 2479 | spi.rect(treti[0],treti[1],treti[2],treti[3],White); //treti |
smejky | 9:d1385f7171af | 2480 | spi.locate(90,106); |
smejky | 9:d1385f7171af | 2481 | spi.printf(jazyk[2]); |
smejky | 10:0176705be216 | 2482 | |
smejky | 10:0176705be216 | 2483 | spi.fillrect(ctvrty[0],ctvrty[1],ctvrty[2],ctvrty[3],MojeSeda); //ctvrty |
smejky | 10:0176705be216 | 2484 | spi.rect(ctvrty[0],ctvrty[1],ctvrty[2],ctvrty[3],White); //ctvrty |
smejky | 10:0176705be216 | 2485 | spi.locate(95,152); |
smejky | 10:0176705be216 | 2486 | spi.printf(jazyk[3]); |
smejky | 10:0176705be216 | 2487 | |
smejky | 10:0176705be216 | 2488 | |
smejky | 9:d1385f7171af | 2489 | while(1){ |
smejky | 9:d1385f7171af | 2490 | if (touch.DataAvailable()) |
smejky | 9:d1385f7171af | 2491 | { |
smejky | 9:d1385f7171af | 2492 | if(touch.Read()) |
smejky | 9:d1385f7171af | 2493 | { |
smejky | 9:d1385f7171af | 2494 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 9:d1385f7171af | 2495 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 9:d1385f7171af | 2496 | |
smejky | 9:d1385f7171af | 2497 | //pravý čudlik |
smejky | 9:d1385f7171af | 2498 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 9:d1385f7171af | 2499 | |
smejky | 9:d1385f7171af | 2500 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2501 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 9:d1385f7171af | 2502 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 9:d1385f7171af | 2503 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2504 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2505 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2506 | hold(); |
smejky | 9:d1385f7171af | 2507 | switch(jazyk_s) |
smejky | 9:d1385f7171af | 2508 | { |
smejky | 9:d1385f7171af | 2509 | case 1: |
smejky | 12:9bc02f9e16e3 | 2510 | while(i < 6){ |
smejky | 9:d1385f7171af | 2511 | strcpy(jazyk[i], cz[i]); |
smejky | 9:d1385f7171af | 2512 | i++; |
smejky | 9:d1385f7171af | 2513 | } |
smejky | 9:d1385f7171af | 2514 | break; |
smejky | 9:d1385f7171af | 2515 | default: |
smejky | 12:9bc02f9e16e3 | 2516 | while(i < 6){ |
smejky | 9:d1385f7171af | 2517 | strcpy(jazyk[i], en[i]); |
smejky | 9:d1385f7171af | 2518 | i++; |
smejky | 9:d1385f7171af | 2519 | } |
smejky | 9:d1385f7171af | 2520 | } |
smejky | 9:d1385f7171af | 2521 | i = 0; |
smejky | 9:d1385f7171af | 2522 | grafika(1); |
smejky | 9:d1385f7171af | 2523 | grafika(2); |
smejky | 9:d1385f7171af | 2524 | Menu(); |
smejky | 9:d1385f7171af | 2525 | wait(0.2); |
smejky | 9:d1385f7171af | 2526 | } |
smejky | 9:d1385f7171af | 2527 | //pravý čudlik |
smejky | 9:d1385f7171af | 2528 | |
smejky | 9:d1385f7171af | 2529 | //levý čudlik |
smejky | 9:d1385f7171af | 2530 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 9:d1385f7171af | 2531 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2532 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 9:d1385f7171af | 2533 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 9:d1385f7171af | 2534 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2535 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2536 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2537 | |
smejky | 9:d1385f7171af | 2538 | hold(); |
smejky | 9:d1385f7171af | 2539 | |
smejky | 9:d1385f7171af | 2540 | grafika(2); |
smejky | 9:d1385f7171af | 2541 | grafika(1); |
smejky | 9:d1385f7171af | 2542 | Menu(); |
smejky | 9:d1385f7171af | 2543 | wait(0.2); |
smejky | 9:d1385f7171af | 2544 | } |
smejky | 9:d1385f7171af | 2545 | //levý čudlik |
smejky | 12:9bc02f9e16e3 | 2546 | //stred pravy spodni cudlik |
smejky | 12:9bc02f9e16e3 | 2547 | if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){ |
smejky | 12:9bc02f9e16e3 | 2548 | spi.fillrect(214,200,320,240,Select); |
smejky | 12:9bc02f9e16e3 | 2549 | spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s); |
smejky | 12:9bc02f9e16e3 | 2550 | hold(); |
smejky | 12:9bc02f9e16e3 | 2551 | grafika(5); |
smejky | 12:9bc02f9e16e3 | 2552 | Menu(1); |
smejky | 12:9bc02f9e16e3 | 2553 | |
smejky | 12:9bc02f9e16e3 | 2554 | } |
smejky | 12:9bc02f9e16e3 | 2555 | //stred pravy spodni cudlik |
smejky | 9:d1385f7171af | 2556 | if((touch_x > prvni[1]) && (touch_x < prvni[3]) && (touch_y < prvni[2]) && (touch_y > prvni[0])){ |
smejky | 9:d1385f7171af | 2557 | hold(); |
smejky | 9:d1385f7171af | 2558 | jazyk_s = 1; |
smejky | 9:d1385f7171af | 2559 | lang = jazyk_s; |
smejky | 9:d1385f7171af | 2560 | spi.fillrect(check1[0],check1[1],check1[2],check1[3],Green); |
smejky | 9:d1385f7171af | 2561 | spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red); |
smejky | 9:d1385f7171af | 2562 | wait(0.2); |
smejky | 9:d1385f7171af | 2563 | } |
smejky | 9:d1385f7171af | 2564 | if((touch_x > druhy[1]) && (touch_x < druhy[3]) && (touch_y < druhy[2]) && (touch_y > druhy[0])){ |
smejky | 9:d1385f7171af | 2565 | hold(); |
smejky | 9:d1385f7171af | 2566 | jazyk_s = 0; |
smejky | 9:d1385f7171af | 2567 | lang = jazyk_s; |
smejky | 9:d1385f7171af | 2568 | spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red); |
smejky | 9:d1385f7171af | 2569 | spi.fillrect(check2[0],check2[1],check2[2],check2[3],Green); |
smejky | 9:d1385f7171af | 2570 | wait(0.2); |
smejky | 9:d1385f7171af | 2571 | } |
smejky | 9:d1385f7171af | 2572 | if((touch_x > treti[1]) && (touch_x < treti[3]) && (touch_y < treti[2]) && (touch_y > treti[0])){ |
smejky | 9:d1385f7171af | 2573 | hold(); |
smejky | 9:d1385f7171af | 2574 | nastavit_hodiny(); |
smejky | 9:d1385f7171af | 2575 | } |
smejky | 10:0176705be216 | 2576 | if((touch_x > ctvrty[1]) && (touch_x < ctvrty[3]) && (touch_y < ctvrty[2]) && (touch_y > ctvrty[0])){ |
smejky | 10:0176705be216 | 2577 | hold(); |
smejky | 10:0176705be216 | 2578 | brightness(); |
smejky | 10:0176705be216 | 2579 | } |
smejky | 9:d1385f7171af | 2580 | |
smejky | 9:d1385f7171af | 2581 | |
smejky | 9:d1385f7171af | 2582 | } |
smejky | 9:d1385f7171af | 2583 | } |
smejky | 9:d1385f7171af | 2584 | } |
smejky | 9:d1385f7171af | 2585 | |
smejky | 9:d1385f7171af | 2586 | } |
smejky | 9:d1385f7171af | 2587 | |
smejky | 10:0176705be216 | 2588 | |
smejky | 10:0176705be216 | 2589 | void brightness(){ |
smejky | 10:0176705be216 | 2590 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 9:d1385f7171af | 2591 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 9:d1385f7171af | 2592 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 9:d1385f7171af | 2593 | |
smejky | 10:0176705be216 | 2594 | int p10t[] = {229,52,264,147}; |
smejky | 10:0176705be216 | 2595 | int p30t[] = {186,52,221,147}; |
smejky | 10:0176705be216 | 2596 | int p50t[] = {143,52,178,147}; |
smejky | 10:0176705be216 | 2597 | int p70t[] = {100,52,135,147}; |
smejky | 10:0176705be216 | 2598 | int p90t[] = {57,52,92,147}; |
smejky | 10:0176705be216 | 2599 | |
smejky | 10:0176705be216 | 2600 | int p10[] = {57,52,92,147}; |
smejky | 10:0176705be216 | 2601 | int p30[] = {100,52,135,147}; |
smejky | 10:0176705be216 | 2602 | int p50[] = {143,52,178,147}; |
smejky | 10:0176705be216 | 2603 | int p70[] = {186,52,221,147}; |
smejky | 10:0176705be216 | 2604 | int p90[] = {229,52,264,147}; |
smejky | 10:0176705be216 | 2605 | |
smejky | 10:0176705be216 | 2606 | switch(jas_s){ |
smejky | 10:0176705be216 | 2607 | case 0: |
smejky | 10:0176705be216 | 2608 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 10:0176705be216 | 2609 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]); |
smejky | 10:0176705be216 | 2610 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); |
smejky | 10:0176705be216 | 2611 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 10:0176705be216 | 2612 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 10:0176705be216 | 2613 | break; |
smejky | 10:0176705be216 | 2614 | case 1: |
smejky | 10:0176705be216 | 2615 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 10:0176705be216 | 2616 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 10:0176705be216 | 2617 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]); |
smejky | 10:0176705be216 | 2618 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 10:0176705be216 | 2619 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 10:0176705be216 | 2620 | break; |
smejky | 10:0176705be216 | 2621 | case 2: |
smejky | 10:0176705be216 | 2622 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 10:0176705be216 | 2623 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 10:0176705be216 | 2624 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 10:0176705be216 | 2625 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]); |
smejky | 10:0176705be216 | 2626 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 10:0176705be216 | 2627 | break; |
smejky | 10:0176705be216 | 2628 | case 3: |
smejky | 10:0176705be216 | 2629 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 10:0176705be216 | 2630 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 10:0176705be216 | 2631 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 10:0176705be216 | 2632 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); |
smejky | 10:0176705be216 | 2633 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]); |
smejky | 10:0176705be216 | 2634 | break; |
smejky | 10:0176705be216 | 2635 | case 4: |
smejky | 10:0176705be216 | 2636 | spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]); |
smejky | 10:0176705be216 | 2637 | spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]); |
smejky | 10:0176705be216 | 2638 | spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]); |
smejky | 10:0176705be216 | 2639 | spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]); |
smejky | 10:0176705be216 | 2640 | spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]); |
smejky | 10:0176705be216 | 2641 | break; |
smejky | 10:0176705be216 | 2642 | default: |
smejky | 10:0176705be216 | 2643 | printf("err"); |
smejky | 9:d1385f7171af | 2644 | |
smejky | 10:0176705be216 | 2645 | } |
smejky | 9:d1385f7171af | 2646 | |
smejky | 9:d1385f7171af | 2647 | while(1){ |
smejky | 9:d1385f7171af | 2648 | if (touch.DataAvailable()) |
smejky | 9:d1385f7171af | 2649 | { |
smejky | 9:d1385f7171af | 2650 | if(touch.Read()) |
smejky | 9:d1385f7171af | 2651 | { |
smejky | 9:d1385f7171af | 2652 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 9:d1385f7171af | 2653 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 9:d1385f7171af | 2654 | |
smejky | 9:d1385f7171af | 2655 | //pravý čudlik |
smejky | 9:d1385f7171af | 2656 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 9:d1385f7171af | 2657 | |
smejky | 9:d1385f7171af | 2658 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2659 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 9:d1385f7171af | 2660 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 9:d1385f7171af | 2661 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2662 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2663 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2664 | hold(); |
smejky | 9:d1385f7171af | 2665 | |
smejky | 9:d1385f7171af | 2666 | grafika(9); |
smejky | 10:0176705be216 | 2667 | br.write(lcd_jas); |
smejky | 9:d1385f7171af | 2668 | nastaveni(); |
smejky | 9:d1385f7171af | 2669 | wait(0.2); |
smejky | 9:d1385f7171af | 2670 | } |
smejky | 9:d1385f7171af | 2671 | //pravý čudlik |
smejky | 9:d1385f7171af | 2672 | |
smejky | 9:d1385f7171af | 2673 | //levý čudlik |
smejky | 9:d1385f7171af | 2674 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 9:d1385f7171af | 2675 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2676 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 9:d1385f7171af | 2677 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 9:d1385f7171af | 2678 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2679 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 9:d1385f7171af | 2680 | //GRAFIKA************************************************** |
smejky | 9:d1385f7171af | 2681 | |
smejky | 9:d1385f7171af | 2682 | hold(); |
smejky | 10:0176705be216 | 2683 | lcd_jas = 0.00f; |
smejky | 9:d1385f7171af | 2684 | grafika(7); |
smejky | 9:d1385f7171af | 2685 | nastaveni(); |
smejky | 9:d1385f7171af | 2686 | wait(0.2); |
smejky | 9:d1385f7171af | 2687 | } |
smejky | 9:d1385f7171af | 2688 | //levý čudlik |
smejky | 9:d1385f7171af | 2689 | |
smejky | 10:0176705be216 | 2690 | if((touch_x > p10t[1]) && (touch_x < p10t[3]) && (touch_y < p10t[2]) && (touch_y > p10t[0])){ |
smejky | 10:0176705be216 | 2691 | hold(); |
smejky | 10:0176705be216 | 2692 | jas_s = 0; |
smejky | 10:0176705be216 | 2693 | lcd_jas = 0.10f; |
smejky | 10:0176705be216 | 2694 | brightness(); |
smejky | 10:0176705be216 | 2695 | |
smejky | 10:0176705be216 | 2696 | } |
smejky | 10:0176705be216 | 2697 | |
smejky | 10:0176705be216 | 2698 | if((touch_x > p30t[1]) && (touch_x < p30t[3]) && (touch_y < p30t[2]) && (touch_y > p30t[0])){ |
smejky | 10:0176705be216 | 2699 | hold(); |
smejky | 10:0176705be216 | 2700 | jas_s = 1; |
smejky | 10:0176705be216 | 2701 | lcd_jas = 0.30f; |
smejky | 10:0176705be216 | 2702 | brightness(); |
smejky | 10:0176705be216 | 2703 | } |
smejky | 10:0176705be216 | 2704 | if((touch_x > p50t[1]) && (touch_x < p50t[3]) && (touch_y < p50t[2]) && (touch_y > p50t[0])){ |
smejky | 10:0176705be216 | 2705 | hold(); |
smejky | 10:0176705be216 | 2706 | jas_s = 2; |
smejky | 10:0176705be216 | 2707 | lcd_jas = 0.50f; |
smejky | 10:0176705be216 | 2708 | brightness(); |
smejky | 10:0176705be216 | 2709 | |
smejky | 10:0176705be216 | 2710 | } |
smejky | 10:0176705be216 | 2711 | if((touch_x > p70t[1]) && (touch_x < p70t[3]) && (touch_y < p70t[2]) && (touch_y > p70t[0])){ |
smejky | 10:0176705be216 | 2712 | hold(); |
smejky | 10:0176705be216 | 2713 | jas_s = 3; |
smejky | 10:0176705be216 | 2714 | lcd_jas = 0.70f; |
smejky | 10:0176705be216 | 2715 | brightness(); |
smejky | 10:0176705be216 | 2716 | } |
smejky | 10:0176705be216 | 2717 | if((touch_x > p90t[1]) && (touch_x < p90t[3]) && (touch_y < p90t[2]) && (touch_y > p90t[0])){ |
smejky | 10:0176705be216 | 2718 | hold(); |
smejky | 10:0176705be216 | 2719 | jas_s = 4; |
smejky | 10:0176705be216 | 2720 | lcd_jas = 0.90f; |
smejky | 10:0176705be216 | 2721 | brightness(); |
smejky | 10:0176705be216 | 2722 | } |
smejky | 10:0176705be216 | 2723 | |
smejky | 10:0176705be216 | 2724 | |
smejky | 10:0176705be216 | 2725 | } |
smejky | 10:0176705be216 | 2726 | } |
smejky | 10:0176705be216 | 2727 | } |
smejky | 10:0176705be216 | 2728 | } |
smejky | 10:0176705be216 | 2729 | |
smejky | 11:4ca8388080c6 | 2730 | void on_off(){ |
smejky | 11:4ca8388080c6 | 2731 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 11:4ca8388080c6 | 2732 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 11:4ca8388080c6 | 2733 | |
smejky | 11:4ca8388080c6 | 2734 | int up1[] = {172,28,258,57}; |
smejky | 11:4ca8388080c6 | 2735 | int down1[] = {172,142,258,171}; |
smejky | 11:4ca8388080c6 | 2736 | |
smejky | 11:4ca8388080c6 | 2737 | int up2[] = {62,28,148,57}; |
smejky | 11:4ca8388080c6 | 2738 | int down2[] = {62,142,148,171}; |
smejky | 11:4ca8388080c6 | 2739 | |
smejky | 11:4ca8388080c6 | 2740 | bool a = true; |
smejky | 11:4ca8388080c6 | 2741 | |
smejky | 11:4ca8388080c6 | 2742 | cas_hodiny_on = 0; |
smejky | 11:4ca8388080c6 | 2743 | cas_minuty_on = 0; |
smejky | 11:4ca8388080c6 | 2744 | cas_hodiny_off = 0; |
smejky | 11:4ca8388080c6 | 2745 | cas_minuty_off = 0; |
smejky | 11:4ca8388080c6 | 2746 | |
smejky | 11:4ca8388080c6 | 2747 | int h1_on = cas_hodiny_on / 10; |
smejky | 11:4ca8388080c6 | 2748 | int h2_on = cas_hodiny_on % 10; |
smejky | 10:0176705be216 | 2749 | |
smejky | 11:4ca8388080c6 | 2750 | int h1_off = cas_hodiny_off / 10; |
smejky | 11:4ca8388080c6 | 2751 | int h2_off = cas_hodiny_off % 10; |
smejky | 11:4ca8388080c6 | 2752 | |
smejky | 11:4ca8388080c6 | 2753 | char cisla[10][3] = { |
smejky | 11:4ca8388080c6 | 2754 | "0", |
smejky | 11:4ca8388080c6 | 2755 | "1", |
smejky | 11:4ca8388080c6 | 2756 | "2", |
smejky | 11:4ca8388080c6 | 2757 | "3", |
smejky | 11:4ca8388080c6 | 2758 | "4", |
smejky | 11:4ca8388080c6 | 2759 | "5", |
smejky | 11:4ca8388080c6 | 2760 | "6", |
smejky | 11:4ca8388080c6 | 2761 | "7", |
smejky | 11:4ca8388080c6 | 2762 | "8", |
smejky | 11:4ca8388080c6 | 2763 | "9" |
smejky | 11:4ca8388080c6 | 2764 | }; |
smejky | 11:4ca8388080c6 | 2765 | |
smejky | 11:4ca8388080c6 | 2766 | int m1_on = cas_minuty_on / 10; |
smejky | 11:4ca8388080c6 | 2767 | int m2_on = cas_minuty_on % 10; |
smejky | 11:4ca8388080c6 | 2768 | |
smejky | 11:4ca8388080c6 | 2769 | int m1_off = cas_minuty_off / 10; |
smejky | 11:4ca8388080c6 | 2770 | int m2_off = cas_minuty_off % 10; |
smejky | 11:4ca8388080c6 | 2771 | |
smejky | 11:4ca8388080c6 | 2772 | int blue1[] = {71,65,249,134}; |
smejky | 11:4ca8388080c6 | 2773 | int bar2[] = {159,200,320,240}; |
smejky | 11:4ca8388080c6 | 2774 | int bar1[] = {0,200,160,240}; |
smejky | 11:4ca8388080c6 | 2775 | |
smejky | 11:4ca8388080c6 | 2776 | int b1[] = {200,159,240,320}; |
smejky | 11:4ca8388080c6 | 2777 | int b2[] = {200,0,240,160}; |
smejky | 11:4ca8388080c6 | 2778 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 11:4ca8388080c6 | 2779 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 11:4ca8388080c6 | 2780 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 11:4ca8388080c6 | 2781 | |
smejky | 11:4ca8388080c6 | 2782 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 11:4ca8388080c6 | 2783 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 11:4ca8388080c6 | 2784 | |
smejky | 11:4ca8388080c6 | 2785 | |
smejky | 11:4ca8388080c6 | 2786 | spi.fillrect(bar1[0],bar1[1],bar1[2],bar1[3],Select); |
smejky | 11:4ca8388080c6 | 2787 | spi.fillrect(bar2[0],bar2[1],bar2[2],bar2[3],Black); |
smejky | 11:4ca8388080c6 | 2788 | spi.fillrect(blue1[0],blue1[1],blue1[2],blue1[3],MojeSeda); |
smejky | 11:4ca8388080c6 | 2789 | |
smejky | 11:4ca8388080c6 | 2790 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 11:4ca8388080c6 | 2791 | spi.background(Select); |
smejky | 11:4ca8388080c6 | 2792 | spi.locate(55,210); |
smejky | 12:9bc02f9e16e3 | 2793 | spi.printf(jazyk[4]); |
smejky | 11:4ca8388080c6 | 2794 | spi.background(Black); |
smejky | 11:4ca8388080c6 | 2795 | spi.locate(215,210); |
smejky | 12:9bc02f9e16e3 | 2796 | spi.printf(jazyk[5]); |
smejky | 11:4ca8388080c6 | 2797 | |
smejky | 11:4ca8388080c6 | 2798 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 2799 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 2800 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 2801 | spi.printf(cisla[h1_on]); |
smejky | 11:4ca8388080c6 | 2802 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 2803 | spi.printf(cisla[h2_on]); |
smejky | 11:4ca8388080c6 | 2804 | spi.locate(155,80); |
smejky | 11:4ca8388080c6 | 2805 | spi.printf(":"); |
smejky | 11:4ca8388080c6 | 2806 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 2807 | spi.printf(cisla[m1_on]); |
smejky | 11:4ca8388080c6 | 2808 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 2809 | spi.printf(cisla[m2_on]); |
smejky | 11:4ca8388080c6 | 2810 | |
smejky | 11:4ca8388080c6 | 2811 | grafika(9); |
smejky | 11:4ca8388080c6 | 2812 | grafika(7); |
smejky | 11:4ca8388080c6 | 2813 | while(1){ |
smejky | 11:4ca8388080c6 | 2814 | if (touch.DataAvailable()) |
smejky | 11:4ca8388080c6 | 2815 | { |
smejky | 11:4ca8388080c6 | 2816 | if(touch.Read()) |
smejky | 11:4ca8388080c6 | 2817 | { |
smejky | 11:4ca8388080c6 | 2818 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 11:4ca8388080c6 | 2819 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 11:4ca8388080c6 | 2820 | |
smejky | 11:4ca8388080c6 | 2821 | //pravý čudlik |
smejky | 11:4ca8388080c6 | 2822 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 11:4ca8388080c6 | 2823 | |
smejky | 11:4ca8388080c6 | 2824 | //GRAFIKA************************************************** |
smejky | 11:4ca8388080c6 | 2825 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 11:4ca8388080c6 | 2826 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 11:4ca8388080c6 | 2827 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 11:4ca8388080c6 | 2828 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 11:4ca8388080c6 | 2829 | //GRAFIKA************************************************** |
smejky | 11:4ca8388080c6 | 2830 | hold(); |
smejky | 11:4ca8388080c6 | 2831 | |
smejky | 11:4ca8388080c6 | 2832 | time_on = 1037059200 + (cas_hodiny_on * 3600) + (cas_minuty_on * 60); |
smejky | 11:4ca8388080c6 | 2833 | time_off = 1037059200 + (cas_hodiny_off * 3600) + (cas_minuty_off * 60); |
smejky | 11:4ca8388080c6 | 2834 | |
smejky | 11:4ca8388080c6 | 2835 | grafika(); |
smejky | 11:4ca8388080c6 | 2836 | Button(); |
smejky | 11:4ca8388080c6 | 2837 | wait(0.2); |
smejky | 11:4ca8388080c6 | 2838 | } |
smejky | 11:4ca8388080c6 | 2839 | //pravý čudlik |
smejky | 11:4ca8388080c6 | 2840 | |
smejky | 11:4ca8388080c6 | 2841 | //levý čudlik |
smejky | 11:4ca8388080c6 | 2842 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 11:4ca8388080c6 | 2843 | //GRAFIKA************************************************** |
smejky | 11:4ca8388080c6 | 2844 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 11:4ca8388080c6 | 2845 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 11:4ca8388080c6 | 2846 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 11:4ca8388080c6 | 2847 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 11:4ca8388080c6 | 2848 | //GRAFIKA************************************************** |
smejky | 11:4ca8388080c6 | 2849 | |
smejky | 11:4ca8388080c6 | 2850 | hold(); |
smejky | 11:4ca8388080c6 | 2851 | grafika(); |
smejky | 11:4ca8388080c6 | 2852 | Button(); |
smejky | 11:4ca8388080c6 | 2853 | wait(0.2); |
smejky | 11:4ca8388080c6 | 2854 | } |
smejky | 11:4ca8388080c6 | 2855 | //levý čudlik |
smejky | 11:4ca8388080c6 | 2856 | |
smejky | 11:4ca8388080c6 | 2857 | //ON |
smejky | 11:4ca8388080c6 | 2858 | if ((touch_x > b1[0]) && (touch_x < b1[2]) && (touch_y < b1[3]) && (touch_y > b1[1])){ |
smejky | 11:4ca8388080c6 | 2859 | |
smejky | 11:4ca8388080c6 | 2860 | spi.fillrect(bar1[0],bar1[1],bar1[2],bar1[3],Select); |
smejky | 11:4ca8388080c6 | 2861 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 11:4ca8388080c6 | 2862 | spi.background(Select); |
smejky | 11:4ca8388080c6 | 2863 | spi.locate(55,210); |
smejky | 12:9bc02f9e16e3 | 2864 | spi.printf(jazyk[4]); |
smejky | 11:4ca8388080c6 | 2865 | |
smejky | 11:4ca8388080c6 | 2866 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 2867 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 2868 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 2869 | spi.printf(cisla[h1_on]); |
smejky | 11:4ca8388080c6 | 2870 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 2871 | spi.printf(cisla[h2_on]); |
smejky | 11:4ca8388080c6 | 2872 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 2873 | spi.printf(cisla[m1_on]); |
smejky | 11:4ca8388080c6 | 2874 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 2875 | spi.printf(cisla[m2_on]); |
smejky | 11:4ca8388080c6 | 2876 | |
smejky | 11:4ca8388080c6 | 2877 | spi.fillrect(bar2[0],bar2[1],bar2[2],bar2[3],Black); |
smejky | 11:4ca8388080c6 | 2878 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 11:4ca8388080c6 | 2879 | spi.background(Black); |
smejky | 11:4ca8388080c6 | 2880 | spi.locate(215,210); |
smejky | 12:9bc02f9e16e3 | 2881 | spi.printf(jazyk[5]); |
smejky | 11:4ca8388080c6 | 2882 | |
smejky | 11:4ca8388080c6 | 2883 | a = true; |
smejky | 11:4ca8388080c6 | 2884 | hold(); |
smejky | 11:4ca8388080c6 | 2885 | wait(0.2); |
smejky | 11:4ca8388080c6 | 2886 | } |
smejky | 11:4ca8388080c6 | 2887 | //ON |
smejky | 11:4ca8388080c6 | 2888 | |
smejky | 11:4ca8388080c6 | 2889 | //OFF |
smejky | 11:4ca8388080c6 | 2890 | if ((touch_x > b2[0]) && (touch_x < b2[2]) && (touch_y < b2[3]) && (touch_y > b2[1])){ |
smejky | 11:4ca8388080c6 | 2891 | spi.fillrect(bar1[0],bar1[1],bar1[2],bar1[3],Black); |
smejky | 11:4ca8388080c6 | 2892 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 11:4ca8388080c6 | 2893 | spi.background(Black); |
smejky | 11:4ca8388080c6 | 2894 | spi.locate(55,210); |
smejky | 12:9bc02f9e16e3 | 2895 | spi.printf(jazyk[4]); |
smejky | 11:4ca8388080c6 | 2896 | |
smejky | 11:4ca8388080c6 | 2897 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 2898 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 2899 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 2900 | spi.printf(cisla[h1_off]); |
smejky | 11:4ca8388080c6 | 2901 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 2902 | spi.printf(cisla[h2_off]); |
smejky | 11:4ca8388080c6 | 2903 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 2904 | spi.printf(cisla[m1_off]); |
smejky | 11:4ca8388080c6 | 2905 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 2906 | spi.printf(cisla[m2_off]); |
smejky | 11:4ca8388080c6 | 2907 | |
smejky | 11:4ca8388080c6 | 2908 | |
smejky | 11:4ca8388080c6 | 2909 | spi.fillrect(bar2[0],bar2[1],bar2[2],bar2[3],Select); |
smejky | 11:4ca8388080c6 | 2910 | spi.set_font((unsigned char*) Arial21x21); |
smejky | 11:4ca8388080c6 | 2911 | spi.background(Select); |
smejky | 11:4ca8388080c6 | 2912 | spi.locate(215,210); |
smejky | 12:9bc02f9e16e3 | 2913 | spi.printf(jazyk[5]); |
smejky | 11:4ca8388080c6 | 2914 | a = false; |
smejky | 11:4ca8388080c6 | 2915 | hold(); |
smejky | 11:4ca8388080c6 | 2916 | wait(0.2); |
smejky | 11:4ca8388080c6 | 2917 | } |
smejky | 11:4ca8388080c6 | 2918 | //OFF |
smejky | 11:4ca8388080c6 | 2919 | |
smejky | 11:4ca8388080c6 | 2920 | if(a == true){////////////////////////////////////ON |
smejky | 11:4ca8388080c6 | 2921 | if((touch_x > up1[1]) && (touch_x < up1[3]) && (touch_y < up1[2]) && (touch_y > up1[0])){ |
smejky | 11:4ca8388080c6 | 2922 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru_s); |
smejky | 11:4ca8388080c6 | 2923 | while ((touch.DataAvailable()) && (h2_on < 10)){ |
smejky | 11:4ca8388080c6 | 2924 | h2_on++; |
smejky | 11:4ca8388080c6 | 2925 | cas_hodiny_on++; |
smejky | 11:4ca8388080c6 | 2926 | if(cas_hodiny_on == 24){ |
smejky | 11:4ca8388080c6 | 2927 | cas_hodiny_on = 0; |
smejky | 11:4ca8388080c6 | 2928 | } |
smejky | 11:4ca8388080c6 | 2929 | if(h2_on == 10){ |
smejky | 11:4ca8388080c6 | 2930 | h2_on = 0; |
smejky | 11:4ca8388080c6 | 2931 | h1_on++; |
smejky | 11:4ca8388080c6 | 2932 | } |
smejky | 11:4ca8388080c6 | 2933 | if((h1_on == 2)&&(h2_on == 4)){ |
smejky | 11:4ca8388080c6 | 2934 | h2_on = 0; |
smejky | 11:4ca8388080c6 | 2935 | h1_on = 0; |
smejky | 11:4ca8388080c6 | 2936 | } |
smejky | 11:4ca8388080c6 | 2937 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 2938 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 2939 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 2940 | spi.printf(cisla[h1_on]); |
smejky | 11:4ca8388080c6 | 2941 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 2942 | spi.printf(cisla[h2_on]); |
smejky | 11:4ca8388080c6 | 2943 | |
smejky | 11:4ca8388080c6 | 2944 | |
smejky | 11:4ca8388080c6 | 2945 | wait(0.1); |
smejky | 11:4ca8388080c6 | 2946 | } |
smejky | 11:4ca8388080c6 | 2947 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 11:4ca8388080c6 | 2948 | } |
smejky | 11:4ca8388080c6 | 2949 | if((touch_x > down1[1]) && (touch_x < down1[3]) && (touch_y < down1[2]) && (touch_y > down1[0])){ |
smejky | 11:4ca8388080c6 | 2950 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu_s); |
smejky | 11:4ca8388080c6 | 2951 | while ((touch.DataAvailable()) && (h2_on < 10)){ |
smejky | 11:4ca8388080c6 | 2952 | h2_on--; |
smejky | 11:4ca8388080c6 | 2953 | if((h2_on < 0)&&(h1_on == 0)){ |
smejky | 11:4ca8388080c6 | 2954 | h2_on = 3; |
smejky | 11:4ca8388080c6 | 2955 | h1_on = 2; |
smejky | 11:4ca8388080c6 | 2956 | } |
smejky | 11:4ca8388080c6 | 2957 | if(h2_on < 0){ |
smejky | 11:4ca8388080c6 | 2958 | h2_on = 9; |
smejky | 11:4ca8388080c6 | 2959 | h1_on--; |
smejky | 11:4ca8388080c6 | 2960 | } |
smejky | 11:4ca8388080c6 | 2961 | cas_hodiny_on--; |
smejky | 11:4ca8388080c6 | 2962 | if(cas_hodiny_on < 0){ |
smejky | 11:4ca8388080c6 | 2963 | cas_hodiny_on = 23; |
smejky | 11:4ca8388080c6 | 2964 | } |
smejky | 11:4ca8388080c6 | 2965 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 2966 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 2967 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 2968 | spi.printf(cisla[h1_on]); |
smejky | 11:4ca8388080c6 | 2969 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 2970 | spi.printf(cisla[h2_on]); |
smejky | 11:4ca8388080c6 | 2971 | wait(0.1); |
smejky | 11:4ca8388080c6 | 2972 | } |
smejky | 11:4ca8388080c6 | 2973 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 11:4ca8388080c6 | 2974 | } |
smejky | 11:4ca8388080c6 | 2975 | if((touch_x > up2[1]) && (touch_x < up2[3]) && (touch_y < up2[2]) && (touch_y > up2[0])){ |
smejky | 11:4ca8388080c6 | 2976 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru_s); |
smejky | 11:4ca8388080c6 | 2977 | while ((touch.DataAvailable()) && (m2_on < 10)){ |
smejky | 11:4ca8388080c6 | 2978 | m2_on++; |
smejky | 11:4ca8388080c6 | 2979 | cas_minuty_on++; |
smejky | 11:4ca8388080c6 | 2980 | if(cas_minuty_on == 60){ |
smejky | 11:4ca8388080c6 | 2981 | cas_minuty_on = 0; |
smejky | 11:4ca8388080c6 | 2982 | } |
smejky | 11:4ca8388080c6 | 2983 | if((m1_on == 5)&&(m2_on == 10)){ |
smejky | 11:4ca8388080c6 | 2984 | m2_on = 0; |
smejky | 11:4ca8388080c6 | 2985 | m1_on = 0; |
smejky | 11:4ca8388080c6 | 2986 | } |
smejky | 11:4ca8388080c6 | 2987 | if(m2_on == 10){ |
smejky | 11:4ca8388080c6 | 2988 | m2_on = 0; |
smejky | 11:4ca8388080c6 | 2989 | m1_on++; |
smejky | 11:4ca8388080c6 | 2990 | } |
smejky | 11:4ca8388080c6 | 2991 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 2992 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 2993 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 2994 | spi.printf(cisla[m1_on]); |
smejky | 11:4ca8388080c6 | 2995 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 2996 | spi.printf(cisla[m2_on]); |
smejky | 11:4ca8388080c6 | 2997 | wait(0.1); |
smejky | 11:4ca8388080c6 | 2998 | } |
smejky | 11:4ca8388080c6 | 2999 | |
smejky | 11:4ca8388080c6 | 3000 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 11:4ca8388080c6 | 3001 | } |
smejky | 11:4ca8388080c6 | 3002 | if((touch_x > down2[1]) && (touch_x < down2[3]) && (touch_y < down2[2]) && (touch_y > down2[0])){ |
smejky | 11:4ca8388080c6 | 3003 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu_s); |
smejky | 11:4ca8388080c6 | 3004 | while ((touch.DataAvailable()) && (m2_on < 10)){ |
smejky | 11:4ca8388080c6 | 3005 | m2_on--; |
smejky | 11:4ca8388080c6 | 3006 | if((m2_on < 0)&&(m1_on == 0)){ |
smejky | 11:4ca8388080c6 | 3007 | m2_on = 9; |
smejky | 11:4ca8388080c6 | 3008 | m1_on = 5; |
smejky | 11:4ca8388080c6 | 3009 | } |
smejky | 11:4ca8388080c6 | 3010 | if(m2_on < 0){ |
smejky | 11:4ca8388080c6 | 3011 | m2_on = 9; |
smejky | 11:4ca8388080c6 | 3012 | m1_on--; |
smejky | 11:4ca8388080c6 | 3013 | } |
smejky | 11:4ca8388080c6 | 3014 | cas_minuty_on--; |
smejky | 11:4ca8388080c6 | 3015 | if(cas_minuty_on < 0){ |
smejky | 11:4ca8388080c6 | 3016 | cas_minuty_on = 59; |
smejky | 11:4ca8388080c6 | 3017 | } |
smejky | 11:4ca8388080c6 | 3018 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 3019 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 3020 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 3021 | spi.printf(cisla[m1_on]); |
smejky | 11:4ca8388080c6 | 3022 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 3023 | spi.printf(cisla[m2_on]); |
smejky | 11:4ca8388080c6 | 3024 | wait(0.1); |
smejky | 11:4ca8388080c6 | 3025 | } |
smejky | 11:4ca8388080c6 | 3026 | |
smejky | 11:4ca8388080c6 | 3027 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 11:4ca8388080c6 | 3028 | } |
smejky | 11:4ca8388080c6 | 3029 | |
smejky | 11:4ca8388080c6 | 3030 | } |
smejky | 11:4ca8388080c6 | 3031 | else{////////////////////////////////////OFF |
smejky | 11:4ca8388080c6 | 3032 | if((touch_x > up1[1]) && (touch_x < up1[3]) && (touch_y < up1[2]) && (touch_y > up1[0])){ |
smejky | 11:4ca8388080c6 | 3033 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru_s); |
smejky | 11:4ca8388080c6 | 3034 | while ((touch.DataAvailable()) && (h2_off < 10)){ |
smejky | 11:4ca8388080c6 | 3035 | h2_off++; |
smejky | 11:4ca8388080c6 | 3036 | cas_hodiny_off++; |
smejky | 11:4ca8388080c6 | 3037 | if(cas_hodiny_off == 24){ |
smejky | 11:4ca8388080c6 | 3038 | cas_hodiny_off = 0; |
smejky | 11:4ca8388080c6 | 3039 | } |
smejky | 11:4ca8388080c6 | 3040 | if(h2_off == 10){ |
smejky | 11:4ca8388080c6 | 3041 | h2_off = 0; |
smejky | 11:4ca8388080c6 | 3042 | h1_off++; |
smejky | 11:4ca8388080c6 | 3043 | } |
smejky | 11:4ca8388080c6 | 3044 | if((h1_off == 2)&&(h2_off == 4)){ |
smejky | 11:4ca8388080c6 | 3045 | h2_off = 0; |
smejky | 11:4ca8388080c6 | 3046 | h1_off = 0; |
smejky | 11:4ca8388080c6 | 3047 | } |
smejky | 11:4ca8388080c6 | 3048 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 3049 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 3050 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 3051 | spi.printf(cisla[h1_off]); |
smejky | 11:4ca8388080c6 | 3052 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 3053 | spi.printf(cisla[h2_off]); |
smejky | 11:4ca8388080c6 | 3054 | |
smejky | 11:4ca8388080c6 | 3055 | |
smejky | 11:4ca8388080c6 | 3056 | wait(0.1); |
smejky | 11:4ca8388080c6 | 3057 | } |
smejky | 11:4ca8388080c6 | 3058 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 11:4ca8388080c6 | 3059 | } |
smejky | 11:4ca8388080c6 | 3060 | if((touch_x > down1[1]) && (touch_x < down1[3]) && (touch_y < down1[2]) && (touch_y > down1[0])){ |
smejky | 11:4ca8388080c6 | 3061 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu_s); |
smejky | 11:4ca8388080c6 | 3062 | while ((touch.DataAvailable()) && (h2_off < 10)){ |
smejky | 11:4ca8388080c6 | 3063 | h2_off--; |
smejky | 11:4ca8388080c6 | 3064 | if((h2_off < 0)&&(h1_off == 0)){ |
smejky | 11:4ca8388080c6 | 3065 | h2_off = 3; |
smejky | 11:4ca8388080c6 | 3066 | h1_off = 2; |
smejky | 11:4ca8388080c6 | 3067 | } |
smejky | 11:4ca8388080c6 | 3068 | if(h2_off < 0){ |
smejky | 11:4ca8388080c6 | 3069 | h2_off = 9; |
smejky | 11:4ca8388080c6 | 3070 | h1_off--; |
smejky | 11:4ca8388080c6 | 3071 | } |
smejky | 11:4ca8388080c6 | 3072 | cas_hodiny_off--; |
smejky | 11:4ca8388080c6 | 3073 | if(cas_hodiny_off < 0){ |
smejky | 11:4ca8388080c6 | 3074 | cas_hodiny_off = 23; |
smejky | 11:4ca8388080c6 | 3075 | } |
smejky | 11:4ca8388080c6 | 3076 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 3077 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 3078 | spi.locate(80,80); |
smejky | 11:4ca8388080c6 | 3079 | spi.printf(cisla[h1_off]); |
smejky | 11:4ca8388080c6 | 3080 | spi.locate(110,80); |
smejky | 11:4ca8388080c6 | 3081 | spi.printf(cisla[h2_off]); |
smejky | 11:4ca8388080c6 | 3082 | wait(0.1); |
smejky | 11:4ca8388080c6 | 3083 | } |
smejky | 11:4ca8388080c6 | 3084 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 11:4ca8388080c6 | 3085 | } |
smejky | 11:4ca8388080c6 | 3086 | if((touch_x > up2[1]) && (touch_x < up2[3]) && (touch_y < up2[2]) && (touch_y > up2[0])){ |
smejky | 11:4ca8388080c6 | 3087 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru_s); |
smejky | 11:4ca8388080c6 | 3088 | while ((touch.DataAvailable()) && (m2_off < 10)){ |
smejky | 11:4ca8388080c6 | 3089 | m2_off++; |
smejky | 11:4ca8388080c6 | 3090 | cas_minuty_off++; |
smejky | 11:4ca8388080c6 | 3091 | if(cas_minuty_off == 60){ |
smejky | 11:4ca8388080c6 | 3092 | cas_minuty_off = 0; |
smejky | 11:4ca8388080c6 | 3093 | } |
smejky | 11:4ca8388080c6 | 3094 | if((m1_off == 5)&&(m2_off == 10)){ |
smejky | 11:4ca8388080c6 | 3095 | m2_off = 0; |
smejky | 11:4ca8388080c6 | 3096 | m1_off = 0; |
smejky | 11:4ca8388080c6 | 3097 | } |
smejky | 11:4ca8388080c6 | 3098 | if(m2_off == 10){ |
smejky | 11:4ca8388080c6 | 3099 | m2_off = 0; |
smejky | 11:4ca8388080c6 | 3100 | m1_off++; |
smejky | 11:4ca8388080c6 | 3101 | } |
smejky | 11:4ca8388080c6 | 3102 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 3103 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 3104 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 3105 | spi.printf(cisla[m1_off]); |
smejky | 11:4ca8388080c6 | 3106 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 3107 | spi.printf(cisla[m2_off]); |
smejky | 11:4ca8388080c6 | 3108 | wait(0.1); |
smejky | 11:4ca8388080c6 | 3109 | } |
smejky | 11:4ca8388080c6 | 3110 | |
smejky | 11:4ca8388080c6 | 3111 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 11:4ca8388080c6 | 3112 | } |
smejky | 11:4ca8388080c6 | 3113 | if((touch_x > down2[1]) && (touch_x < down2[3]) && (touch_y < down2[2]) && (touch_y > down2[0])){ |
smejky | 11:4ca8388080c6 | 3114 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu_s); |
smejky | 11:4ca8388080c6 | 3115 | while ((touch.DataAvailable()) && (m2_off < 10)){ |
smejky | 11:4ca8388080c6 | 3116 | m2_off--; |
smejky | 11:4ca8388080c6 | 3117 | if((m2_off < 0)&&(m1_off == 0)){ |
smejky | 11:4ca8388080c6 | 3118 | m2_off = 9; |
smejky | 11:4ca8388080c6 | 3119 | m1_off = 5; |
smejky | 11:4ca8388080c6 | 3120 | } |
smejky | 11:4ca8388080c6 | 3121 | if(m2_off < 0){ |
smejky | 11:4ca8388080c6 | 3122 | m2_off = 9; |
smejky | 11:4ca8388080c6 | 3123 | m1_off--; |
smejky | 11:4ca8388080c6 | 3124 | } |
smejky | 11:4ca8388080c6 | 3125 | cas_minuty_off--; |
smejky | 11:4ca8388080c6 | 3126 | if(cas_minuty_off < 0){ |
smejky | 11:4ca8388080c6 | 3127 | cas_minuty_off = 59; |
smejky | 11:4ca8388080c6 | 3128 | } |
smejky | 11:4ca8388080c6 | 3129 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 11:4ca8388080c6 | 3130 | spi.background(MojeSeda); |
smejky | 11:4ca8388080c6 | 3131 | spi.locate(189,80); |
smejky | 11:4ca8388080c6 | 3132 | spi.printf(cisla[m1_off]); |
smejky | 11:4ca8388080c6 | 3133 | spi.locate(219,80); |
smejky | 11:4ca8388080c6 | 3134 | spi.printf(cisla[m2_off]); |
smejky | 11:4ca8388080c6 | 3135 | wait(0.1); |
smejky | 11:4ca8388080c6 | 3136 | } |
smejky | 11:4ca8388080c6 | 3137 | |
smejky | 11:4ca8388080c6 | 3138 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 11:4ca8388080c6 | 3139 | } |
smejky | 11:4ca8388080c6 | 3140 | |
smejky | 11:4ca8388080c6 | 3141 | } |
smejky | 11:4ca8388080c6 | 3142 | |
smejky | 11:4ca8388080c6 | 3143 | |
smejky | 11:4ca8388080c6 | 3144 | } |
smejky | 11:4ca8388080c6 | 3145 | } |
smejky | 11:4ca8388080c6 | 3146 | } |
smejky | 11:4ca8388080c6 | 3147 | } |
smejky | 10:0176705be216 | 3148 | |
smejky | 10:0176705be216 | 3149 | void nastavit_hodiny(){ |
smejky | 10:0176705be216 | 3150 | int pravy[] = {34,0,165,46}; //pravý čudlík |
smejky | 10:0176705be216 | 3151 | int levy[] = {34,274,165,320}; //levý čudlík |
smejky | 10:0176705be216 | 3152 | |
smejky | 10:0176705be216 | 3153 | int up1[] = {172,28,258,57}; |
smejky | 10:0176705be216 | 3154 | int down1[] = {172,142,258,171}; |
smejky | 10:0176705be216 | 3155 | |
smejky | 10:0176705be216 | 3156 | int up2[] = {62,28,148,57}; |
smejky | 10:0176705be216 | 3157 | int down2[] = {62,142,148,171}; |
smejky | 10:0176705be216 | 3158 | |
smejky | 10:0176705be216 | 3159 | cas_hodiny = atoi(hodinka); |
smejky | 10:0176705be216 | 3160 | cas_minuty = atoi(minutka); |
smejky | 10:0176705be216 | 3161 | |
smejky | 10:0176705be216 | 3162 | |
smejky | 10:0176705be216 | 3163 | int h1 = cas_hodiny / 10; |
smejky | 10:0176705be216 | 3164 | int h2 = cas_hodiny % 10; |
smejky | 10:0176705be216 | 3165 | |
smejky | 10:0176705be216 | 3166 | char cisla[10][3] = { |
smejky | 10:0176705be216 | 3167 | "0", |
smejky | 10:0176705be216 | 3168 | "1", |
smejky | 10:0176705be216 | 3169 | "2", |
smejky | 10:0176705be216 | 3170 | "3", |
smejky | 10:0176705be216 | 3171 | "4", |
smejky | 10:0176705be216 | 3172 | "5", |
smejky | 10:0176705be216 | 3173 | "6", |
smejky | 10:0176705be216 | 3174 | "7", |
smejky | 10:0176705be216 | 3175 | "8", |
smejky | 10:0176705be216 | 3176 | "9" |
smejky | 10:0176705be216 | 3177 | }; |
smejky | 10:0176705be216 | 3178 | |
smejky | 10:0176705be216 | 3179 | int m1 = cas_minuty / 10; |
smejky | 10:0176705be216 | 3180 | int m2 = cas_minuty % 10; |
smejky | 10:0176705be216 | 3181 | |
smejky | 10:0176705be216 | 3182 | int blue1[] = {71,65,249,134}; |
smejky | 10:0176705be216 | 3183 | |
smejky | 10:0176705be216 | 3184 | spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi); |
smejky | 10:0176705be216 | 3185 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 10:0176705be216 | 3186 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 10:0176705be216 | 3187 | |
smejky | 10:0176705be216 | 3188 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 10:0176705be216 | 3189 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 10:0176705be216 | 3190 | |
smejky | 10:0176705be216 | 3191 | |
smejky | 10:0176705be216 | 3192 | |
smejky | 10:0176705be216 | 3193 | spi.fillrect(blue1[0],blue1[1],blue1[2],blue1[3],MojeSeda); |
smejky | 10:0176705be216 | 3194 | |
smejky | 10:0176705be216 | 3195 | spi.set_font((unsigned char*) Arial48x47); |
smejky | 10:0176705be216 | 3196 | spi.background(MojeSeda); |
smejky | 10:0176705be216 | 3197 | spi.locate(80,80); |
smejky | 10:0176705be216 | 3198 | spi.printf(cisla[h1]); |
smejky | 10:0176705be216 | 3199 | spi.locate(110,80); |
smejky | 10:0176705be216 | 3200 | spi.printf(cisla[h2]); |
smejky | 10:0176705be216 | 3201 | spi.locate(155,80); |
smejky | 10:0176705be216 | 3202 | spi.printf(":"); |
smejky | 10:0176705be216 | 3203 | spi.locate(189,80); |
smejky | 10:0176705be216 | 3204 | spi.printf(cisla[m1]); |
smejky | 10:0176705be216 | 3205 | spi.locate(219,80); |
smejky | 10:0176705be216 | 3206 | spi.printf(cisla[m2]); |
smejky | 10:0176705be216 | 3207 | |
smejky | 10:0176705be216 | 3208 | |
smejky | 10:0176705be216 | 3209 | while(1){ |
smejky | 10:0176705be216 | 3210 | if (touch.DataAvailable()) |
smejky | 10:0176705be216 | 3211 | { |
smejky | 10:0176705be216 | 3212 | if(touch.Read()) |
smejky | 10:0176705be216 | 3213 | { |
smejky | 10:0176705be216 | 3214 | unsigned short int touch_y = touch.GetX(); // 0-320 |
smejky | 10:0176705be216 | 3215 | unsigned short int touch_x = touch.GetY(); // 0-240 |
smejky | 10:0176705be216 | 3216 | |
smejky | 10:0176705be216 | 3217 | //pravý čudlik |
smejky | 10:0176705be216 | 3218 | if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){ |
smejky | 10:0176705be216 | 3219 | |
smejky | 10:0176705be216 | 3220 | //GRAFIKA************************************************** |
smejky | 10:0176705be216 | 3221 | spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 10:0176705be216 | 3222 | spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s); |
smejky | 10:0176705be216 | 3223 | spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 10:0176705be216 | 3224 | spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 10:0176705be216 | 3225 | //GRAFIKA************************************************** |
smejky | 10:0176705be216 | 3226 | hold(); |
smejky | 11:4ca8388080c6 | 3227 | thread_h.terminate(); |
smejky | 10:0176705be216 | 3228 | cas_nastavit = 1037059200 + (cas_hodiny * 3600) + (cas_minuty * 60); |
smejky | 11:4ca8388080c6 | 3229 | thread_h.start(hodiny); |
smejky | 10:0176705be216 | 3230 | grafika(9); |
smejky | 10:0176705be216 | 3231 | nastaveni(); |
smejky | 10:0176705be216 | 3232 | wait(0.2); |
smejky | 10:0176705be216 | 3233 | } |
smejky | 10:0176705be216 | 3234 | //pravý čudlik |
smejky | 10:0176705be216 | 3235 | |
smejky | 10:0176705be216 | 3236 | //levý čudlik |
smejky | 10:0176705be216 | 3237 | if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){ |
smejky | 10:0176705be216 | 3238 | //GRAFIKA************************************************** |
smejky | 10:0176705be216 | 3239 | spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s); |
smejky | 10:0176705be216 | 3240 | spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy |
smejky | 10:0176705be216 | 3241 | spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 10:0176705be216 | 3242 | spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s); |
smejky | 10:0176705be216 | 3243 | //GRAFIKA************************************************** |
smejky | 10:0176705be216 | 3244 | |
smejky | 10:0176705be216 | 3245 | hold(); |
smejky | 10:0176705be216 | 3246 | |
smejky | 10:0176705be216 | 3247 | |
smejky | 10:0176705be216 | 3248 | |
smejky | 10:0176705be216 | 3249 | grafika(7); |
smejky | 10:0176705be216 | 3250 | nastaveni(); |
smejky | 10:0176705be216 | 3251 | wait(0.2); |
smejky | 10:0176705be216 | 3252 | } |
smejky | 10:0176705be216 | 3253 | //levý čudlik |
smejky | 10:0176705be216 | 3254 | if((touch_x > up1[1]) && (touch_x < up1[3]) && (touch_y < up1[2]) && (touch_y > up1[0])){ |
smejky | 10:0176705be216 | 3255 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru_s); |
smejky | 10:0176705be216 | 3256 | while ((touch.DataAvailable()) && (h2 < 10)){ |
smejky | 10:0176705be216 | 3257 | h2++; |
smejky | 10:0176705be216 | 3258 | cas_hodiny++; |
smejky | 10:0176705be216 | 3259 | if(cas_hodiny == 24){ |
smejky | 10:0176705be216 | 3260 | cas_hodiny = 0; |
smejky | 10:0176705be216 | 3261 | } |
smejky | 10:0176705be216 | 3262 | if(h2 == 10){ |
smejky | 10:0176705be216 | 3263 | h2 = 0; |
smejky | 10:0176705be216 | 3264 | h1++; |
smejky | 10:0176705be216 | 3265 | } |
smejky | 10:0176705be216 | 3266 | if((h1 == 2)&&(h2 == 4)){ |
smejky | 10:0176705be216 | 3267 | h2 = 0; |
smejky | 10:0176705be216 | 3268 | h1 = 0; |
smejky | 10:0176705be216 | 3269 | } |
smejky | 10:0176705be216 | 3270 | |
smejky | 10:0176705be216 | 3271 | spi.locate(80,80); |
smejky | 10:0176705be216 | 3272 | spi.printf(cisla[h1]); |
smejky | 10:0176705be216 | 3273 | spi.locate(110,80); |
smejky | 10:0176705be216 | 3274 | spi.printf(cisla[h2]); |
smejky | 10:0176705be216 | 3275 | |
smejky | 10:0176705be216 | 3276 | |
smejky | 10:0176705be216 | 3277 | wait(0.1); |
smejky | 10:0176705be216 | 3278 | } |
smejky | 10:0176705be216 | 3279 | spi.Bitmap(62,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 10:0176705be216 | 3280 | } |
smejky | 10:0176705be216 | 3281 | if((touch_x > down1[1]) && (touch_x < down1[3]) && (touch_y < down1[2]) && (touch_y > down1[0])){ |
smejky | 10:0176705be216 | 3282 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu_s); |
smejky | 10:0176705be216 | 3283 | while ((touch.DataAvailable()) && (h2 < 10)){ |
smejky | 10:0176705be216 | 3284 | h2--; |
smejky | 10:0176705be216 | 3285 | if((h2 < 0)&&(h1 == 0)){ |
smejky | 10:0176705be216 | 3286 | h2 = 3; |
smejky | 10:0176705be216 | 3287 | h1 = 2; |
smejky | 10:0176705be216 | 3288 | } |
smejky | 10:0176705be216 | 3289 | if(h2 < 0){ |
smejky | 10:0176705be216 | 3290 | h2 = 9; |
smejky | 10:0176705be216 | 3291 | h1--; |
smejky | 10:0176705be216 | 3292 | } |
smejky | 10:0176705be216 | 3293 | cas_hodiny--; |
smejky | 10:0176705be216 | 3294 | if(cas_hodiny < 0){ |
smejky | 10:0176705be216 | 3295 | cas_hodiny = 23; |
smejky | 10:0176705be216 | 3296 | } |
smejky | 10:0176705be216 | 3297 | spi.locate(80,80); |
smejky | 10:0176705be216 | 3298 | spi.printf(cisla[h1]); |
smejky | 10:0176705be216 | 3299 | spi.locate(110,80); |
smejky | 10:0176705be216 | 3300 | spi.printf(cisla[h2]); |
smejky | 10:0176705be216 | 3301 | wait(0.1); |
smejky | 10:0176705be216 | 3302 | } |
smejky | 10:0176705be216 | 3303 | spi.Bitmap(62,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 10:0176705be216 | 3304 | } |
smejky | 10:0176705be216 | 3305 | if((touch_x > up2[1]) && (touch_x < up2[3]) && (touch_y < up2[2]) && (touch_y > up2[0])){ |
smejky | 10:0176705be216 | 3306 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru_s); |
smejky | 10:0176705be216 | 3307 | while ((touch.DataAvailable()) && (m2 < 10)){ |
smejky | 10:0176705be216 | 3308 | m2++; |
smejky | 10:0176705be216 | 3309 | cas_minuty++; |
smejky | 10:0176705be216 | 3310 | if(cas_minuty == 60){ |
smejky | 10:0176705be216 | 3311 | cas_minuty = 0; |
smejky | 10:0176705be216 | 3312 | } |
smejky | 10:0176705be216 | 3313 | if((m1 == 5)&&(m2 == 10)){ |
smejky | 10:0176705be216 | 3314 | m2 = 0; |
smejky | 10:0176705be216 | 3315 | m1 = 0; |
smejky | 10:0176705be216 | 3316 | } |
smejky | 10:0176705be216 | 3317 | if(m2 == 10){ |
smejky | 10:0176705be216 | 3318 | m2 = 0; |
smejky | 10:0176705be216 | 3319 | m1++; |
smejky | 10:0176705be216 | 3320 | } |
smejky | 10:0176705be216 | 3321 | |
smejky | 10:0176705be216 | 3322 | spi.locate(189,80); |
smejky | 10:0176705be216 | 3323 | spi.printf(cisla[m1]); |
smejky | 10:0176705be216 | 3324 | spi.locate(219,80); |
smejky | 10:0176705be216 | 3325 | spi.printf(cisla[m2]); |
smejky | 10:0176705be216 | 3326 | wait(0.1); |
smejky | 10:0176705be216 | 3327 | } |
smejky | 10:0176705be216 | 3328 | |
smejky | 10:0176705be216 | 3329 | spi.Bitmap(172,28,86,29,(unsigned char*)gImage_nahoru); |
smejky | 10:0176705be216 | 3330 | } |
smejky | 10:0176705be216 | 3331 | if((touch_x > down2[1]) && (touch_x < down2[3]) && (touch_y < down2[2]) && (touch_y > down2[0])){ |
smejky | 10:0176705be216 | 3332 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu_s); |
smejky | 10:0176705be216 | 3333 | while ((touch.DataAvailable()) && (m2 < 10)){ |
smejky | 10:0176705be216 | 3334 | m2--; |
smejky | 10:0176705be216 | 3335 | if((m2 < 0)&&(m1 == 0)){ |
smejky | 10:0176705be216 | 3336 | m2 = 9; |
smejky | 10:0176705be216 | 3337 | m1 = 5; |
smejky | 10:0176705be216 | 3338 | } |
smejky | 10:0176705be216 | 3339 | if(m2 < 0){ |
smejky | 10:0176705be216 | 3340 | m2 = 9; |
smejky | 10:0176705be216 | 3341 | m1--; |
smejky | 10:0176705be216 | 3342 | } |
smejky | 10:0176705be216 | 3343 | cas_minuty--; |
smejky | 10:0176705be216 | 3344 | if(cas_minuty < 0){ |
smejky | 10:0176705be216 | 3345 | cas_minuty = 59; |
smejky | 10:0176705be216 | 3346 | } |
smejky | 10:0176705be216 | 3347 | spi.locate(189,80); |
smejky | 10:0176705be216 | 3348 | spi.printf(cisla[m1]); |
smejky | 10:0176705be216 | 3349 | spi.locate(219,80); |
smejky | 10:0176705be216 | 3350 | spi.printf(cisla[m2]); |
smejky | 10:0176705be216 | 3351 | wait(0.1); |
smejky | 10:0176705be216 | 3352 | } |
smejky | 10:0176705be216 | 3353 | |
smejky | 10:0176705be216 | 3354 | spi.Bitmap(172,142,86,29,(unsigned char*)gImage_dolu); |
smejky | 10:0176705be216 | 3355 | } |
smejky | 10:0176705be216 | 3356 | |
smejky | 9:d1385f7171af | 3357 | |
smejky | 9:d1385f7171af | 3358 | } |
smejky | 9:d1385f7171af | 3359 | } |
smejky | 9:d1385f7171af | 3360 | } |
smejky | 9:d1385f7171af | 3361 | } |
smejky | 9:d1385f7171af | 3362 | |
smejky | 9:d1385f7171af | 3363 | |
smejky | 10:0176705be216 | 3364 | |
smejky | 10:0176705be216 | 3365 | |
smejky | 8:b6e7401fdcfc | 3366 | void hodiny(){ |
smejky | 9:d1385f7171af | 3367 | set_time(cas_nastavit); |
smejky | 8:b6e7401fdcfc | 3368 | while(1){ |
smejky | 8:b6e7401fdcfc | 3369 | time_t seconds = time(NULL); |
smejky | 12:9bc02f9e16e3 | 3370 | |
smejky | 10:0176705be216 | 3371 | if(seconds == time_on){ |
smejky | 12:9bc02f9e16e3 | 3372 | rel.write(1); |
smejky | 10:0176705be216 | 3373 | } |
smejky | 10:0176705be216 | 3374 | if(seconds == time_off){ |
smejky | 12:9bc02f9e16e3 | 3375 | rel.write(0); |
smejky | 10:0176705be216 | 3376 | } |
smejky | 8:b6e7401fdcfc | 3377 | strftime(buffer, 32, "%R", localtime(&seconds)); |
smejky | 10:0176705be216 | 3378 | strftime(hodinka, 32, "%H", localtime(&seconds)); |
smejky | 10:0176705be216 | 3379 | strftime(minutka, 32, "%M", localtime(&seconds)); |
smejky | 10:0176705be216 | 3380 | printf("%s\r\n",buffer); |
smejky | 9:d1385f7171af | 3381 | Thread::wait(1000); |
smejky | 8:b6e7401fdcfc | 3382 | } |
smejky | 8:b6e7401fdcfc | 3383 | } |
smejky | 7:91b982ccf255 | 3384 | |
smejky | 0:6abf63b83992 | 3385 | main(){ |
smejky | 12:9bc02f9e16e3 | 3386 | r.pulsewidth(5); |
smejky | 12:9bc02f9e16e3 | 3387 | g.pulsewidth(5); |
smejky | 12:9bc02f9e16e3 | 3388 | b.pulsewidth(5); |
smejky | 9:d1385f7171af | 3389 | |
smejky | 9:d1385f7171af | 3390 | spi.set_orientation(3); |
smejky | 3:dadb214885c1 | 3391 | spi.FastWindow(true); |
smejky | 0:6abf63b83992 | 3392 | touch.InitTouch(); |
smejky | 0:6abf63b83992 | 3393 | touch.SetPrecision(PREC_EXTREME); |
smejky | 8:b6e7401fdcfc | 3394 | spi.background(Black); |
smejky | 8:b6e7401fdcfc | 3395 | spi.foreground(White); |
smejky | 3:dadb214885c1 | 3396 | spi.cls(); |
smejky | 12:9bc02f9e16e3 | 3397 | send_color(255,255,255,led_jas); |
smejky | 12:9bc02f9e16e3 | 3398 | rel.write(1); |
smejky | 3:dadb214885c1 | 3399 | grafika(); |
smejky | 9:d1385f7171af | 3400 | |
smejky | 12:9bc02f9e16e3 | 3401 | //br.period_us(1000); |
smejky | 12:9bc02f9e16e3 | 3402 | br.pulsewidth(5); |
smejky | 10:0176705be216 | 3403 | br.write(lcd_jas); |
smejky | 10:0176705be216 | 3404 | |
smejky | 3:dadb214885c1 | 3405 | Button(); |
smejky | 8:b6e7401fdcfc | 3406 | |
smejky | 2:0629f1ddaa92 | 3407 | |
smejky | 0:6abf63b83992 | 3408 | } |