Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG BUTTON_GROUP
main.cpp
00001 #include "mbed.h" 00002 #include "stm32746g_discovery_lcd.h" 00003 #include "stm32746g_discovery_ts.h" 00004 #include "button_group.hpp" 00005 #include "draw.h" 00006 #include "string.h" 00007 00008 //using namespace Mikami; 00009 //TS_DISCO_F746NG ts_; 00010 //LCD_DISCO_F746NG lcd_; 00011 TS_StateTypeDef TS_State; 00012 00013 void Rx_interrupt();// Routine d'interruption 00014 void page_commande(int *roro,int *bede,int *thethe,int *popo); 00015 void page_liste(void); 00016 void activ_bluetooth(void); 00017 void page_accueil(void); 00018 void aff(int *lc, int *nl); 00019 void decrem(int *lc, int *nlc); 00020 void increm (int *nlc); 00021 void COMMANDE(int *L1, int *L2, int *L3, int *L4, int *L5, int *L6, int *n1, int *n2, int *n3, int *n4, int *n5, int *n6, int *rom, int *bede, int *thethe, int*poepoe); 00022 int page = 2; 00023 uint16_t x, y; 00024 uint8_t text[30]; 00025 uint8_t n[30]; 00026 char chaine[100]; 00027 uint8_t status; 00028 uint8_t idx; 00029 uint8_t cleared = 0; 00030 uint8_t prev_nb_touches = 0; 00031 char ch; 00032 int flagE=0, flagDP=0; 00033 //float prix_total = 0; 00034 //char buffer [50]; 00035 Serial pc(USBTX, USBRX); // tx, rx 00036 Serial bluetooth1(D1, D0); // module HC-06 branché à D1 (TX) et D2 (RX) 00037 Serial ESP(A4, A5); //Module ESP branché à A4 et A5 00038 char recep[30]; 00039 00040 // NOM DES LIVRES 00041 // 0 = Hernani; 1 = Balzac; 2 = Cyrano; 3 = Blacksad; 4 = Boule&Bill; 5 = Cahier; 6 = Cid; 7 = Domjuan; 8 = Fleurs; 9 = gazette; 10 = NULL; 00042 int lc1[6] = {2,7,5,3,8,1}; 00043 int lc2[6] = {1,2,3,10,10,10}; 00044 int lc3[6] = {0,4,7,9,2,10}; 00045 int lc4[6] = {8,7,6,5,4,3}; 00046 int lc5[6] = {8,0,6,1,5,3}; 00047 int lc6[6] = {8,7,6,5,10,10}; 00048 00049 // Nombre de livres 00050 int nlc1[6] = {7,8,1,2,5,4}; 00051 int nlc2[6] = {1,2,3,0,0,0}; 00052 int nlc3[6] = {7,8,1,2,5,0}; 00053 int nlc4[6] = {8,12,7,7,7,7}; 00054 int nlc5[6] = {10,10,10,10,10,10}; 00055 int nlc6[6] = {3,10,10,10,0,0}; 00056 00057 00058 //ROMAN = BALZAC 00059 //BD = BLACKSAD, BOULE, GAZETTE 00060 //THEATRE = HERNANI, CYRANO, CID, DOMJUAN 00061 //POESIE = CAHIER, FLEURS 00062 int roman = 0; 00063 int BD = 0; 00064 int theatre = 0; 00065 int poesie = 0; 00066 00067 00068 int main() 00069 { 00070 int c[6]={0,0,0,0,0,0}; //0 = a traiter 1 = en cours 2 = fait 00071 int commande = 6; 00072 bool debut = 0; 00073 bool ledbt=0; 00074 pc.baud(9600); 00075 bluetooth1.baud(38400); 00076 ESP.baud(9600); 00077 00078 BSP_LCD_Init(); 00079 BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); 00080 BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); 00081 BSP_LCD_Clear(LCD_COLOR_WHITE); 00082 00083 status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); 00084 if (status != TS_OK) { 00085 BSP_LCD_Clear(LCD_COLOR_WHITE); 00086 BSP_LCD_SetBackColor(LCD_COLOR_WHITE); 00087 BSP_LCD_SetTextColor(LCD_COLOR_GREEN); 00088 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE); 00089 00090 } else { 00091 BSP_LCD_Clear(LCD_COLOR_WHITE); 00092 BSP_LCD_SetBackColor(LCD_COLOR_WHITE); 00093 BSP_LCD_SetTextColor(LCD_COLOR_GREEN); 00094 BSP_LCD_DisplayStringAt(0, LINE(1), (uint8_t *)"Bienvenue chez", CENTER_MODE); 00095 drawImage_Leroy_Merlin(90,80); 00096 } 00097 00098 HAL_Delay(2000); 00099 BSP_LCD_Clear(LCD_COLOR_WHITE); 00100 00101 BSP_LCD_SetFont(&Font12); 00102 BSP_LCD_SetBackColor(LCD_COLOR_WHITE); 00103 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00104 00105 ESP.attach(&Rx_interrupt, Serial::RxIrq); 00106 00107 while(1) { 00108 00109 // DETECTION CLICS 00110 BSP_TS_GetState(&TS_State); 00111 for (idx = 0; idx < TS_State.touchDetected; idx++) 00112 { 00113 x = TS_State.touchX[idx]; 00114 y = TS_State.touchY[idx]; 00115 } 00116 00117 00118 /////////////////// ACTIVATION BLUETOOTH /////////////////////////////////////// 00119 00120 if ((page==2)&&(x>=265 && x<=415)&&(y>= 50 && y<= 230)) 00121 { 00122 activ_bluetooth(); 00123 ledbt=1; 00124 x = 0; 00125 y = 0; 00126 } 00127 00128 if(ledbt==0&&page==2) 00129 { 00130 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00131 sprintf((char*)text, "BT NON CONNECTE"); 00132 BSP_LCD_DisplayStringAt(265, 250, (uint8_t *)&text, LEFT_MODE); 00133 BSP_LCD_SetTextColor(LCD_COLOR_RED); 00134 BSP_LCD_FillRect(391, 210, 24, 20); 00135 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00136 } 00137 00138 if(ledbt==1&&page==2) 00139 { 00140 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00141 sprintf((char*)text, "BT CONNECTE"); 00142 BSP_LCD_DisplayStringAt(265, 250, (uint8_t *)&text, LEFT_MODE); 00143 BSP_LCD_SetTextColor(LCD_COLOR_GREEN); 00144 BSP_LCD_FillRect(391, 210, 24, 20); 00145 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00146 } 00147 00148 //////////////////////////////////////////////////////////////////////////////// 00149 00150 00151 ////////////////CLICS//////////////// 00152 00153 // PAGE COMMANDE VERS PAGE D'ACCUEIL 00154 if ((page == 0) && (x>= 458 && x<= 480) && (y>= 0 && y<= 22)) 00155 { 00156 BSP_LCD_Clear(LCD_COLOR_WHITE); 00157 x = 0; 00158 y = 0; 00159 page = 2; 00160 page_accueil(); 00161 HAL_Delay(300); 00162 } 00163 00164 //PAGE ACCUEIL VERS PAGE COMMANDE 00165 if ((page == 2) && (x>= 65 && x<= 215) && (y>= 60 && y<= 240)) 00166 { 00167 BSP_LCD_Clear(LCD_COLOR_WHITE); 00168 x = 0; 00169 y = 0; 00170 page = 0; 00171 HAL_Delay(300); 00172 } 00173 00174 00175 // PAGE LISTE VERS PAGE COMMANDE 00176 if ((page == 1) && (x>= 458 && x<= 480) && (y>= 0 && y<= 22)) 00177 { 00178 BSP_LCD_Clear(LCD_COLOR_WHITE); 00179 x = 0; 00180 y = 0; 00181 page = 0; 00182 commande = 6; 00183 HAL_Delay(300); 00184 } 00185 00186 00187 00188 //PAGE COMMANDE 00189 // HAUT GAUCHE 00190 else if ((page == 0) && (x>= 8 && x<= 236) && (y>= 29 && y<= 103)) 00191 { 00192 x = 0; 00193 y = 0; 00194 page = 1; 00195 BSP_LCD_Clear(LCD_COLOR_WHITE); 00196 page_liste(); 00197 commande = 0; 00198 HAL_Delay(200); 00199 } 00200 00201 // HAUT DROITE 00202 else if ((page == 0) && (x>= 244 && x<= 472) && (y>= 29 && y<= 103)) 00203 { 00204 x = 0; 00205 y = 0; 00206 page = 1; 00207 BSP_LCD_Clear(LCD_COLOR_WHITE); 00208 page_liste(); 00209 commande = 1; 00210 HAL_Delay(200); 00211 } 00212 00213 // MILIEU GAUCHE 00214 else if ((page == 0) && (x>= 8 && x<= 236) && (y>= 110 && y<= 184)) 00215 { 00216 x = 0; 00217 y = 0; 00218 page = 1; 00219 BSP_LCD_Clear(LCD_COLOR_WHITE); 00220 page_liste(); 00221 commande = 2; 00222 HAL_Delay(200); 00223 } 00224 00225 // MILIEU DROITE 00226 else if ((page == 0) && (x>= 244 && x<= 472) && (y>= 110 && y<= 184)) 00227 { 00228 x = 0; 00229 y = 0; 00230 page = 1; 00231 BSP_LCD_Clear(LCD_COLOR_WHITE); 00232 page_liste(); 00233 commande = 3; 00234 HAL_Delay(200); 00235 } 00236 00237 // BAS GAUCHE 00238 else if ((page == 0) && (x>= 8 && x<= 236) && (y>= 192 && y<= 266)) 00239 { 00240 x = 0; 00241 y = 0; 00242 page = 1; 00243 BSP_LCD_Clear(LCD_COLOR_WHITE); 00244 page_liste(); 00245 commande = 4; 00246 HAL_Delay(200); 00247 } 00248 00249 00250 // BAS DROITE 00251 else if ((page == 0) && (x>= 244 && x<= 472) && (y>= 192 && y<= 266)) 00252 { 00253 x = 0; 00254 y = 0; 00255 page = 1; 00256 BSP_LCD_Clear(LCD_COLOR_WHITE); 00257 page_liste(); 00258 commande = 5; 00259 HAL_Delay(200); 00260 } 00261 00262 else if (page == 0) 00263 { 00264 page_commande(&roman,&BD,&theatre,&poesie); 00265 // AFFICHAGE DES PASTILLES DE COULEURS 00266 for (int i=0;i<6;i++) 00267 { 00268 if(c[i] == 0){ 00269 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00270 BSP_LCD_FillRect(211+(236*(i%2)), 80+(80*(i/2)), 25, 24); 00271 } 00272 else if(c[i] == 1){ 00273 BSP_LCD_SetTextColor(LCD_COLOR_RED); 00274 BSP_LCD_FillRect(211+(236*(i%2)), 80+(80*(i/2)), 25, 24); 00275 } 00276 else if(c[i] == 2){ 00277 BSP_LCD_SetTextColor(LCD_COLOR_GREEN); 00278 BSP_LCD_FillRect(211+(236*(i%2)), 80+(80*(i/2)), 25, 24); 00279 } 00280 } 00281 } 00282 00283 else if (page == 1) 00284 { 00285 page_liste(); 00286 } 00287 00288 else if (page == 2) 00289 { 00290 page_accueil(); 00291 } 00292 00293 00294 00295 switch (commande) 00296 { 00297 00298 case 0: 00299 aff(lc1,nlc1); 00300 if ( c[0] == 0 ) 00301 { 00302 if (debut == 0) 00303 { 00304 BSP_LCD_DrawRect(8, 220, 228, 45); 00305 sprintf((char*)text, "CHOISIR LA COMMANDE"); 00306 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00307 } 00308 if (debut == 1) 00309 { 00310 BSP_LCD_DrawRect(8, 220, 228, 45); 00311 sprintf((char*)text, "AUTRE COMMANDE EN COURS"); 00312 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00313 } 00314 00315 if ( (debut==0) && (x>= 8 && x<= 236) && (y>= 220 && y<= 265) ) 00316 { 00317 x=0; 00318 y=0; 00319 c[0]= 1 ; 00320 HAL_Delay(200); 00321 BSP_LCD_Clear(LCD_COLOR_WHITE); 00322 } 00323 } 00324 00325 if ( c[0] == 1 ) 00326 { 00327 debut=1; 00328 sprintf((char*)text, "COMMANDE EN COURS"); 00329 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00330 BSP_LCD_DrawRect(244, 220, 228, 45); 00331 sprintf((char*)text, "FIN DE COMMANDE"); 00332 BSP_LCD_DisplayStringAt(300, 242, (uint8_t *)&text, LEFT_MODE); 00333 00334 if(bluetooth1.readable()) 00335 { 00336 ch=bluetooth1.getc(); 00337 decrem(lc1,nlc1); 00338 } 00339 00340 increm(nlc1); 00341 00342 00343 00344 if ( (x>= 244 && x<= 472) && (y>= 220 && y<= 265) ) //Fin de commande 00345 { 00346 x=0; 00347 y=0; 00348 c[0]= 2 ; 00349 x=475; 00350 y=5; 00351 HAL_Delay(200); 00352 BSP_LCD_Clear(LCD_COLOR_WHITE); 00353 } 00354 } 00355 00356 if ( c[0] == 2 ) 00357 { 00358 debut = 0; 00359 sprintf((char*)text, "COMMANDE TRAITEE"); 00360 BSP_LCD_DisplayStringAt(0,260, (uint8_t *)&text, CENTER_MODE); 00361 } 00362 break; 00363 00364 case 1: 00365 aff(lc2,nlc2); 00366 if ( c[1] == 0 ) 00367 { 00368 if (debut == 0) 00369 { 00370 BSP_LCD_DrawRect(8, 220, 228, 45); 00371 sprintf((char*)text, "CHOISIR LA COMMANDE"); 00372 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00373 } 00374 if (debut == 1) 00375 { 00376 BSP_LCD_DrawRect(8, 220, 228, 45); 00377 sprintf((char*)text, "AUTRE COMMANDE EN COURS"); 00378 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00379 } 00380 00381 if ( (debut==0) && (x>= 8 && x<= 236) && (y>= 220 && y<= 265) ) 00382 { 00383 x=0; 00384 y=0; 00385 c[1]= 1 ; 00386 HAL_Delay(200); 00387 BSP_LCD_Clear(LCD_COLOR_WHITE); 00388 } 00389 } 00390 00391 if ( c[1] == 1 ) 00392 { 00393 debut=1; 00394 sprintf((char*)text, "COMMANDE EN COURS"); 00395 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00396 BSP_LCD_DrawRect(244, 220, 228, 45); 00397 sprintf((char*)text, "FIN DE COMMANDE"); 00398 BSP_LCD_DisplayStringAt(300, 242, (uint8_t *)&text, LEFT_MODE); 00399 00400 if(bluetooth1.readable()) 00401 { 00402 ch=bluetooth1.getc(); 00403 decrem(lc2,nlc2); 00404 } 00405 00406 increm(nlc2); 00407 00408 00409 00410 if ( (x>= 244 && x<= 472) && (y>= 220 && y<= 265) ) //Fin de commande 00411 { 00412 x=0; 00413 y=0; 00414 c[1]= 2 ; 00415 x=475; 00416 y=5; 00417 HAL_Delay(200); 00418 BSP_LCD_Clear(LCD_COLOR_WHITE); 00419 } 00420 } 00421 00422 if ( c[1] == 2 ) 00423 { 00424 debut = 0; 00425 sprintf((char*)text, "COMMANDE TRAITEE"); 00426 BSP_LCD_DisplayStringAt(0,260, (uint8_t *)&text, CENTER_MODE); 00427 } 00428 break; 00429 00430 case 2: 00431 aff(lc3,nlc3); 00432 if ( c[2] == 0 ) 00433 { 00434 if (debut == 0) 00435 { 00436 BSP_LCD_DrawRect(8, 220, 228, 45); 00437 sprintf((char*)text, "CHOISIR LA COMMANDE"); 00438 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00439 } 00440 if (debut == 1) 00441 { 00442 BSP_LCD_DrawRect(8, 220, 228, 45); 00443 sprintf((char*)text, "AUTRE COMMANDE EN COURS"); 00444 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00445 } 00446 00447 if ( (debut==0) && (x>= 8 && x<= 236) && (y>= 220 && y<= 265) ) 00448 { 00449 x=0; 00450 y=0; 00451 c[2]= 1 ; 00452 HAL_Delay(200); 00453 BSP_LCD_Clear(LCD_COLOR_WHITE); 00454 } 00455 } 00456 00457 if ( c[2] == 1 ) 00458 { 00459 debut=1; 00460 sprintf((char*)text, "COMMANDE EN COURS"); 00461 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00462 BSP_LCD_DrawRect(244, 220, 228, 45); 00463 sprintf((char*)text, "FIN DE COMMANDE"); 00464 BSP_LCD_DisplayStringAt(300, 242, (uint8_t *)&text, LEFT_MODE); 00465 00466 if(bluetooth1.readable()) 00467 { 00468 ch=bluetooth1.getc(); 00469 decrem(lc3,nlc3); 00470 } 00471 00472 increm(nlc3); 00473 00474 00475 00476 if ( (x>= 244 && x<= 472) && (y>= 220 && y<= 265) ) //Fin de commande 00477 { 00478 x=0; 00479 y=0; 00480 c[2]= 2 ; 00481 x=475; 00482 y=5; 00483 HAL_Delay(200); 00484 BSP_LCD_Clear(LCD_COLOR_WHITE); 00485 } 00486 } 00487 00488 if ( c[2] == 2 ) 00489 { 00490 debut = 0; 00491 sprintf((char*)text, "COMMANDE TRAITEE"); 00492 BSP_LCD_DisplayStringAt(0,260, (uint8_t *)&text, CENTER_MODE); 00493 } 00494 break; 00495 00496 case 3: 00497 aff(lc4,nlc4); 00498 if ( c[3] == 0 ) 00499 { 00500 if (debut == 0) 00501 { 00502 BSP_LCD_DrawRect(8, 220, 228, 45); 00503 sprintf((char*)text, "CHOISIR LA COMMANDE"); 00504 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00505 } 00506 if (debut == 1) 00507 { 00508 BSP_LCD_DrawRect(8, 220, 228, 45); 00509 sprintf((char*)text, "AUTRE COMMANDE EN COURS"); 00510 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00511 } 00512 00513 if ( (debut==0) && (x>= 8 && x<= 236) && (y>= 220 && y<= 265) ) 00514 { 00515 x=0; 00516 y=0; 00517 c[3]= 1 ; 00518 HAL_Delay(200); 00519 BSP_LCD_Clear(LCD_COLOR_WHITE); 00520 } 00521 } 00522 00523 if ( c[3] == 1 ) 00524 { 00525 debut=1; 00526 sprintf((char*)text, "COMMANDE EN COURS"); 00527 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00528 BSP_LCD_DrawRect(244, 220, 228, 45); 00529 sprintf((char*)text, "FIN DE COMMANDE"); 00530 BSP_LCD_DisplayStringAt(300, 242, (uint8_t *)&text, LEFT_MODE); 00531 00532 if(bluetooth1.readable()) 00533 { 00534 ch=bluetooth1.getc(); 00535 decrem(lc4,nlc4); 00536 } 00537 00538 increm(nlc4); 00539 00540 00541 00542 if ( (x>= 244 && x<= 472) && (y>= 220 && y<= 265) ) //Fin de commande 00543 { 00544 x=0; 00545 y=0; 00546 c[3]= 2 ; 00547 x=475; 00548 y=5; 00549 HAL_Delay(200); 00550 BSP_LCD_Clear(LCD_COLOR_WHITE); 00551 } 00552 } 00553 00554 if ( c[3] == 2 ) 00555 { 00556 debut = 0; 00557 sprintf((char*)text, "COMMANDE TRAITEE"); 00558 BSP_LCD_DisplayStringAt(0,260, (uint8_t *)&text, CENTER_MODE); 00559 } 00560 break; 00561 00562 case 4: 00563 aff(lc5,nlc5); 00564 if ( c[4] == 0 ) 00565 { 00566 if (debut == 0) 00567 { 00568 BSP_LCD_DrawRect(8, 220, 228, 45); 00569 sprintf((char*)text, "CHOISIR LA COMMANDE"); 00570 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00571 } 00572 if (debut == 1) 00573 { 00574 BSP_LCD_DrawRect(8, 220, 228, 45); 00575 sprintf((char*)text, "AUTRE COMMANDE EN COURS"); 00576 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00577 } 00578 00579 if ( (debut==0) && (x>= 8 && x<= 236) && (y>= 220 && y<= 265) ) 00580 { 00581 x=0; 00582 y=0; 00583 c[4]= 1 ; 00584 HAL_Delay(200); 00585 BSP_LCD_Clear(LCD_COLOR_WHITE); 00586 } 00587 } 00588 00589 if ( c[4] == 1 ) 00590 { 00591 debut=1; 00592 sprintf((char*)text, "COMMANDE EN COURS"); 00593 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00594 BSP_LCD_DrawRect(244, 220, 228, 45); 00595 sprintf((char*)text, "FIN DE COMMANDE"); 00596 BSP_LCD_DisplayStringAt(300, 242, (uint8_t *)&text, LEFT_MODE); 00597 00598 if(bluetooth1.readable()) 00599 { 00600 ch=bluetooth1.getc(); 00601 decrem(lc5,nlc5); 00602 } 00603 00604 increm(nlc5); 00605 00606 00607 00608 if ( (x>= 244 && x<= 472) && (y>= 220 && y<= 265) ) //Fin de commande 00609 { 00610 x=0; 00611 y=0; 00612 c[4]= 2 ; 00613 x=475; 00614 y=5; 00615 HAL_Delay(200); 00616 BSP_LCD_Clear(LCD_COLOR_WHITE); 00617 } 00618 } 00619 00620 if ( c[4] == 2 ) 00621 { 00622 debut = 0; 00623 sprintf((char*)text, "COMMANDE TRAITEE"); 00624 BSP_LCD_DisplayStringAt(0,260, (uint8_t *)&text, CENTER_MODE); 00625 } 00626 break; 00627 00628 case 5: 00629 aff(lc6,nlc6); 00630 if ( c[5] == 0 ) 00631 { 00632 if (debut == 0) 00633 { 00634 BSP_LCD_DrawRect(8, 220, 228, 45); 00635 sprintf((char*)text, "CHOISIR LA COMMANDE"); 00636 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00637 } 00638 if (debut == 1) 00639 { 00640 BSP_LCD_DrawRect(8, 220, 228, 45); 00641 sprintf((char*)text, "AUTRE COMMANDE EN COURS"); 00642 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00643 } 00644 00645 if ( (debut==0) && (x>= 8 && x<= 236) && (y>= 220 && y<= 265) ) 00646 { 00647 x=0; 00648 y=0; 00649 c[5]= 1 ; 00650 HAL_Delay(200); 00651 BSP_LCD_Clear(LCD_COLOR_WHITE); 00652 } 00653 } 00654 00655 if ( c[5] == 1 ) 00656 { 00657 debut=1; 00658 sprintf((char*)text, "COMMANDE EN COURS"); 00659 BSP_LCD_DisplayStringAt(52, 242, (uint8_t *)&text, LEFT_MODE); 00660 BSP_LCD_DrawRect(244, 220, 228, 45); 00661 sprintf((char*)text, "FIN DE COMMANDE"); 00662 BSP_LCD_DisplayStringAt(300, 242, (uint8_t *)&text, LEFT_MODE); 00663 00664 if(bluetooth1.readable()) 00665 { 00666 ch=bluetooth1.getc(); 00667 decrem(lc6,nlc6); 00668 } 00669 00670 increm(nlc6); 00671 00672 00673 00674 if ( (x>= 244 && x<= 472) && (y>= 220 && y<= 265) ) //Fin de commande 00675 { 00676 x=0; 00677 y=0; 00678 c[5]= 2 ; 00679 x=475; 00680 y=5; 00681 HAL_Delay(200); 00682 BSP_LCD_Clear(LCD_COLOR_WHITE); 00683 } 00684 } 00685 00686 if ( c[5] == 2 ) 00687 { 00688 debut = 0; 00689 sprintf((char*)text, "COMMANDE TRAITEE"); 00690 BSP_LCD_DisplayStringAt(0,260, (uint8_t *)&text, CENTER_MODE); 00691 } 00692 break; 00693 00694 case 6 : 00695 break; 00696 00697 default: 00698 break; 00699 } 00700 } 00701 00702 00703 } 00704 00705 ////////////////////////////////////// 00706 ////////////PAGE COMMANDE///////////// 00707 ////////////////////////////////////// 00708 void page_commande (int *roro,int *bede,int *thethe,int *popo){ 00709 page = 0; 00710 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00711 drawImage_LogoParisSaclay(0,0); 00712 sprintf((char*)text, "Page commandes"); 00713 BSP_LCD_DisplayStringAt(0, LINE(0), (uint8_t *)&text, CENTER_MODE); 00714 00715 BSP_LCD_DrawHLine(0,22,480); 00716 00717 drawImage_fleche(447,0); 00718 00719 // LES COMMANDES 00720 00721 // Au dessus 22px de la barre + 7// 00722 /* 8px */ BSP_LCD_DrawRect(8, 29, 228, 74); /* 8px */ BSP_LCD_DrawRect(244, 29, 228, 74); /* 8px */ 00723 /* 7px */ 00724 /* 8px */ BSP_LCD_DrawRect(8, 110, 228, 74); /* 8px */ BSP_LCD_DrawRect(244, 110, 228, 74); /* 8px */ 00725 /* 7px */ 00726 /* 8px */ BSP_LCD_DrawRect(8, 191, 228, 73); /* 8px */ BSP_LCD_DrawRect(244, 191, 228, 73); /* 8px */ 00727 // Au dessous 7px// 00728 00729 //SEGMENTATION DES CASES COMMANDES 00730 BSP_LCD_DrawHLine(8,79,228); BSP_LCD_DrawHLine(244,79,228); 00731 BSP_LCD_DrawHLine(8,159,228); BSP_LCD_DrawHLine(244,159,228); 00732 BSP_LCD_DrawHLine(8,239,228); BSP_LCD_DrawHLine(244,239,228); 00733 sprintf((char*)text, "Commande #0001"); 00734 BSP_LCD_DisplayStringAt(20,87, (uint8_t *)&text, LEFT_MODE); 00735 sprintf((char*)text, "Commande #0002"); 00736 BSP_LCD_DisplayStringAt(257, 87, (uint8_t *)&text, LEFT_MODE); 00737 sprintf((char*)text, "Commande #0003"); 00738 BSP_LCD_DisplayStringAt(20, 167, (uint8_t *)&text, LEFT_MODE); 00739 sprintf((char*)text, "Commande #0004"); 00740 BSP_LCD_DisplayStringAt(257, 167, (uint8_t *)&text, LEFT_MODE); 00741 sprintf((char*)text, "Commande #0005"); 00742 BSP_LCD_DisplayStringAt(20, 247, (uint8_t *)&text, LEFT_MODE); 00743 sprintf((char*)text, "Commande #0006"); 00744 BSP_LCD_DisplayStringAt(257, 247, (uint8_t *)&text, LEFT_MODE); 00745 00746 // CONTENU COMMANDE 00747 //1 00748 COMMANDE(&lc1[0], &lc1[1], &lc1[2], &lc1[3], &lc1[4], &lc1[5], &nlc1[0], &nlc1[1], &nlc1[2], &nlc1[3], &nlc1[4], &nlc1[5], &roman, &BD, &theatre, &poesie); 00749 sprintf((char*)text, "%d THEATRE(S)",*thethe); 00750 BSP_LCD_DisplayStringAt(20, 40, (uint8_t *)&text, LEFT_MODE); 00751 sprintf((char*)text, "%d POESIE(S)",*popo); 00752 BSP_LCD_DisplayStringAt(20, 60, (uint8_t *)&text, LEFT_MODE); 00753 sprintf((char*)text, "%d ROMAN(S)",*roro); 00754 BSP_LCD_DisplayStringAt(140, 40, (uint8_t *)&text, LEFT_MODE); 00755 sprintf((char*)text, "%d BD", *bede); 00756 BSP_LCD_DisplayStringAt(140, 60, (uint8_t *)&text, LEFT_MODE); 00757 //2 00758 COMMANDE(&lc2[0], &lc2[1], &lc2[2], &lc2[3], &lc2[4], &lc2[5], &nlc2[0], &nlc2[1], &nlc2[2], &nlc2[3], &nlc2[4], &nlc2[5], &roman, &BD, &theatre, &poesie); 00759 sprintf((char*)text, "%d THEATRE(S)",*thethe); 00760 BSP_LCD_DisplayStringAt(257, 40, (uint8_t *)&text, LEFT_MODE); 00761 sprintf((char*)text, "%d POESIE(S)",*popo); 00762 BSP_LCD_DisplayStringAt(257, 60, (uint8_t *)&text, LEFT_MODE); 00763 sprintf((char*)text, "%d ROMAN(S)",*roro); 00764 BSP_LCD_DisplayStringAt(377, 40, (uint8_t *)&text, LEFT_MODE); 00765 sprintf((char*)text, "%d BD", *bede); 00766 BSP_LCD_DisplayStringAt(377, 60, (uint8_t *)&text, LEFT_MODE); 00767 //3 00768 COMMANDE(&lc3[0], &lc3[1], &lc3[2], &lc3[3], &lc3[4], &lc3[5], &nlc3[0], &nlc3[1], &nlc3[2], &nlc3[3], &nlc3[4], &nlc3[5], &roman, &BD, &theatre, &poesie); 00769 sprintf((char*)text, "%d THEATRE(S)",*thethe); 00770 BSP_LCD_DisplayStringAt(20, 120, (uint8_t *)&text, LEFT_MODE); 00771 sprintf((char*)text, "%d POESIE(S)",*popo); 00772 BSP_LCD_DisplayStringAt(20, 140, (uint8_t *)&text, LEFT_MODE); 00773 sprintf((char*)text, "%d ROMAN(S)",*roro); 00774 BSP_LCD_DisplayStringAt(140, 120, (uint8_t *)&text, LEFT_MODE); 00775 sprintf((char*)text, "%d BD", *bede); 00776 BSP_LCD_DisplayStringAt(140, 140, (uint8_t *)&text, LEFT_MODE); 00777 //4 00778 COMMANDE(&lc4[0], &lc4[1], &lc4[2], &lc4[3], &lc4[4], &lc4[5], &nlc4[0], &nlc4[1], &nlc4[2], &nlc4[3], &nlc4[4], &nlc4[5], &roman, &BD, &theatre, &poesie); 00779 sprintf((char*)text, "%d THEATRE(S)",*thethe); 00780 BSP_LCD_DisplayStringAt(257, 120, (uint8_t *)&text, LEFT_MODE); 00781 sprintf((char*)text, "%d POESIE(S)",*popo); 00782 BSP_LCD_DisplayStringAt(257, 140, (uint8_t *)&text, LEFT_MODE); 00783 sprintf((char*)text, "%d ROMAN(S)",*roro); 00784 BSP_LCD_DisplayStringAt(377, 120, (uint8_t *)&text, LEFT_MODE); 00785 sprintf((char*)text, "%d BD", *bede); 00786 BSP_LCD_DisplayStringAt(377, 140, (uint8_t *)&text, LEFT_MODE); 00787 //5 00788 COMMANDE(&lc5[0], &lc5[1], &lc5[2], &lc5[3], &lc5[4], &lc5[5], &nlc5[0], &nlc5[1], &nlc5[2], &nlc5[3], &nlc5[4], &nlc5[5], &roman, &BD, &theatre, &poesie); 00789 sprintf((char*)text, "%d THEATRE(S)",*thethe); 00790 BSP_LCD_DisplayStringAt(20, 200, (uint8_t *)&text, LEFT_MODE); 00791 sprintf((char*)text, "%d POESIE(S)",*popo); 00792 BSP_LCD_DisplayStringAt(20, 220, (uint8_t *)&text, LEFT_MODE); 00793 sprintf((char*)text, "%d ROMAN(S)",*roro); 00794 BSP_LCD_DisplayStringAt(140, 200, (uint8_t *)&text, LEFT_MODE); 00795 sprintf((char*)text, "%d BD", *bede); 00796 BSP_LCD_DisplayStringAt(140, 220, (uint8_t *)&text, LEFT_MODE); 00797 //6 00798 COMMANDE(&lc6[0], &lc6[1], &lc6[2], &lc6[3], &lc6[4], &lc6[5], &nlc6[0], &nlc6[1], &nlc6[2], &nlc6[3], &nlc6[4], &nlc6[5], &roman, &BD, &theatre, &poesie); 00799 sprintf((char*)text, "%d THEATRE(S)",*thethe); 00800 BSP_LCD_DisplayStringAt(257, 200, (uint8_t *)&text, LEFT_MODE); 00801 sprintf((char*)text, "%d POESIE(S)",*popo); 00802 BSP_LCD_DisplayStringAt(257, 220, (uint8_t *)&text, LEFT_MODE); 00803 sprintf((char*)text, "%d ROMAN(S)",*roro); 00804 BSP_LCD_DisplayStringAt(377, 200, (uint8_t *)&text, LEFT_MODE); 00805 sprintf((char*)text, "%d BD", *bede); 00806 BSP_LCD_DisplayStringAt(377, 220, (uint8_t *)&text, LEFT_MODE); 00807 00808 00809 } 00810 /////////////////////////////////////////////////////////////////////////// 00811 00812 00813 //////////////////////////////////// 00814 //////////PAGE LISTE//////////////// 00815 //////////////////////////////////// 00816 void page_liste(){ 00817 page = 1; 00818 00819 drawImage_LogoParisSaclay(0,0); 00820 drawImage_fleche(447,0); 00821 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00822 BSP_LCD_DrawHLine(0,22,480); 00823 00824 sprintf((char*)text, "Page liste"); 00825 BSP_LCD_DisplayStringAt(0, LINE(0), (uint8_t *)&text, CENTER_MODE); 00826 } 00827 /////////////////////////////////////////////////////////////////////////// 00828 00829 00830 //////////////////////////////////// 00831 ///////////PAGE ACCUEIL///////////// 00832 //////////////////////////////////// 00833 void page_accueil(){ 00834 page = 2; 00835 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 00836 00837 drawImage_LogoParisSaclay(0,0); 00838 drawImage_BT(268,60); 00839 drawImage_market(95,85); 00840 00841 sprintf((char*)text, "Page d'accueil"); 00842 BSP_LCD_DisplayStringAt(0, LINE(2), (uint8_t *)&text, CENTER_MODE); 00843 00844 BSP_LCD_DrawRect(65, 55, 150, 175); //Bouton commande 00845 BSP_LCD_DrawHLine(65,210,150); 00846 sprintf((char*)text, "PAGE COMMANDE"); 00847 BSP_LCD_DisplayStringAt(95, LINE(18), (uint8_t *)&text, LEFT_MODE); 00848 00849 00850 BSP_LCD_DrawRect(265, 55, 150, 175); //Bouton BT 00851 BSP_LCD_DrawHLine(265,210,150); 00852 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00853 sprintf((char*)text, "BLUETOOTH"); 00854 BSP_LCD_DisplayStringAt(102, LINE(18), (uint8_t *)&text, CENTER_MODE); 00855 } 00856 /////////////////////////////////////////////////////////////////////////// 00857 00858 00859 // 0 = Hernani; 1 = Balzac; 2 = Cyrano; 3 = Blacksad; 4 = Boule&Bill; 5 = Cahier; 6 = Cid; 7 = Domjuan; 8 = Fleurs; 9 = gazette; 10 = NULL; 00860 //ROMAN = BALZAC 00861 //BD = BLACKSAD, BOULE, GAZETTE 00862 //THEATRE = HERNANI, CYRANO, CID, DOMJUAN 00863 //POESIE = CAHIER, FLEURS 00864 00865 //int l1c1 = 3; int l2c1 = 7; int l3c1 = 1; int l4c1 = 8; int l5c1 = 2; int l6c1 = 0; 00866 //int nl1c1 = 5; int nl2c1 = 8; int nl3c1 = 8; int nl4c1 = 1; int nl5c1 = 2; int nl6c1 = 4; 00867 //COMMANDE(&l1c1, &l2c1, &l3c1, &l4c1, &l5c1, &l6c1, &nl1c1, &nl2c1, &nl3c1, &nl4c1, &nl5c1, &nl6c1, &roman, &BD, &theatre, &poesie); 00868 //ROMAN = 8 ; BD = 5; THEATRE = 14 ; POESIE = 1 ; 00869 00870 00871 // COMPTE LE NOMBRE DE CHAQUE TYPE DE LIVRE 00872 void COMMANDE(int *L1, int *L2, int *L3, int *L4, int *L5, int *L6, int *n1, int *n2, int *n3, int *n4, int *n5, int *n6, int *rom, int *bede, int *thethe, int*poepoe){ 00873 *rom=0; 00874 *bede=0; 00875 *thethe=0; 00876 *poepoe=0; 00877 if (*L1==1){*rom=*rom+*n1;} 00878 else if (*L1==3||*L1==4||*L1==9){*bede = *bede+*n1;} 00879 else if (*L1==0||*L1==2||*L1==6||*L1==7){*thethe = *thethe+*n1;} 00880 else if (*L1==5||*L1==8){*poepoe = *poepoe+*n1;} 00881 00882 if (*L2==1){*rom=*rom+*n2;} 00883 else if (*L2==3||*L2==4||*L2==9){*bede = *bede+*n2;} 00884 else if (*L2==0||*L2==2||*L2==6||*L2==7){*thethe = *thethe+*n2;} 00885 else if (*L2==5||*L2==8){*poepoe = *poepoe+*n2;} 00886 00887 if (*L3==1){*rom=*rom+*n3;} 00888 else if (*L3==3||*L3==4||*L3==9){*bede = *bede+*n3;} 00889 else if (*L3==0||*L3==2||*L3==6||*L3==7){*thethe = *thethe+*n3;} 00890 else if (*L3==5||*L3==8){*poepoe = *poepoe+*n3;} 00891 00892 if (*L4==1){*rom=*rom+*n4;} 00893 else if (*L4==3||*L4==4||*L4==9){*bede = *bede+*n4;} 00894 else if (*L4==0||*L4==2||*L4==6||*L4==7){*thethe = *thethe+*n4;} 00895 else if (*L4==5||*L4==8){*poepoe = *poepoe+*n4;} 00896 00897 if (*L5==1){*rom=*rom+*n5;} 00898 else if (*L5==3||*L5==4||*L5==9){*bede = *bede+*n5;} 00899 else if (*L5==0||*L5==2||*L5==6||*L5==7){*thethe = *thethe+*n5;} 00900 else if (*L5==5||*L5==8){*poepoe = *poepoe+*n5;} 00901 00902 if (*L6==1){*rom=*rom+*n6;} 00903 else if (*L6==3||*L6==4||*L6==9){*bede = *bede+*n6;} 00904 else if (*L6==0||*L6==2||*L6==6||*L6==7){*thethe = *thethe+*n6;} 00905 else if (*L6==5||*L6==8){*poepoe = *poepoe+*n6;} 00906 00907 00908 return; 00909 } 00910 00911 void activ_bluetooth (){ 00912 BSP_LCD_Clear(LCD_COLOR_WHITE); 00913 page_accueil(); 00914 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00915 sprintf((char*)text, "BT EN COURS DE CONNEXION"); 00916 BSP_LCD_DisplayStringAt(270, 250, (uint8_t *)&text, LEFT_MODE); 00917 00918 bluetooth1.printf("AT+NAME=RMAAD\r\n"); 00919 HAL_Delay (1500); 00920 00921 bluetooth1.printf("AT+NAME=TITOF\r\n"); 00922 HAL_Delay (1500); 00923 00924 bluetooth1.printf("AT+ROLE=1\r\n"); 00925 HAL_Delay (1500); 00926 00927 00928 bluetooth1.printf("AT+RESET\r\n"); 00929 HAL_Delay (1500); 00930 00931 bluetooth1.printf("AT+CMODE=0\r\n"); 00932 HAL_Delay (1500); 00933 00934 bluetooth1.printf("AT+INQM=0,10,15\r\n"); 00935 HAL_Delay (1500); 00936 00937 bluetooth1.printf("AT+INIT\r\n"); 00938 HAL_Delay (1500); 00939 00940 bluetooth1.printf("AT+INQ\r\n"); // RECHERCHE DES DEVICES 00941 HAL_Delay (1500); 00942 00943 bluetooth1.printf("AT+BIND=1C,97,1A4CF1\r\n"); 00944 HAL_Delay (1500); 00945 00946 bluetooth1.printf("AT+CMODE=1\r\n"); 00947 HAL_Delay (1500); 00948 00949 bluetooth1.printf("AT+LINK=1C,97,1A4CF1\r\n"); 00950 HAL_Delay (1500); 00951 BSP_LCD_Clear(LCD_COLOR_WHITE); 00952 page_accueil(); 00953 } 00954 00955 00956 00957 void aff(int *lc, int *nl){ 00958 for (int i=0;i<6;i++){ 00959 if (*(lc+i) ==0) 00960 { 00961 drawImage_hernani( 10+(160*(i/2)),30+(90*(i%2)) ); 00962 sprintf((char*)text, "%d",*(nl+i)); 00963 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00964 sprintf((char*)text, "HERNANI"); 00965 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00966 } 00967 if (*(lc+i)==1) 00968 { 00969 drawImage_balzac( 10+(160*(i/2)),30+(90*(i%2)) ); 00970 sprintf((char*)text, "%d",*(nl+i)); 00971 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00972 sprintf((char*)text, "BALZAC"); 00973 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00974 } 00975 if (*(lc+i)==2) 00976 { 00977 drawImage_cyrano( 10+(160*(i/2)),30+(90*(i%2)) ); 00978 sprintf((char*)text, "%d",*(nl+i)); 00979 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00980 sprintf((char*)text, "CYRACNO"); 00981 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00982 } 00983 if (*(lc+i)==3) 00984 { 00985 drawImage_blacksad( 10+(160*(i/2)),30+(90*(i%2)) ); 00986 sprintf((char*)text, "%d",*(nl+i)); 00987 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00988 sprintf((char*)text, "BLACKSAD"); 00989 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00990 } 00991 if (*(lc+i)==4) 00992 { 00993 drawImage_boule( 10+(160*(i/2)),30+(90*(i%2)) ); 00994 sprintf((char*)text, "%d",*(nl+i)); 00995 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00996 sprintf((char*)text, "BOULE&BILL"); 00997 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 00998 } 00999 if (*(lc+i)==5) 01000 { 01001 drawImage_cahier( 10+(160*(i/2)),30+(90*(i%2)) ); 01002 sprintf((char*)text, "%d",*(nl+i)); 01003 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01004 sprintf((char*)text, "CAHIER"); 01005 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01006 } 01007 if (*(lc+i)==6) 01008 { 01009 drawImage_cid( 10+(160*(i/2)),30+(90*(i%2)) ); 01010 sprintf((char*)text, "%d",*(nl+i)); 01011 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01012 sprintf((char*)text, "CID"); 01013 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01014 } 01015 if (*(lc+i)==7) 01016 { 01017 drawImage_domjuan( 10+(160*(i/2)),30+(90*(i%2)) ); 01018 sprintf((char*)text, "%d",*(nl+i)); 01019 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01020 sprintf((char*)text, "DOMJUAN"); 01021 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01022 } 01023 if (*(lc+i)==8) 01024 { 01025 drawImage_fleurs( 10+(160*(i/2)),30+(90*(i%2)) ); 01026 sprintf((char*)text, "%d",*(nl+i)); 01027 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01028 sprintf((char*)text, "FLEURS"); 01029 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01030 } 01031 if (*(lc+i)==9) 01032 { 01033 drawImage_gazette( 10+(160*(i/2)),30+(90*(i%2)) ); 01034 sprintf((char*)text, "%d",*(nl+i)); 01035 BSP_LCD_DisplayStringAt(80+(160*(i/2)), 35+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01036 sprintf((char*)text, "GAZETTE"); 01037 BSP_LCD_DisplayStringAt( 8+(160*(i/2)), 105+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01038 } 01039 if (*(lc+i)==10) 01040 { 01041 01042 } 01043 } 01044 } 01045 01046 01047 01048 void decrem(int *lc ,int *nlc) 01049 { 01050 for (int i=0;i<6;i++) 01051 { 01052 sprintf((char*)n, "%d", *(lc+i)); 01053 if (ch==*n){ 01054 *(nlc+i)=*(nlc+i)-1; 01055 } 01056 if(*(nlc+i)<0){ 01057 sprintf((char*)text, "SCAN EN TROP"); 01058 BSP_LCD_DisplayStringAt( 65+(160*(i/2)), 48+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01059 BSP_LCD_DrawRect(65+(160*(i/2)), 60+(100*(i%2)), 75, 42); 01060 sprintf((char*)text, "Remis en"); 01061 BSP_LCD_DisplayStringAt(70+(160*(i/2)), 65+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01062 sprintf((char*)text, "rayon"); 01063 BSP_LCD_DisplayStringAt(75+(160*(i/2)), 77+(100*(i%2)), (uint8_t *)&text, LEFT_MODE); 01064 } 01065 } 01066 } 01067 01068 01069 void increm(int *nlc) 01070 { 01071 for (int i=0;i<6;i++) 01072 { 01073 if(page == 1 && x>=(65+(160*(i/2))) && x<=(140+(160*(i/2))) && y>=(60+(100*(i%2))) && y<=(105+(100*(i%2))) && *(nlc+i)<0) 01074 { 01075 *(nlc+i) = *(nlc+i) + 1 ; 01076 x=0;y=0; 01077 HAL_Delay(200); 01078 if(*(nlc+i)==0) 01079 { 01080 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 01081 BSP_LCD_FillRect((65+(160*(i/2))), (60+(100*(i%2))), 75, 45); 01082 BSP_LCD_SetTextColor(LCD_COLOR_BLACK); 01083 } 01084 } 01085 } 01086 } 01087 01088 void Rx_interrupt() { 01089 01090 /* char texte[]="{*2*:0,*1*:0,*2*:0"; 01091 //int lc1[6] = {10,10,10,10,10,10}; int nlc1[6] = {0,0,0,0,0,0}; 01092 char nombre[20]; 01093 bool flag1 = false; 01094 int start_index = 0, end_index = 0; 01095 01096 //chaine[t]=ESP.getc(); 01097 for (int i=0; i<sizeof(texte); i++) 01098 { 01099 if(texte[i] == '*'){ 01100 flag1 = true; 01101 start_index = i+1; 01102 break; 01103 } 01104 } 01105 01106 for(int i=start_index; i<sizeof(texte); i++){ 01107 if(texte[i] == '*' && flag1 == true){ 01108 end_index = i; 01109 } 01110 } 01111 01112 for(int i=start_index; i<end_index; i++){ 01113 nombre[i-start_index] = texte[i]; 01114 } 01115 01116 lc1[1]=atoi(nombre);*/ 01117 01118 }
Generated on Tue Jul 12 2022 18:44:03 by
