
Fin de projet
Dependencies: mbed BSP_DISCO_F746NG
Diff: main.cpp
- Revision:
- 5:50ae659e47c1
- Parent:
- 4:8f6e0ef3fffe
--- a/main.cpp Wed Nov 11 15:27:24 2020 +0000 +++ b/main.cpp Sun Nov 15 16:17:43 2020 +0000 @@ -5,20 +5,22 @@ uint16_t x=0; uint16_t y=0; - uint16_t temps = 100; + uint16_t temps = 50; int NumeroPage = 0; - - int TAB_ingredients[6]={0,0,0,0,0,0};//Dans l'ordre : Pates, oeufs, tomate, lardon, steak, creme; - + + int TAB_ingredients[6]= {0,0,0,0,0,0}; //Dans l'ordre : Pates, oeufs, tomate, lardon, steak, creme; + BSP_LCD_Init(); //Initialisation LCD BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); BSP_LCD_Clear(LCD_COLOR_WHITE); - + TS_StateTypeDef TS_State; BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); // Initialisation de la fonction tactile - AfficherPage(0); + Page_Acceuil(); + BSP_LCD_SetBackColor(LCD_COLOR_WHITE); + AfficherPage(0,TAB_ingredients); while (1) { @@ -28,45 +30,50 @@ x = TS_State.touchX[0]; y = TS_State.touchY[0]; - - if (( Bouton(160,0,80,33,x,y) == true ) && ( NumeroPage == 0 )) { //Validation - NumeroPage =1; - BSP_LCD_Clear(LCD_COLOR_WHITE); - AfficherPage(NumeroPage); - } - else if (( Bouton(240,0,80,33,x,y)== true ) && ( NumeroPage== 0 )) {//Annulation - TAB_ingredients[0]=TAB_ingredients[1]=TAB_ingredients[2]=TAB_ingredients[3]=TAB_ingredients[4]=TAB_ingredients[5]=0; - BSP_LCD_Clear(LCD_COLOR_WHITE); - AfficherPage(NumeroPage); - } - else if (( Bouton(0,33,160,90,x,y)== true ) && ( NumeroPage== 0 )) {//Pates - TAB_ingredients[0]+=1; - } - else if (( Bouton(160,33,160,90,x,y)== true ) && ( NumeroPage== 0 )) {//Oeufs - TAB_ingredients[1]+=1; - } - else if (( Bouton(320,33,160,90,x,y)== true ) && ( NumeroPage== 0 )) {//Tomates - TAB_ingredients[2]+=1; - } - else if (( Bouton(0,123,160,90,x,y)== true ) && ( NumeroPage== 0 )) {//Lardons - TAB_ingredients[3]+=1; - } - else if (( Bouton(160,123,160,90,x,y)== true ) && ( NumeroPage== 0 )) {//Steak - TAB_ingredients[4]+=1; - } - else if (( Bouton(320,123,160,90,x,y)== true ) && ( NumeroPage== 0 )) {//creme - TAB_ingredients[5]+=1; + if (NumeroPage == 0) { + + if (Bouton(160,0,80,33,x,y) == true) { //Validation + NumeroPage =1; + BSP_LCD_Clear(LCD_COLOR_WHITE); + AfficherPage(NumeroPage, TAB_ingredients); + } else if (Bouton(240,0,80,33,x,y)== true ) { //Annulation + TAB_ingredients[0]=TAB_ingredients[1]=TAB_ingredients[2]=TAB_ingredients[3]=TAB_ingredients[4]=TAB_ingredients[5]=0; + BSP_LCD_Clear(LCD_COLOR_WHITE); + AfficherPage(NumeroPage, TAB_ingredients); + } else if (Bouton(0,33,160,90,x,y)== true) { //Pates + TAB_ingredients[0]+=1; + Affiche_Ingredients(TAB_ingredients); + } else if ( Bouton(160,33,160,90,x,y)== true) { //Oeufs + TAB_ingredients[1]+=1; + Affiche_Ingredients(TAB_ingredients); + } else if ( Bouton(320,33,160,90,x,y)== true ) { //Tomates + TAB_ingredients[2]+=1; + Affiche_Ingredients(TAB_ingredients); + } else if (Bouton(0,123,160,90,x,y)== true) { //Lardons + TAB_ingredients[3]+=1; + Affiche_Ingredients(TAB_ingredients); + } else if (Bouton(160,123,160,90,x,y)== true) { //Steak + TAB_ingredients[4]+=1; + Affiche_Ingredients(TAB_ingredients); + } else if ( Bouton(320,123,160,90,x,y)== true ) { //creme + TAB_ingredients[5]+=1; + Affiche_Ingredients(TAB_ingredients); } - - if(NumeroPage == 0){ //Affichage du tableau ingredients - Affiche_Ingredients(TAB_ingredients); - } - HAL_Delay(temps); - TS_State.touchEventId [0] = 0; - TS_State.touchEventId [1] = 0; - + } else if (NumeroPage == 1) { + if (Bouton(160,0,160,31,x,y) == true) { //Validation + NumeroPage=0; + BSP_LCD_Clear(LCD_COLOR_WHITE); + AfficherPage(NumeroPage, TAB_ingredients); + Affiche_Ingredients(TAB_ingredients); + } + } + + HAL_Delay(temps); + TS_State.touchEventId [0] = 0; + TS_State.touchEventId [1] = 0; + } - + } }