Code projet_gestion_de_commande_en_ligne
Dependencies: TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG BUTTON_GROUP
Diff: main.cpp
- Revision:
- 1:7e34491bfd01
- Parent:
- 0:735dae6ecacf
- Child:
- 2:e007f6b6e145
--- a/main.cpp Thu Jun 18 14:45:26 2020 +0000 +++ b/main.cpp Fri Jun 19 14:12:12 2020 +0000 @@ -2,6 +2,18 @@ #include "stm32746g_discovery_lcd.h" #include "stm32746g_discovery_ts.h" #include "button_group.hpp" +#include "pomme.h" +#include "poire.h" +#include "orange.h" +#include "banane.h" +#include "tomate.h" +#include "fraise.h" +#include "raisin.h" +#include "kiwi.h" +#include "haricot.h" + + + Serial pc(USBTX, USBRX); // tx, rx @@ -9,6 +21,189 @@ TS_DISCO_F746NG ts_; LCD_DISCO_F746NG lcd_; + +//Pomme +void drawImage_pomme(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)pomme.data; + while(y < pomme.height) + { + while(x < pomme.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + + +//Poire +void drawImage_poire(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)poire.data; + while(y < poire.height) + { + while(x < poire.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Orange +void drawImage_orange(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)orange.data; + while(y < orange.height) + { + while(x < orange.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Banane +void drawImage_banane(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)banane.data; + while(y < banane.height) + { + while(x < banane.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Tomate +void drawImage_tomate(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)tomate.data; + while(y < tomate.height) + { + while(x < tomate.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Fraise +void drawImage_fraise(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)fraise.data; + while(y < fraise.height) + { + while(x < fraise.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Raisin +void drawImage_raisin(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)raisin.data; + while(y < raisin.height) + { + while(x < raisin.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Kiwi +void drawImage_kiwi(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)kiwi.data; + while(y < kiwi.height) + { + while(x < kiwi.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + +//Haricot +void drawImage_haricot(int offsetX, int offsetY) +{ + int x = 0; + int y = 0; + uint32_t* dataPtr = (uint32_t*)haricot.data; + while(y < haricot.height) + { + while(x < haricot.width) + { + BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); + dataPtr++; + x++; + } + x = 0; + y++; + } +} + + + + + + + + + + + int main() { unsigned int boutton_commande = 0; @@ -23,8 +218,8 @@ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); while(1) - { - //Ecran d'acceuil + { + //Ecran d'acceuil BSP_LCD_Clear(LCD_COLOR_WHITE); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); BSP_LCD_SetBackColor(LCD_COLOR_ORANGE); @@ -53,6 +248,16 @@ BSP_LCD_Clear(LCD_COLOR_WHITE); HAL_Delay(1000); + drawImage_pomme (0,70) ; + drawImage_poire (0,130) ; + drawImage_orange (0,200) ; + drawImage_banane (155,65) ; + drawImage_tomate (155,130) ; + drawImage_fraise (155,200) ; + drawImage_raisin (310,65) ; + drawImage_kiwi (317,138) ; + drawImage_haricot (310,200) ; + //Bouton retour Button retour(lcd_, ts_, 10, 5, 60, 40, LCD_COLOR_BLUE, LCD_COLOR_BLACK, "Retour", Font12);