Dossier partage

Dependencies:   mbed BSP_DISCO_F746NG

Committer:
mylene
Date:
Wed Oct 21 14:53:21 2020 +0000
Revision:
11:0fac3f2241c1
m;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mylene 11:0fac3f2241c1 1 #include "mbed.h"
mylene 11:0fac3f2241c1 2 #include "stm32746g_discovery_lcd.h"
mylene 11:0fac3f2241c1 3 #include "stm32746g_discovery_ts.h"
mylene 11:0fac3f2241c1 4 #include "fonctions.h"
mylene 11:0fac3f2241c1 5
mylene 11:0fac3f2241c1 6 void Page1()
mylene 11:0fac3f2241c1 7 {
mylene 11:0fac3f2241c1 8 BSP_LCD_Init(); //initialise l'écran LCD
mylene 11:0fac3f2241c1 9 BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
mylene 11:0fac3f2241c1 10 BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
mylene 11:0fac3f2241c1 11
mylene 11:0fac3f2241c1 12 BSP_LCD_Clear(LCD_COLOR_BLACK); //reset l'écran en fond noir
mylene 11:0fac3f2241c1 13 BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
mylene 11:0fac3f2241c1 14 BSP_LCD_SetBackColor(LCD_COLOR_BLACK);//fond de l'écriture en noir
mylene 11:0fac3f2241c1 15 BSP_LCD_SetTextColor(LCD_COLOR_ORANGE); //couleur de l'écriture
mylene 11:0fac3f2241c1 16 BSP_LCD_DisplayStringAt(0, 135, (uint8_t *)"BIENVENUE", CENTER_MODE); //affichage de BIENVENUE
mylene 11:0fac3f2241c1 17
mylene 11:0fac3f2241c1 18 BSP_LCD_Clear(LCD_COLOR_BLACK);
mylene 11:0fac3f2241c1 19 BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
mylene 11:0fac3f2241c1 20 BSP_LCD_FillRect(4, 4, 138, 129);
mylene 11:0fac3f2241c1 21 BSP_LCD_SetTextColor(LCD_COLOR_BROWN);
mylene 11:0fac3f2241c1 22 BSP_LCD_FillRect(146, 4, 138, 129);
mylene 11:0fac3f2241c1 23 BSP_LCD_SetTextColor(LCD_COLOR_YELLOW);
mylene 11:0fac3f2241c1 24 BSP_LCD_FillRect(288, 4, 138, 129);
mylene 11:0fac3f2241c1 25 BSP_LCD_SetTextColor(LCD_COLOR_RED);
mylene 11:0fac3f2241c1 26 BSP_LCD_FillRect(4, 137, 138, 129);
mylene 11:0fac3f2241c1 27 BSP_LCD_SetTextColor(LCD_COLOR_ORANGE);
mylene 11:0fac3f2241c1 28 BSP_LCD_FillRect(146, 137, 138, 129);
mylene 11:0fac3f2241c1 29 BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
mylene 11:0fac3f2241c1 30 BSP_LCD_FillRect(288, 137, 138, 129);
mylene 11:0fac3f2241c1 31
mylene 11:0fac3f2241c1 32 BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
mylene 11:0fac3f2241c1 33 BSP_LCD_FillRect(435, 5, 45, 50);
mylene 11:0fac3f2241c1 34 BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
mylene 11:0fac3f2241c1 35 BSP_LCD_FillRect(435, 65, 45, 65);
mylene 11:0fac3f2241c1 36 BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
mylene 11:0fac3f2241c1 37 BSP_LCD_FillRect(435, 137, 45, 65);
mylene 11:0fac3f2241c1 38 BSP_LCD_SetTextColor(LCD_COLOR_BROWN);
mylene 11:0fac3f2241c1 39 BSP_LCD_FillRect(435, 215, 45, 50);
mylene 11:0fac3f2241c1 40 }
mylene 11:0fac3f2241c1 41
mylene 11:0fac3f2241c1 42
mylene 11:0fac3f2241c1 43 void Page2()
mylene 11:0fac3f2241c1 44 {
mylene 11:0fac3f2241c1 45 BSP_LCD_Clear(LCD_COLOR_ORANGE);
mylene 11:0fac3f2241c1 46 BSP_LCD_SetBackColor(LCD_COLOR_GREEN);
mylene 11:0fac3f2241c1 47 BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
mylene 11:0fac3f2241c1 48 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Page2", CENTER_MODE);
mylene 11:0fac3f2241c1 49
mylene 11:0fac3f2241c1 50 }
mylene 11:0fac3f2241c1 51
mylene 11:0fac3f2241c1 52 void Bienvenue()
mylene 11:0fac3f2241c1 53 {
mylene 11:0fac3f2241c1 54 BSP_LCD_Clear(LCD_COLOR_WHITE);
mylene 11:0fac3f2241c1 55 BSP_LCD_Clear(LCD_COLOR_WHITE);
mylene 11:0fac3f2241c1 56 BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
mylene 11:0fac3f2241c1 57 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Bienvenue", CENTER_MODE);
mylene 11:0fac3f2241c1 58 }
mylene 11:0fac3f2241c1 59
mylene 11:0fac3f2241c1 60 void AfficherPage(int NumeroPage)
mylene 11:0fac3f2241c1 61 {
mylene 11:0fac3f2241c1 62
mylene 11:0fac3f2241c1 63 switch(NumeroPage) {
mylene 11:0fac3f2241c1 64 case 0 :
mylene 11:0fac3f2241c1 65 Bienvenue();
mylene 11:0fac3f2241c1 66
mylene 11:0fac3f2241c1 67 break;
mylene 11:0fac3f2241c1 68 case 1 :
mylene 11:0fac3f2241c1 69 Page1();
mylene 11:0fac3f2241c1 70
mylene 11:0fac3f2241c1 71 break;
mylene 11:0fac3f2241c1 72 case 2 :
mylene 11:0fac3f2241c1 73 Page2();
mylene 11:0fac3f2241c1 74 printf("Affichage page %d\n", NumeroPage);
mylene 11:0fac3f2241c1 75
mylene 11:0fac3f2241c1 76 break;
mylene 11:0fac3f2241c1 77
mylene 11:0fac3f2241c1 78 //case 4 :
mylene 11:0fac3f2241c1 79 // printf("Affichage page %d\n", NumeroPage);
mylene 11:0fac3f2241c1 80 // break;
mylene 11:0fac3f2241c1 81 default :
mylene 11:0fac3f2241c1 82 PageErreur();
mylene 11:0fac3f2241c1 83 printf("erreur appel AfficherPage %d", NumeroPage);
mylene 11:0fac3f2241c1 84
mylene 11:0fac3f2241c1 85 }
mylene 11:0fac3f2241c1 86 }
mylene 11:0fac3f2241c1 87
mylene 11:0fac3f2241c1 88 void PageErreur(){
mylene 11:0fac3f2241c1 89 BSP_LCD_Clear(LCD_COLOR_BLUE);
mylene 11:0fac3f2241c1 90 BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
mylene 11:0fac3f2241c1 91 BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
mylene 11:0fac3f2241c1 92 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"ERREUR", CENTER_MODE);
mylene 11:0fac3f2241c1 93 }
mylene 11:0fac3f2241c1 94
mylene 11:0fac3f2241c1 95
mylene 11:0fac3f2241c1 96
mylene 11:0fac3f2241c1 97