
X
Dependencies: mbed BSP_DISCO_F746NG
Diff: fonctions.cpp
- Revision:
- 3:92661d767dd1
- Parent:
- 2:3070bad3789b
- Child:
- 4:8f6e0ef3fffe
--- a/fonctions.cpp Wed Nov 04 14:42:33 2020 +0000 +++ b/fonctions.cpp Sun Nov 08 18:33:37 2020 +0000 @@ -1,8 +1,12 @@ -#include "mbed.h" -#include "stm32746g_discovery_lcd.h" -#include "stm32746g_discovery_ts.h" #include "fonctions.h" -#include "image.h" + +bool Bouton(uint16_t Xpos, uint16_t Ypos, uint16_t Xdim, uint16_t Ydim,uint16_t x,uint16_t y){ + if((x >= Xpos) && (x<= Xpos+Xdim ) && (y <= Ypos + Ydim) && (y>= Ypos )){ + return true; + } + return false; + } + void AfficheImage(uint32_t Xpos, uint32_t Ypos, uint32_t Largeur, uint32_t Hauteur, const unsigned long *img){ @@ -24,56 +28,38 @@ BSP_LCD_Clear(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); - BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Page1", CENTER_MODE); + BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Recettes", CENTER_MODE); } -void Page2() -{ - BSP_LCD_Clear(LCD_COLOR_ORANGE); - BSP_LCD_SetBackColor(LCD_COLOR_GREEN); - BSP_LCD_SetTextColor(LCD_COLOR_BLACK); - BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Page2", CENTER_MODE); -} -void Bienvenue() +void Ingredients() { - BSP_LCD_Clear(LCD_COLOR_WHITE); - BSP_LCD_Clear(LCD_COLOR_WHITE); - BSP_LCD_SetTextColor(LCD_COLOR_BLACK); - BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Bienvenue", CENTER_MODE); + AfficheImage(0,0,160,90,image1); + AfficheImage(160,0,160,90,image2); + AfficheImage(320,0,160,90,image3); - AfficheImage(10, 10, 200, 124, image); + AfficheImage(0,90,160,90,image4); + AfficheImage(160,90,160,90,image5); + AfficheImage(320,90,160,90,image6); + + AfficheImage(0,180,160,90,image7); + AfficheImage(160,180,160,90,image8); + AfficheImage(320,180,160,90,image9); + } void AfficherPage(int NumeroPage) { - switch(NumeroPage) { - case 0 : - Bienvenue(); - - break; - case 1 : - Page1(); - - break; - case 2 : - Page2(); - printf("Affichage page %d\n", NumeroPage); - - break; - - //case 4 : - // printf("Affichage page %d\n", NumeroPage); - // break; - default : - PageErreur(); - printf("erreur appel AfficherPage %d", NumeroPage); - - } + if(NumeroPage==0){ + Ingredients(); + } + else if(NumeroPage == 1){ + Page1(); + } } void PageErreur(){