Toto je má konečná verze maturitního projektu

Dependencies:   mbed mbed-rtos UTouch_vyrobek UniGraphic

Committer:
smejky
Date:
Sat Jan 08 10:54:51 2022 +0000
Revision:
9:d1385f7171af
Parent:
8:b6e7401fdcfc
Child:
10:0176705be216
pridane nastaveni a pridavam nastaveni casu

Who changed what in which revision?

UserRevisionLine numberNew contents of line
smejky 7:91b982ccf255 1 #include "display.h"
smejky 7:91b982ccf255 2 #include "rtos.h"
smejky 8:b6e7401fdcfc 3
smejky 9:d1385f7171af 4 UTouch touch(D4,D9,D3,D2,D5);//clk,chip_select,MOSI,miso,irq
smejky 0:6abf63b83992 5 ILI9341 spi(SPI_8,320000000,PTD2,PTD3,PTD1,PTC12, PTC3, PTC2, "TFT",240,320);// mosi, miso, sclk, chip_select, reset, dc
smejky 8:b6e7401fdcfc 6 DigitalOut my_green(LED2);
smejky 8:b6e7401fdcfc 7 DigitalOut my_red(LED4);
smejky 8:b6e7401fdcfc 8 DigitalOut my_blue(LED3);
smejky 7:91b982ccf255 9 DigitalOut led2(LED2);
smejky 7:91b982ccf255 10 Thread thread;
smejky 9:d1385f7171af 11 PwmOut br(D9);
smejky 9:d1385f7171af 12
smejky 9:d1385f7171af 13 int cas_nastavit = 1037059200;
smejky 9:d1385f7171af 14 int lang = 0;
smejky 9:d1385f7171af 15 char buffer[32];
smejky 9:d1385f7171af 16 char jazyk [3][20] = {
smejky 9:d1385f7171af 17 "Czech",
smejky 9:d1385f7171af 18 "English",
smejky 9:d1385f7171af 19 " Set Time"
smejky 9:d1385f7171af 20 };
smejky 9:d1385f7171af 21 char en[3][20] = {
smejky 9:d1385f7171af 22 "Czech",
smejky 9:d1385f7171af 23 "English",
smejky 9:d1385f7171af 24 " Set Time"
smejky 9:d1385f7171af 25 };
smejky 9:d1385f7171af 26 char cz[3][20] = {
smejky 9:d1385f7171af 27 "Cestina",
smejky 9:d1385f7171af 28 "Anglictina",
smejky 9:d1385f7171af 29 "Nastavit cas"
smejky 9:d1385f7171af 30 };
smejky 9:d1385f7171af 31
smejky 9:d1385f7171af 32
smejky 9:d1385f7171af 33
smejky 9:d1385f7171af 34 void hold(){
smejky 9:d1385f7171af 35 int i = touch.DataAvailable();
smejky 9:d1385f7171af 36 while (i){
smejky 9:d1385f7171af 37 i = touch.DataAvailable();
smejky 9:d1385f7171af 38 }
smejky 9:d1385f7171af 39
smejky 9:d1385f7171af 40 }
smejky 9:d1385f7171af 41
smejky 3:dadb214885c1 42
smejky 7:91b982ccf255 43 void led2_thread()
smejky 7:91b982ccf255 44 {
smejky 7:91b982ccf255 45 while (true) {
smejky 7:91b982ccf255 46 led2 = !led2;
smejky 7:91b982ccf255 47 Thread::wait(1000);
smejky 7:91b982ccf255 48 }
smejky 7:91b982ccf255 49 }
smejky 0:6abf63b83992 50
smejky 0:6abf63b83992 51
smejky 0:6abf63b83992 52 /*
smejky 0:6abf63b83992 53 v ILI9341.cpp zmeneny framerate ze 70 na 100, toto pomohlo problemu blikání displeje
smejky 3:dadb214885c1 54 velikost fotky pro čudlik 180x70
smejky 3:dadb214885c1 55 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 56
smejky 0:6abf63b83992 57 */
smejky 0:6abf63b83992 58
smejky 7:91b982ccf255 59
smejky 8:b6e7401fdcfc 60 void grafika(unsigned short int press = 0){
smejky 9:d1385f7171af 61 int spodni_pravy[] = {239,200,320,240,Black};
smejky 5:7c757a7c97c5 62
smejky 4:c7ca936cdd1f 63
smejky 2:0629f1ddaa92 64 switch(press)
smejky 2:0629f1ddaa92 65 {
smejky 2:0629f1ddaa92 66 case 1:
smejky 9:d1385f7171af 67 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch);
smejky 9:d1385f7171af 68 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc); // pravy
smejky 9:d1385f7171af 69 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 70 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy
smejky 7:91b982ccf255 71
smejky 2:0629f1ddaa92 72 break;
smejky 4:c7ca936cdd1f 73 case 2:
smejky 9:d1385f7171af 74 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch);
smejky 9:d1385f7171af 75 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik);// levy
smejky 9:d1385f7171af 76 spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 77 spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 78 break;
smejky 9:d1385f7171af 79 case 7: //zrusit
smejky 9:d1385f7171af 80 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch);
smejky 9:d1385f7171af 81 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit);// levy
smejky 9:d1385f7171af 82 spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 83 spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 84 break;
smejky 9:d1385f7171af 85 case 9: //potvrdit
smejky 9:d1385f7171af 86 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch);
smejky 9:d1385f7171af 87 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit); // pravy
smejky 9:d1385f7171af 88 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 89 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy
smejky 4:c7ca936cdd1f 90 break;
smejky 4:c7ca936cdd1f 91 case 3:
smejky 9:d1385f7171af 92 spi.Bitmap(0,200,80,40,(unsigned char*)gImage_spodni_levy);
smejky 2:0629f1ddaa92 93 break;
smejky 4:c7ca936cdd1f 94 case 4:
smejky 9:d1385f7171af 95 spi.Bitmap(80,200,80,40,(unsigned char*)gImage_stredni_levy);
smejky 4:c7ca936cdd1f 96 break;
smejky 4:c7ca936cdd1f 97 case 5:
smejky 9:d1385f7171af 98 spi.Bitmap(160,200,80,40,(unsigned char*)gImage_stredni_pravy);
smejky 4:c7ca936cdd1f 99 break;
smejky 4:c7ca936cdd1f 100 case 6:
smejky 4:c7ca936cdd1f 101 spi.fillrect(spodni_pravy[0],spodni_pravy[1],spodni_pravy[2],spodni_pravy[3],spodni_pravy[4]); //pravy kraj spodni
smejky 4:c7ca936cdd1f 102 break;
smejky 9:d1385f7171af 103 case 8:
smejky 9:d1385f7171af 104 spi.Bitmap(0,200,80,40,(unsigned char*)gImage_spodni_levy);
smejky 9:d1385f7171af 105 break;
smejky 4:c7ca936cdd1f 106
smejky 4:c7ca936cdd1f 107 default:
smejky 9:d1385f7171af 108 spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
smejky 7:91b982ccf255 109
smejky 9:d1385f7171af 110 spi.Bitmap(274,0,46,36,(unsigned char*)gImage_vypln);//pravy
smejky 9:d1385f7171af 111 spi.Bitmap(274,165,46,36,(unsigned char*)gImage_vypln);//pravy
smejky 9:d1385f7171af 112 spi.Bitmap(0,0,46,36,(unsigned char*)gImage_vypln);//levy
smejky 9:d1385f7171af 113 spi.Bitmap(0,165,46,36,(unsigned char*)gImage_vypln);//levy
smejky 7:91b982ccf255 114
smejky 9:d1385f7171af 115 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch);
smejky 9:d1385f7171af 116 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc); // pravy
smejky 9:d1385f7171af 117 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek);
smejky 9:d1385f7171af 118 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek); //pravy
smejky 7:91b982ccf255 119
smejky 9:d1385f7171af 120 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch);
smejky 9:d1385f7171af 121 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik);// levy
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
smejky 8:b6e7401fdcfc 125
smejky 9:d1385f7171af 126 //spi.Bitmap(160,200,80,40,(unsigned char*)gImage_stredni_levy);
smejky 9:d1385f7171af 127 spi.Bitmap(0,200,80,40,(unsigned char*)gImage_spodni_levy);
smejky 9:d1385f7171af 128 spi.Bitmap(80,200,80,40,(unsigned char*)gImage_stredni_levy);
smejky 9:d1385f7171af 129 spi.Bitmap(160,200,80,40,(unsigned char*)gImage_stredni_pravy); //stred pravy spodni
smejky 4:c7ca936cdd1f 130 spi.fillrect(spodni_pravy[0],spodni_pravy[1],spodni_pravy[2],spodni_pravy[3],spodni_pravy[4]); //pravy kraj spodni
smejky 2:0629f1ddaa92 131 }
smejky 2:0629f1ddaa92 132 }
smejky 2:0629f1ddaa92 133
smejky 2:0629f1ddaa92 134 void malovani(){
smejky 2:0629f1ddaa92 135
smejky 1:4dd546219e30 136 while(1==1)
smejky 1:4dd546219e30 137 {
smejky 0:6abf63b83992 138 if (touch.DataAvailable())
smejky 0:6abf63b83992 139 {
smejky 0:6abf63b83992 140 if(touch.Read())
smejky 0:6abf63b83992 141 {
smejky 0:6abf63b83992 142 unsigned short int touch_y = touch.GetX();
smejky 1:4dd546219e30 143 unsigned short int touch_x = touch.GetY();
smejky 0:6abf63b83992 144 touch_x = touch_x - 10;
smejky 2:0629f1ddaa92 145 touch_y = touch_y + 10;
smejky 2:0629f1ddaa92 146 spi.pixel(touch_x,touch_y,Blue);
smejky 2:0629f1ddaa92 147 }
smejky 2:0629f1ddaa92 148 }
smejky 2:0629f1ddaa92 149 }
smejky 2:0629f1ddaa92 150 }
smejky 2:0629f1ddaa92 151
smejky 5:7c757a7c97c5 152 /*
smejky 5:7c757a7c97c5 153 else if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy [1])){
smejky 5:7c757a7c97c5 154 R_is_pressed = 1;
smejky 5:7c757a7c97c5 155 spi.fillrect(pravy[0],pravy[1],pravy[2],pravy[3],pravy[4]);
smejky 5:7c757a7c97c5 156 wait(0.1);
smejky 5:7c757a7c97c5 157 }
smejky 5:7c757a7c97c5 158
smejky 5:7c757a7c97c5 159 */
smejky 5:7c757a7c97c5 160
smejky 5:7c757a7c97c5 161
smejky 5:7c757a7c97c5 162
smejky 7:91b982ccf255 163
smejky 7:91b982ccf255 164
smejky 7:91b982ccf255 165 void Button(int strana = 0){
smejky 7:91b982ccf255 166 int pravy[] = {34,0,165,46}; //pravý čudlík
smejky 9:d1385f7171af 167 int levy[] = {34,274,165,320}; //levý čudlík
smejky 4:c7ca936cdd1f 168 //int cudlik[] = {20,80,42,130,Orange}; //slider nepovedeny projekt
smejky 4:c7ca936cdd1f 169 //int stred_cudliku[] = {30,105,Blue}; //střed čudliku
smejky 9:d1385f7171af 170 int spodni_levy[] = {200,240,240,320}; // levy spodni cudlik
smejky 9:d1385f7171af 171 int stredni_levy[] = {200,160,240,239}; //stred levy spodni cudlik
smejky 9:d1385f7171af 172 int stredni_pravy[] = {200,80,240,158}; //stred pravy spodni cudlik
smejky 9:d1385f7171af 173 int spodni_pravy[] = {200,0,240,77}; // pravy spodni cudlik
smejky 7:91b982ccf255 174
smejky 7:91b982ccf255 175 int cudlik_1[] = {10,213,58,260};
smejky 8:b6e7401fdcfc 176 int cudlik_2[] = {10,137,58,184};
smejky 8:b6e7401fdcfc 177
smejky 8:b6e7401fdcfc 178
smejky 7:91b982ccf255 179
smejky 7:91b982ccf255 180
smejky 9:d1385f7171af 181
smejky 3:dadb214885c1 182 while(1)
smejky 2:0629f1ddaa92 183 {
smejky 2:0629f1ddaa92 184 if (touch.DataAvailable())
smejky 2:0629f1ddaa92 185 {
smejky 2:0629f1ddaa92 186 if(touch.Read())
smejky 2:0629f1ddaa92 187 {
smejky 5:7c757a7c97c5 188
smejky 5:7c757a7c97c5 189
smejky 3:dadb214885c1 190 unsigned short int touch_y = touch.GetX(); // 0-320
smejky 3:dadb214885c1 191 unsigned short int touch_x = touch.GetY(); // 0-240
smejky 3:dadb214885c1 192 touch_x = touch_x - 5;
smejky 2:0629f1ddaa92 193 touch_y = touch_y + 10;
smejky 3:dadb214885c1 194 //spi.pixel(touch_x,touch_y,Blue);
smejky 5:7c757a7c97c5 195 //printf("x %d ,y %d\r\n",touch_x,touch_y);
smejky 3:dadb214885c1 196
smejky 3:dadb214885c1 197 //pravý čudlik
smejky 5:7c757a7c97c5 198 if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
smejky 7:91b982ccf255 199 int m = strana;
smejky 7:91b982ccf255 200 switch(strana){
smejky 7:91b982ccf255 201 case 0:
smejky 7:91b982ccf255 202 m++;
smejky 7:91b982ccf255 203 break;
smejky 7:91b982ccf255 204 case 1:
smejky 7:91b982ccf255 205 m++;
smejky 7:91b982ccf255 206 break;
smejky 7:91b982ccf255 207 default:
smejky 7:91b982ccf255 208 m = 0;
smejky 7:91b982ccf255 209 }
smejky 7:91b982ccf255 210 //GRAFIKA**************************************************
smejky 9:d1385f7171af 211 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 212 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc_s);
smejky 9:d1385f7171af 213 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 214 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 7:91b982ccf255 215 //GRAFIKA**************************************************
smejky 9:d1385f7171af 216 hold();
smejky 5:7c757a7c97c5 217 grafika(1);
smejky 7:91b982ccf255 218 Menu(m);
smejky 5:7c757a7c97c5 219 wait(0.2);
smejky 5:7c757a7c97c5 220 }
smejky 5:7c757a7c97c5 221
smejky 3:dadb214885c1 222 //pravý čudlik
smejky 3:dadb214885c1 223
smejky 4:c7ca936cdd1f 224 //levý čudlik
smejky 5:7c757a7c97c5 225 if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
smejky 7:91b982ccf255 226 int m = strana;
smejky 7:91b982ccf255 227 switch(strana){
smejky 7:91b982ccf255 228 case 1:
smejky 7:91b982ccf255 229 m--;
smejky 7:91b982ccf255 230 break;
smejky 7:91b982ccf255 231 default:
smejky 8:b6e7401fdcfc 232 m = 1;
smejky 7:91b982ccf255 233 }
smejky 7:91b982ccf255 234 //GRAFIKA**************************************************
smejky 9:d1385f7171af 235 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 236 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik_s);// levy
smejky 9:d1385f7171af 237 spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 238 spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 7:91b982ccf255 239 //GRAFIKA**************************************************
smejky 7:91b982ccf255 240
smejky 9:d1385f7171af 241 hold();
smejky 5:7c757a7c97c5 242 grafika(2);
smejky 7:91b982ccf255 243 wait(0.2);
smejky 7:91b982ccf255 244 Menu(m);
smejky 5:7c757a7c97c5 245 }
smejky 3:dadb214885c1 246 //levý čudlik
smejky 4:c7ca936cdd1f 247
smejky 4:c7ca936cdd1f 248 //levý spodni čudlik
smejky 5:7c757a7c97c5 249 if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){
smejky 9:d1385f7171af 250 spi.Bitmap(0,200,80,40,(unsigned char*)gImage_spodni_levy_s);
smejky 9:d1385f7171af 251
smejky 9:d1385f7171af 252 hold();
smejky 9:d1385f7171af 253
smejky 9:d1385f7171af 254 grafika(9);
smejky 9:d1385f7171af 255 grafika(8);
smejky 9:d1385f7171af 256 grafika(7);
smejky 9:d1385f7171af 257 nastaveni();
smejky 5:7c757a7c97c5 258 wait(0.2);
smejky 5:7c757a7c97c5 259 }
smejky 4:c7ca936cdd1f 260 //levý spodni čudlik
smejky 3:dadb214885c1 261
smejky 4:c7ca936cdd1f 262
smejky 4:c7ca936cdd1f 263 //stred levy spodni cudlik
smejky 5:7c757a7c97c5 264 if ((touch_x > stredni_levy[0]) && (touch_x < stredni_levy[2]) && (touch_y < stredni_levy[3]) && (touch_y > stredni_levy[1])){
smejky 9:d1385f7171af 265
smejky 7:91b982ccf255 266
smejky 9:d1385f7171af 267 spi.Bitmap(80,200,80,40,(unsigned char*)gImage_stredni_levy_s);
smejky 9:d1385f7171af 268
smejky 7:91b982ccf255 269
smejky 7:91b982ccf255 270 thread.start(led2_thread);
smejky 7:91b982ccf255 271
smejky 9:d1385f7171af 272 hold();
smejky 5:7c757a7c97c5 273 grafika(4);
smejky 5:7c757a7c97c5 274 wait(0.2);
smejky 5:7c757a7c97c5 275 }
smejky 4:c7ca936cdd1f 276 //stred levy spodni cudlik
smejky 4:c7ca936cdd1f 277
smejky 4:c7ca936cdd1f 278
smejky 4:c7ca936cdd1f 279 //stred pravy spodni cudlik
smejky 5:7c757a7c97c5 280 if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){
smejky 9:d1385f7171af 281 spi.Bitmap(160,200,80,40,(unsigned char*)gImage_stredni_pravy_s);
smejky 7:91b982ccf255 282
smejky 7:91b982ccf255 283 thread.terminate();
smejky 9:d1385f7171af 284 hold();
smejky 5:7c757a7c97c5 285 grafika(5);
smejky 5:7c757a7c97c5 286 wait(0.2);
smejky 5:7c757a7c97c5 287 }
smejky 4:c7ca936cdd1f 288 //stred pravy spodni cudlik
smejky 4:c7ca936cdd1f 289
smejky 4:c7ca936cdd1f 290 //kraj pravy spodni cudlik
smejky 5:7c757a7c97c5 291 if ((touch_x > spodni_pravy[0]) && (touch_x < spodni_pravy[2]) && (touch_y < spodni_pravy[3]) && (touch_y > spodni_pravy[1])){
smejky 9:d1385f7171af 292
smejky 9:d1385f7171af 293 hold();
smejky 9:d1385f7171af 294
smejky 9:d1385f7171af 295 spi.locate(255,210);
smejky 9:d1385f7171af 296 spi.printf("%s",buffer);
smejky 9:d1385f7171af 297
smejky 9:d1385f7171af 298 // grafika(6);
smejky 5:7c757a7c97c5 299 wait(0.2);
smejky 4:c7ca936cdd1f 300 }
smejky 4:c7ca936cdd1f 301 //kraj pravy spodni cudlik
smejky 7:91b982ccf255 302
smejky 7:91b982ccf255 303 //MENU CUDLIKY**********************************************************************************************************************************************************************************
smejky 7:91b982ccf255 304 //prvni
smejky 8:b6e7401fdcfc 305 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 306 spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1s_vrch);
smejky 9:d1385f7171af 307 spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1s_spodek);
smejky 9:d1385f7171af 308 hold();
smejky 9:d1385f7171af 309 spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 310 spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 7:91b982ccf255 311 wait(0.2);
smejky 8:b6e7401fdcfc 312 Static();
smejky 7:91b982ccf255 313 }
smejky 7:91b982ccf255 314
smejky 7:91b982ccf255 315
smejky 7:91b982ccf255 316 //prvni
smejky 8:b6e7401fdcfc 317 //druhy
smejky 8:b6e7401fdcfc 318 if ((touch_x > cudlik_2[0]) && (touch_x < cudlik_2[2]) && (touch_y < cudlik_2[3]) && (touch_y > cudlik_2[1]) && (strana == 1)){
smejky 9:d1385f7171af 319 spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1s_vrch);
smejky 9:d1385f7171af 320 spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1s_spodek);
smejky 9:d1385f7171af 321 hold();
smejky 9:d1385f7171af 322 spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 323 spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 8:b6e7401fdcfc 324 wait(0.2);
smejky 8:b6e7401fdcfc 325
smejky 8:b6e7401fdcfc 326 }
smejky 8:b6e7401fdcfc 327
smejky 8:b6e7401fdcfc 328
smejky 8:b6e7401fdcfc 329 //druhy
smejky 3:dadb214885c1 330
smejky 1:4dd546219e30 331 }
smejky 1:4dd546219e30 332 }
smejky 1:4dd546219e30 333 }
smejky 1:4dd546219e30 334 }
smejky 0:6abf63b83992 335
smejky 0:6abf63b83992 336
smejky 0:6abf63b83992 337
smejky 2:0629f1ddaa92 338
smejky 7:91b982ccf255 339
smejky 8:b6e7401fdcfc 340 void Menu(int strana = 0){
smejky 7:91b982ccf255 341 switch(strana)
smejky 7:91b982ccf255 342 {
smejky 7:91b982ccf255 343 case 1:
smejky 9:d1385f7171af 344 spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
smejky 7:91b982ccf255 345
smejky 7:91b982ccf255 346
smejky 7:91b982ccf255 347 //CUDLIKY*******************************************************************************
smejky 7:91b982ccf255 348 //prvni rada
smejky 9:d1385f7171af 349 spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3_vrch);
smejky 9:d1385f7171af 350 spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3_spodek);
smejky 7:91b982ccf255 351
smejky 9:d1385f7171af 352 spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2_vrch);
smejky 9:d1385f7171af 353 spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2_spodek);
smejky 8:b6e7401fdcfc 354
smejky 9:d1385f7171af 355 spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 356 spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 9:d1385f7171af 357
smejky 7:91b982ccf255 358 //prvni rada
smejky 7:91b982ccf255 359
smejky 7:91b982ccf255 360 //druha rada
smejky 9:d1385f7171af 361 spi.Bitmap(213,76,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 362 spi.Bitmap(213,100,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 7:91b982ccf255 363
smejky 9:d1385f7171af 364 spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 365 spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 7:91b982ccf255 366
smejky 9:d1385f7171af 367 spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch);
smejky 9:d1385f7171af 368 spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek);
smejky 7:91b982ccf255 369 // druha rada
smejky 7:91b982ccf255 370
smejky 7:91b982ccf255 371 //treti rada
smejky 9:d1385f7171af 372 spi.Bitmap(213,142,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 373 spi.Bitmap(213,166,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 7:91b982ccf255 374
smejky 9:d1385f7171af 375 spi.Bitmap(137,142,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 376 spi.Bitmap(137,166,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 7:91b982ccf255 377
smejky 9:d1385f7171af 378 spi.Bitmap(60,142,48,24,(unsigned char*)gImage_cudlik1_vrch);
smejky 9:d1385f7171af 379 spi.Bitmap(60,166,48,24,(unsigned char*)gImage_cudlik1_spodek);
smejky 7:91b982ccf255 380 // treti rada
smejky 7:91b982ccf255 381
smejky 7:91b982ccf255 382 //CUDLIKY*******************************************************************************
smejky 8:b6e7401fdcfc 383
smejky 8:b6e7401fdcfc 384 strana = 1;
smejky 8:b6e7401fdcfc 385 Button(strana);
smejky 8:b6e7401fdcfc 386
smejky 8:b6e7401fdcfc 387 break;
smejky 7:91b982ccf255 388 default:
smejky 9:d1385f7171af 389 spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
smejky 7:91b982ccf255 390 strana = 0;
smejky 7:91b982ccf255 391 Button(strana);
smejky 7:91b982ccf255 392 }
smejky 7:91b982ccf255 393 }
smejky 7:91b982ccf255 394
smejky 8:b6e7401fdcfc 395 void Static(){
smejky 9:d1385f7171af 396 int red1[] = {213,76,260,124};
smejky 9:d1385f7171af 397 int green1[] = {137,76,184,124};
smejky 9:d1385f7171af 398 int blue1[] = {60,76,107,124};
smejky 9:d1385f7171af 399
smejky 9:d1385f7171af 400
smejky 8:b6e7401fdcfc 401 int red[] = {76,213,124,260};
smejky 8:b6e7401fdcfc 402 int green[] = {76,137,124,184};
smejky 8:b6e7401fdcfc 403 int blue[] = {76,60,124,107};
smejky 9:d1385f7171af 404
smejky 8:b6e7401fdcfc 405
smejky 8:b6e7401fdcfc 406 int pravy[] = {34,0,165,46}; //pravý čudlík
smejky 8:b6e7401fdcfc 407 int levy[] = {34,274,165,320}; //levý čudlík
smejky 8:b6e7401fdcfc 408
smejky 9:d1385f7171af 409 spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
smejky 9:d1385f7171af 410 spi.fillrect(red1[0],red1[1],red1[2],red1[3],Red);
smejky 9:d1385f7171af 411 spi.fillrect(green1[0],green1[1],green1[2],green1[3],Green);
smejky 9:d1385f7171af 412 spi.fillrect(blue1[0],blue1[1],blue1[2],blue1[3],Blue);
smejky 8:b6e7401fdcfc 413
smejky 8:b6e7401fdcfc 414
smejky 8:b6e7401fdcfc 415 int r = 1;
smejky 8:b6e7401fdcfc 416 int g = 1;
smejky 8:b6e7401fdcfc 417 int b = 1;
smejky 8:b6e7401fdcfc 418 while(1)
smejky 8:b6e7401fdcfc 419 {
smejky 8:b6e7401fdcfc 420 if (touch.DataAvailable())
smejky 8:b6e7401fdcfc 421 {
smejky 8:b6e7401fdcfc 422 if(touch.Read())
smejky 8:b6e7401fdcfc 423 {
smejky 8:b6e7401fdcfc 424 unsigned short int touch_y = touch.GetX(); // 0-320
smejky 8:b6e7401fdcfc 425 unsigned short int touch_x = touch.GetY(); // 0-240
smejky 8:b6e7401fdcfc 426
smejky 8:b6e7401fdcfc 427 //pravý čudlik
smejky 8:b6e7401fdcfc 428 if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
smejky 9:d1385f7171af 429
smejky 8:b6e7401fdcfc 430 //GRAFIKA**************************************************
smejky 9:d1385f7171af 431 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 432 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_cudlik_otoc_s);
smejky 9:d1385f7171af 433 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 434 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 8:b6e7401fdcfc 435 //GRAFIKA**************************************************
smejky 9:d1385f7171af 436 hold();
smejky 8:b6e7401fdcfc 437 my_red = r;
smejky 8:b6e7401fdcfc 438 my_green = g;
smejky 8:b6e7401fdcfc 439 my_blue = b;
smejky 8:b6e7401fdcfc 440 grafika(1);
smejky 8:b6e7401fdcfc 441 Menu();
smejky 8:b6e7401fdcfc 442 wait(0.2);
smejky 8:b6e7401fdcfc 443 }
smejky 8:b6e7401fdcfc 444 //pravý čudlik
smejky 8:b6e7401fdcfc 445
smejky 8:b6e7401fdcfc 446 //levý čudlik
smejky 8:b6e7401fdcfc 447 if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
smejky 8:b6e7401fdcfc 448 //GRAFIKA**************************************************
smejky 9:d1385f7171af 449 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 450 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_cudlik_s);// levy
smejky 9:d1385f7171af 451 spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 452 spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 8:b6e7401fdcfc 453 //GRAFIKA**************************************************
smejky 8:b6e7401fdcfc 454
smejky 9:d1385f7171af 455 hold();
smejky 8:b6e7401fdcfc 456 grafika(2);
smejky 8:b6e7401fdcfc 457 wait(0.2);
smejky 8:b6e7401fdcfc 458 Menu();
smejky 8:b6e7401fdcfc 459 }
smejky 8:b6e7401fdcfc 460 //levý čudlik
smejky 8:b6e7401fdcfc 461
smejky 9:d1385f7171af 462 if((touch_x > red[0]) && (touch_x < red[2]) && (touch_y < red[3]) && (touch_y > red[1])){
smejky 9:d1385f7171af 463 hold();
smejky 8:b6e7401fdcfc 464 r = !r;
smejky 8:b6e7401fdcfc 465 printf("%d",r);
smejky 8:b6e7401fdcfc 466 wait(0.2);
smejky 8:b6e7401fdcfc 467 }
smejky 8:b6e7401fdcfc 468
smejky 9:d1385f7171af 469 if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){
smejky 9:d1385f7171af 470 hold();
smejky 8:b6e7401fdcfc 471 g = !g;
smejky 8:b6e7401fdcfc 472 printf("%d",g);
smejky 8:b6e7401fdcfc 473 wait(0.2);
smejky 8:b6e7401fdcfc 474 }
smejky 8:b6e7401fdcfc 475
smejky 9:d1385f7171af 476 if((touch_x > blue[0]) && (touch_x < blue[2]) && (touch_y < blue[3]) && (touch_y > blue[1])){
smejky 9:d1385f7171af 477 hold();
smejky 8:b6e7401fdcfc 478 b = !b;
smejky 8:b6e7401fdcfc 479 printf("%d",b);
smejky 8:b6e7401fdcfc 480 wait(0.2);
smejky 8:b6e7401fdcfc 481 }
smejky 8:b6e7401fdcfc 482
smejky 8:b6e7401fdcfc 483 }
smejky 8:b6e7401fdcfc 484 }
smejky 8:b6e7401fdcfc 485 }
smejky 8:b6e7401fdcfc 486
smejky 8:b6e7401fdcfc 487 }
smejky 8:b6e7401fdcfc 488
smejky 9:d1385f7171af 489 void nastaveni(){
smejky 9:d1385f7171af 490 int pravy[] = {34,0,165,46}; //pravý čudlík
smejky 9:d1385f7171af 491 int levy[] = {34,274,165,320}; //levý čudlík
smejky 9:d1385f7171af 492 int i = 0;
smejky 9:d1385f7171af 493 int jazyk_s = 0;
smejky 9:d1385f7171af 494
smejky 9:d1385f7171af 495 spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
smejky 9:d1385f7171af 496 int check1[] = {66,10,96,40};
smejky 9:d1385f7171af 497 int check2[] = {66,56,96,86};
smejky 9:d1385f7171af 498
smejky 9:d1385f7171af 499 int prvni[] = {46,0,273,46}; //pravý čudlík
smejky 9:d1385f7171af 500 int druhy[] = {46,46,273,92}; //pravý čudlík
smejky 9:d1385f7171af 501 int treti[] = {46,92,273,138}; //pravý čudlík
smejky 9:d1385f7171af 502
smejky 9:d1385f7171af 503 spi.background(MojeSeda);
smejky 9:d1385f7171af 504 spi.fillrect(prvni[0],prvni[1],prvni[2],prvni[3],MojeSeda); //prvni
smejky 9:d1385f7171af 505 spi.rect(prvni[0],prvni[1],prvni[2],prvni[3],White); //prvni
smejky 9:d1385f7171af 506 //spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red);
smejky 9:d1385f7171af 507 spi.set_font((unsigned char*) Arial28x28);
smejky 9:d1385f7171af 508 spi.locate(140,14);
smejky 9:d1385f7171af 509 spi.printf(jazyk[0]);
smejky 9:d1385f7171af 510
smejky 9:d1385f7171af 511 spi.fillrect(druhy[0],druhy[1],druhy[2],druhy[3],MojeSeda); //druhy
smejky 9:d1385f7171af 512 spi.rect(druhy[0],druhy[1],druhy[2],druhy[3],White); //druhy
smejky 9:d1385f7171af 513 // spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red);
smejky 9:d1385f7171af 514 spi.locate(140,60);
smejky 9:d1385f7171af 515 spi.printf(jazyk[1]);
smejky 9:d1385f7171af 516
smejky 9:d1385f7171af 517 switch(lang)
smejky 9:d1385f7171af 518 {
smejky 9:d1385f7171af 519 case 1:
smejky 9:d1385f7171af 520 spi.fillrect(check1[0],check1[1],check1[2],check1[3],Green);
smejky 9:d1385f7171af 521 spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red);
smejky 9:d1385f7171af 522 break;
smejky 9:d1385f7171af 523 default:
smejky 9:d1385f7171af 524 spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red);
smejky 9:d1385f7171af 525 spi.fillrect(check2[0],check2[1],check2[2],check2[3],Green);
smejky 9:d1385f7171af 526 }
smejky 9:d1385f7171af 527
smejky 9:d1385f7171af 528
smejky 9:d1385f7171af 529 spi.fillrect(treti[0],treti[1],treti[2],treti[3],MojeSeda); //treti
smejky 9:d1385f7171af 530 spi.rect(treti[0],treti[1],treti[2],treti[3],White); //treti
smejky 9:d1385f7171af 531 spi.locate(90,106);
smejky 9:d1385f7171af 532 spi.printf(jazyk[2]);
smejky 9:d1385f7171af 533
smejky 9:d1385f7171af 534 while(1){
smejky 9:d1385f7171af 535 if (touch.DataAvailable())
smejky 9:d1385f7171af 536 {
smejky 9:d1385f7171af 537 if(touch.Read())
smejky 9:d1385f7171af 538 {
smejky 9:d1385f7171af 539 unsigned short int touch_y = touch.GetX(); // 0-320
smejky 9:d1385f7171af 540 unsigned short int touch_x = touch.GetY(); // 0-240
smejky 9:d1385f7171af 541
smejky 9:d1385f7171af 542 //pravý čudlik
smejky 9:d1385f7171af 543 if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
smejky 9:d1385f7171af 544
smejky 9:d1385f7171af 545 //GRAFIKA**************************************************
smejky 9:d1385f7171af 546 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 547 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
smejky 9:d1385f7171af 548 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 549 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 550 //GRAFIKA**************************************************
smejky 9:d1385f7171af 551 hold();
smejky 9:d1385f7171af 552 switch(jazyk_s)
smejky 9:d1385f7171af 553 {
smejky 9:d1385f7171af 554 case 1:
smejky 9:d1385f7171af 555 while(i < 3){
smejky 9:d1385f7171af 556 strcpy(jazyk[i], cz[i]);
smejky 9:d1385f7171af 557 i++;
smejky 9:d1385f7171af 558 }
smejky 9:d1385f7171af 559 break;
smejky 9:d1385f7171af 560 default:
smejky 9:d1385f7171af 561 while(i < 3){
smejky 9:d1385f7171af 562 strcpy(jazyk[i], en[i]);
smejky 9:d1385f7171af 563 i++;
smejky 9:d1385f7171af 564 }
smejky 9:d1385f7171af 565 }
smejky 9:d1385f7171af 566 i = 0;
smejky 9:d1385f7171af 567 grafika(1);
smejky 9:d1385f7171af 568 grafika(2);
smejky 9:d1385f7171af 569 Menu();
smejky 9:d1385f7171af 570 wait(0.2);
smejky 9:d1385f7171af 571 }
smejky 9:d1385f7171af 572 //pravý čudlik
smejky 9:d1385f7171af 573
smejky 9:d1385f7171af 574 //levý čudlik
smejky 9:d1385f7171af 575 if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
smejky 9:d1385f7171af 576 //GRAFIKA**************************************************
smejky 9:d1385f7171af 577 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 578 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
smejky 9:d1385f7171af 579 spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 580 spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 581 //GRAFIKA**************************************************
smejky 9:d1385f7171af 582
smejky 9:d1385f7171af 583 hold();
smejky 9:d1385f7171af 584
smejky 9:d1385f7171af 585 grafika(2);
smejky 9:d1385f7171af 586 grafika(1);
smejky 9:d1385f7171af 587 Menu();
smejky 9:d1385f7171af 588 wait(0.2);
smejky 9:d1385f7171af 589 }
smejky 9:d1385f7171af 590 //levý čudlik
smejky 9:d1385f7171af 591
smejky 9:d1385f7171af 592 if((touch_x > prvni[1]) && (touch_x < prvni[3]) && (touch_y < prvni[2]) && (touch_y > prvni[0])){
smejky 9:d1385f7171af 593 hold();
smejky 9:d1385f7171af 594 jazyk_s = 1;
smejky 9:d1385f7171af 595 lang = jazyk_s;
smejky 9:d1385f7171af 596 spi.fillrect(check1[0],check1[1],check1[2],check1[3],Green);
smejky 9:d1385f7171af 597 spi.fillrect(check2[0],check2[1],check2[2],check2[3],Red);
smejky 9:d1385f7171af 598 wait(0.2);
smejky 9:d1385f7171af 599 }
smejky 9:d1385f7171af 600 if((touch_x > druhy[1]) && (touch_x < druhy[3]) && (touch_y < druhy[2]) && (touch_y > druhy[0])){
smejky 9:d1385f7171af 601 hold();
smejky 9:d1385f7171af 602 jazyk_s = 0;
smejky 9:d1385f7171af 603 lang = jazyk_s;
smejky 9:d1385f7171af 604 spi.fillrect(check1[0],check1[1],check1[2],check1[3],Red);
smejky 9:d1385f7171af 605 spi.fillrect(check2[0],check2[1],check2[2],check2[3],Green);
smejky 9:d1385f7171af 606 wait(0.2);
smejky 9:d1385f7171af 607 }
smejky 9:d1385f7171af 608 if((touch_x > treti[1]) && (touch_x < treti[3]) && (touch_y < treti[2]) && (touch_y > treti[0])){
smejky 9:d1385f7171af 609 hold();
smejky 9:d1385f7171af 610 nastavit_hodiny();
smejky 9:d1385f7171af 611 }
smejky 9:d1385f7171af 612
smejky 9:d1385f7171af 613
smejky 9:d1385f7171af 614
smejky 9:d1385f7171af 615 }
smejky 9:d1385f7171af 616 }
smejky 9:d1385f7171af 617 }
smejky 9:d1385f7171af 618
smejky 9:d1385f7171af 619 }
smejky 9:d1385f7171af 620
smejky 9:d1385f7171af 621 void nastavit_hodiny(){
smejky 9:d1385f7171af 622 int pravy[] = {34,0,165,46}; //pravý čudlík
smejky 9:d1385f7171af 623 int levy[] = {34,274,165,320}; //levý čudlík
smejky 9:d1385f7171af 624
smejky 9:d1385f7171af 625
smejky 9:d1385f7171af 626 int green1[] = {180,65,249,134};
smejky 9:d1385f7171af 627 int blue1[] = {71,65,140,134};
smejky 9:d1385f7171af 628 /*
smejky 9:d1385f7171af 629 int nahoru1[] = {71,34,140,57};
smejky 9:d1385f7171af 630 int dolu1[] = {71,142,140,165};
smejky 9:d1385f7171af 631
smejky 9:d1385f7171af 632 int nahoru2[] = {};
smejky 9:d1385f7171af 633 int dolu2[] = {};
smejky 9:d1385f7171af 634 */
smejky 9:d1385f7171af 635 spi.Bitmap(71,34,69,23,(unsigned char*)gImage_nahoru);
smejky 9:d1385f7171af 636
smejky 9:d1385f7171af 637 //spi.fillrect(nahoru1[0],nahoru1[1],nahoru1[2],nahoru1[3],Green);
smejky 9:d1385f7171af 638 //spi.fillrect(dolu1[0],dolu1[1],dolu1[2],dolu1[3],Green);
smejky 9:d1385f7171af 639 spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
smejky 9:d1385f7171af 640
smejky 9:d1385f7171af 641 spi.fillrect(green1[0],green1[1],green1[2],green1[3],Green);
smejky 9:d1385f7171af 642 spi.fillrect(blue1[0],blue1[1],blue1[2],blue1[3],Blue);
smejky 9:d1385f7171af 643 while(1){
smejky 9:d1385f7171af 644 if (touch.DataAvailable())
smejky 9:d1385f7171af 645 {
smejky 9:d1385f7171af 646 if(touch.Read())
smejky 9:d1385f7171af 647 {
smejky 9:d1385f7171af 648 unsigned short int touch_y = touch.GetX(); // 0-320
smejky 9:d1385f7171af 649 unsigned short int touch_x = touch.GetY(); // 0-240
smejky 9:d1385f7171af 650
smejky 9:d1385f7171af 651 //pravý čudlik
smejky 9:d1385f7171af 652 if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
smejky 9:d1385f7171af 653
smejky 9:d1385f7171af 654 //GRAFIKA**************************************************
smejky 9:d1385f7171af 655 spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 656 spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
smejky 9:d1385f7171af 657 spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 658 spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 659 //GRAFIKA**************************************************
smejky 9:d1385f7171af 660 hold();
smejky 9:d1385f7171af 661
smejky 9:d1385f7171af 662 grafika(9);
smejky 9:d1385f7171af 663 nastaveni();
smejky 9:d1385f7171af 664 wait(0.2);
smejky 9:d1385f7171af 665 }
smejky 9:d1385f7171af 666 //pravý čudlik
smejky 9:d1385f7171af 667
smejky 9:d1385f7171af 668 //levý čudlik
smejky 9:d1385f7171af 669 if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
smejky 9:d1385f7171af 670 //GRAFIKA**************************************************
smejky 9:d1385f7171af 671 spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
smejky 9:d1385f7171af 672 spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
smejky 9:d1385f7171af 673 spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 674 spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
smejky 9:d1385f7171af 675 //GRAFIKA**************************************************
smejky 9:d1385f7171af 676
smejky 9:d1385f7171af 677 hold();
smejky 9:d1385f7171af 678 grafika(7);
smejky 9:d1385f7171af 679 nastaveni();
smejky 9:d1385f7171af 680 wait(0.2);
smejky 9:d1385f7171af 681 }
smejky 9:d1385f7171af 682 //levý čudlik
smejky 9:d1385f7171af 683
smejky 9:d1385f7171af 684
smejky 9:d1385f7171af 685 }
smejky 9:d1385f7171af 686 }
smejky 9:d1385f7171af 687 }
smejky 9:d1385f7171af 688 }
smejky 9:d1385f7171af 689
smejky 9:d1385f7171af 690
smejky 8:b6e7401fdcfc 691 void hodiny(){
smejky 9:d1385f7171af 692 set_time(cas_nastavit);
smejky 8:b6e7401fdcfc 693 while(1){
smejky 8:b6e7401fdcfc 694 time_t seconds = time(NULL);
smejky 9:d1385f7171af 695 //seconds = seconds + 7200;
smejky 8:b6e7401fdcfc 696 strftime(buffer, 32, "%R", localtime(&seconds));
smejky 9:d1385f7171af 697 Thread::wait(1000);
smejky 8:b6e7401fdcfc 698 }
smejky 8:b6e7401fdcfc 699 }
smejky 7:91b982ccf255 700
smejky 0:6abf63b83992 701 main(){
smejky 9:d1385f7171af 702
smejky 8:b6e7401fdcfc 703 my_red = 1;
smejky 8:b6e7401fdcfc 704 my_green = 1;
smejky 8:b6e7401fdcfc 705 my_blue = 1;
smejky 9:d1385f7171af 706 spi.set_orientation(3);
smejky 3:dadb214885c1 707 spi.FastWindow(true);
smejky 0:6abf63b83992 708 touch.InitTouch();
smejky 0:6abf63b83992 709 touch.SetPrecision(PREC_EXTREME);
smejky 8:b6e7401fdcfc 710 spi.background(Black);
smejky 8:b6e7401fdcfc 711 spi.foreground(White);
smejky 3:dadb214885c1 712 spi.cls();
smejky 9:d1385f7171af 713
smejky 8:b6e7401fdcfc 714
smejky 3:dadb214885c1 715 grafika();
smejky 9:d1385f7171af 716
smejky 9:d1385f7171af 717 br.period_us(1000);
smejky 9:d1385f7171af 718 br.write(0.50f);
smejky 9:d1385f7171af 719 /* wait_ms(3000);
smejky 9:d1385f7171af 720
smejky 9:d1385f7171af 721 br.write(0.25f);
smejky 9:d1385f7171af 722 wait_ms(3000);
smejky 9:d1385f7171af 723 br.write(0.0f);
smejky 9:d1385f7171af 724 wait_ms(3000);
smejky 9:d1385f7171af 725 br.write(0.25f);
smejky 9:d1385f7171af 726 wait_ms(3000);
smejky 9:d1385f7171af 727 br.write(0.50f);
smejky 9:d1385f7171af 728 wait_ms(5000);
smejky 9:d1385f7171af 729 br.write(0.80f);
smejky 9:d1385f7171af 730 */
smejky 9:d1385f7171af 731
smejky 9:d1385f7171af 732 grafika(7);
smejky 9:d1385f7171af 733 grafika(9);
smejky 9:d1385f7171af 734 //nastaveni();
smejky 9:d1385f7171af 735 nastavit_hodiny();
smejky 8:b6e7401fdcfc 736 thread.start(hodiny);
smejky 3:dadb214885c1 737 Button();
smejky 8:b6e7401fdcfc 738
smejky 2:0629f1ddaa92 739
smejky 0:6abf63b83992 740 }
smejky 4:c7ca936cdd1f 741
smejky 4:c7ca936cdd1f 742
smejky 4:c7ca936cdd1f 743
smejky 4:c7ca936cdd1f 744
smejky 4:c7ca936cdd1f 745 /* fail projekty
smejky 4:c7ca936cdd1f 746 //slider
smejky 4:c7ca936cdd1f 747 if ((touch_x > cudlik[0]) && (touch_x < cudlik[2]) && (touch_y > cudlik[1]) && (touch_y < cudlik[3]) && (pressure > 0)){
smejky 4:c7ca936cdd1f 748
smejky 4:c7ca936cdd1f 749
smejky 4:c7ca936cdd1f 750 //if je udelany tady pro nastavení minima a maxima
smejky 4:c7ca936cdd1f 751 if ((touch_x > 25) && (touch_x < 140)){
smejky 4:c7ca936cdd1f 752
smejky 4:c7ca936cdd1f 753 unsigned short int y0 = cudlik[1];
smejky 4:c7ca936cdd1f 754 unsigned short int y1 = cudlik[3];
smejky 4:c7ca936cdd1f 755 unsigned short int x_zadelavani_chyby = cudlik[0];
smejky 4:c7ca936cdd1f 756 unsigned short int x0 = x_zadelavani_chyby - 8;
smejky 4:c7ca936cdd1f 757
smejky 4:c7ca936cdd1f 758 //printf("%d\r\n",touch_x);
smejky 4:c7ca936cdd1f 759 stred_cudliku[0] = touch_x;
smejky 4:c7ca936cdd1f 760
smejky 4:c7ca936cdd1f 761 cudlik[0] = stred_cudliku[0] - 10;
smejky 4:c7ca936cdd1f 762 cudlik[1] = stred_cudliku[1] - 25;
smejky 4:c7ca936cdd1f 763 cudlik[2] = stred_cudliku[0] + 10;
smejky 4:c7ca936cdd1f 764 cudlik[3] = stred_cudliku[1] + 25;
smejky 4:c7ca936cdd1f 765
smejky 4:c7ca936cdd1f 766
smejky 4:c7ca936cdd1f 767
smejky 4:c7ca936cdd1f 768 if (touch_x > 34){
smejky 4:c7ca936cdd1f 769 x0 = x_zadelavani_chyby + 8;
smejky 4:c7ca936cdd1f 770 spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Green);
smejky 4:c7ca936cdd1f 771
smejky 4:c7ca936cdd1f 772 }else{
smejky 4:c7ca936cdd1f 773 spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Black);
smejky 4:c7ca936cdd1f 774 }
smejky 4:c7ca936cdd1f 775
smejky 4:c7ca936cdd1f 776 if (touch_x < 34){
smejky 4:c7ca936cdd1f 777 spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Black);
smejky 4:c7ca936cdd1f 778
smejky 4:c7ca936cdd1f 779 }else{
smejky 4:c7ca936cdd1f 780 x0 = x_zadelavani_chyby + 8;
smejky 4:c7ca936cdd1f 781 spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Green);
smejky 4:c7ca936cdd1f 782 }
smejky 4:c7ca936cdd1f 783 spi.fillrect(cudlik[0],cudlik[1],cudlik[2],cudlik[3],cudlik[4]);
smejky 4:c7ca936cdd1f 784
smejky 4:c7ca936cdd1f 785
smejky 4:c7ca936cdd1f 786
smejky 4:c7ca936cdd1f 787 }
smejky 4:c7ca936cdd1f 788 }
smejky 4:c7ca936cdd1f 789
smejky 4:c7ca936cdd1f 790 //slider */
smejky 4:c7ca936cdd1f 791
smejky 4:c7ca936cdd1f 792