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: mbed BSP_DISCO_F746NG
fonctions.cpp
- Committer:
- valentin__
- Date:
- 2020-11-11
- Revision:
- 4:8f6e0ef3fffe
- Parent:
- 3:92661d767dd1
- Child:
- 5:50ae659e47c1
File content as of revision 4:8f6e0ef3fffe:
#include "fonctions.h"
void Affiche_Ingredients(int TAB_ingredients[]){
int i=0;
BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
for(i=0; i<3; i++){
char Text[1];
sprintf((char*)&Text, "%d", TAB_ingredients[i]);
BSP_LCD_DisplayStringAt(162*i,37, (uint8_t *)&Text, LEFT_MODE);
}
for(i=3; i<6; i++){
char Text2[1];
sprintf((char*)&Text2, "%d", TAB_ingredients[i]);
BSP_LCD_DisplayStringAt(162*i,149,(uint8_t *)&Text2, LEFT_MODE);
}
}
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){
uint8_t i=0;
uint8_t j=0;
for (i=0; i<=Hauteur; i++){
for (j=0; j<= Largeur; j++){
BSP_LCD_DrawPixel(Xpos + j, Ypos + i, img[j + i*Largeur] + 0xFF000000); //j + i*Largeur
}
}
}
void Page_Recette()
{
BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Recettes", CENTER_MODE);
}
void Page_Ingredients()
{
AfficheImage(0,0,160,90,image1);
AfficheImage(160,0,160,90,image2);
AfficheImage(320,0,160,90,image3);
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)
{
if(NumeroPage==0){
Page_Ingredients();
}
else if(NumeroPage == 1){
Page_Recette();
}
}
void PageErreur(){
BSP_LCD_Clear(LCD_COLOR_BLUE);
BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"ERREUR", CENTER_MODE);
}