Unmodifed demo code

Dependencies:   BSP_DISCO_F769NI

Committer:
Jerome Coutant
Date:
Fri Nov 15 15:08:32 2019 +0100
Revision:
3:45a625d2dcc4
Parent:
0:db5cf2d28be1
Update with STM32Cube_FW_F7_V1.15.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jeromecoutant 0:db5cf2d28be1 1 #include "mbed.h"
Jerome Coutant 3:45a625d2dcc4 2 #include "stm32f769i_discovery_lcd.h"
Jerome Coutant 3:45a625d2dcc4 3 #include "stlogo.h"
Jerome Coutant 3:45a625d2dcc4 4
Jerome Coutant 3:45a625d2dcc4 5 uint32_t Xsize = 0;
Jerome Coutant 3:45a625d2dcc4 6 uint32_t Ysize = 0;
Jerome Coutant 3:45a625d2dcc4 7
Jerome Coutant 3:45a625d2dcc4 8 /**
Jerome Coutant 3:45a625d2dcc4 9 * @brief Show LCD Features
Jerome Coutant 3:45a625d2dcc4 10 * @param feature : feature index
Jerome Coutant 3:45a625d2dcc4 11 * @retval None
Jerome Coutant 3:45a625d2dcc4 12 */
Jerome Coutant 3:45a625d2dcc4 13 static void LCD_Show_Feature(uint8_t feature)
Jerome Coutant 3:45a625d2dcc4 14 {
Jerome Coutant 3:45a625d2dcc4 15 Point Points[] = {{20, 150}, {80, 150}, {80, 200}};
Jerome Coutant 3:45a625d2dcc4 16 Point Points2[3];
Jerome Coutant 3:45a625d2dcc4 17
Jerome Coutant 3:45a625d2dcc4 18 Points2[0].X = Xsize - 80;
Jerome Coutant 3:45a625d2dcc4 19 Points2[0].Y = 150;
Jerome Coutant 3:45a625d2dcc4 20 Points2[1].X = Xsize - 20;
Jerome Coutant 3:45a625d2dcc4 21 Points2[1].Y = 150;
Jerome Coutant 3:45a625d2dcc4 22 Points2[2].X = Xsize - 20;
Jerome Coutant 3:45a625d2dcc4 23 Points2[2].Y = 200;
Jerome Coutant 3:45a625d2dcc4 24
Jerome Coutant 3:45a625d2dcc4 25 BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
Jerome Coutant 3:45a625d2dcc4 26 BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
Jerome Coutant 3:45a625d2dcc4 27 BSP_LCD_FillRect(12, 92, Xsize - 24, Ysize - 104);
Jerome Coutant 3:45a625d2dcc4 28 BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
Jerome Coutant 3:45a625d2dcc4 29
Jerome Coutant 3:45a625d2dcc4 30 switch (feature) {
Jerome Coutant 3:45a625d2dcc4 31 case 0:
Jerome Coutant 3:45a625d2dcc4 32 /* Text Feature */
Jerome Coutant 3:45a625d2dcc4 33
Jerome Coutant 3:45a625d2dcc4 34 BSP_LCD_DisplayStringAt(14, 100, (uint8_t *)"Left aligned Text", LEFT_MODE);
Jerome Coutant 3:45a625d2dcc4 35 BSP_LCD_DisplayStringAt(0, 115, (uint8_t *)"Center aligned Text", CENTER_MODE);
Jerome Coutant 3:45a625d2dcc4 36 BSP_LCD_DisplayStringAt(14, 130, (uint8_t *)"Right aligned Text", RIGHT_MODE);
Jerome Coutant 3:45a625d2dcc4 37 BSP_LCD_SetFont(&Font24);
Jerome Coutant 3:45a625d2dcc4 38 BSP_LCD_DisplayStringAt(14, 180, (uint8_t *)"Font24", LEFT_MODE);
Jerome Coutant 3:45a625d2dcc4 39 BSP_LCD_SetFont(&Font20);
Jerome Coutant 3:45a625d2dcc4 40 BSP_LCD_DisplayStringAt(Xsize / 2 - 20, 180, (uint8_t *)"Font20", LEFT_MODE);
Jerome Coutant 3:45a625d2dcc4 41 BSP_LCD_SetFont(&Font16);
Jerome Coutant 3:45a625d2dcc4 42 BSP_LCD_DisplayStringAt(Xsize - 80, 184, (uint8_t *)"Font16", LEFT_MODE);
Jerome Coutant 3:45a625d2dcc4 43 break;
Jerome Coutant 3:45a625d2dcc4 44
Jerome Coutant 3:45a625d2dcc4 45 case 1:
jeromecoutant 0:db5cf2d28be1 46
Jerome Coutant 3:45a625d2dcc4 47 /* Draw misc. Shapes */
Jerome Coutant 3:45a625d2dcc4 48 BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
Jerome Coutant 3:45a625d2dcc4 49 BSP_LCD_DrawRect(20, 100, 60, 40);
Jerome Coutant 3:45a625d2dcc4 50 BSP_LCD_FillRect(100, 100, 60, 40);
Jerome Coutant 3:45a625d2dcc4 51
Jerome Coutant 3:45a625d2dcc4 52 BSP_LCD_SetTextColor(LCD_COLOR_GRAY);
Jerome Coutant 3:45a625d2dcc4 53 BSP_LCD_DrawCircle(Xsize - 120, 120, 20);
Jerome Coutant 3:45a625d2dcc4 54 BSP_LCD_FillCircle(Xsize - 40, 120, 20);
Jerome Coutant 3:45a625d2dcc4 55
Jerome Coutant 3:45a625d2dcc4 56 BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
Jerome Coutant 3:45a625d2dcc4 57 BSP_LCD_DrawPolygon(Points, 3);
Jerome Coutant 3:45a625d2dcc4 58
Jerome Coutant 3:45a625d2dcc4 59 BSP_LCD_SetTextColor(LCD_COLOR_RED);
Jerome Coutant 3:45a625d2dcc4 60 BSP_LCD_DrawEllipse(130, 170, 30, 20);
Jerome Coutant 3:45a625d2dcc4 61 BSP_LCD_FillEllipse(200, 170, 30, 20);
Jerome Coutant 3:45a625d2dcc4 62
Jerome Coutant 3:45a625d2dcc4 63 BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
Jerome Coutant 3:45a625d2dcc4 64 BSP_LCD_DrawHLine(20, Ysize - 30, Xsize / 5);
Jerome Coutant 3:45a625d2dcc4 65 BSP_LCD_DrawLine(100, Ysize - 20, 230, Ysize - 50);
Jerome Coutant 3:45a625d2dcc4 66 BSP_LCD_DrawLine(100, Ysize - 50, 230, Ysize - 20);
Jerome Coutant 3:45a625d2dcc4 67
Jerome Coutant 3:45a625d2dcc4 68 BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
Jerome Coutant 3:45a625d2dcc4 69 BSP_LCD_FillPolygon(Points2, 3);
Jerome Coutant 3:45a625d2dcc4 70 break;
Jerome Coutant 3:45a625d2dcc4 71
Jerome Coutant 3:45a625d2dcc4 72 case 2:
Jerome Coutant 3:45a625d2dcc4 73 /* Draw Bitmap */
Jerome Coutant 3:45a625d2dcc4 74 BSP_LCD_DrawBitmap(20, 100, (uint8_t *)stlogo);
Jerome Coutant 3:45a625d2dcc4 75 HAL_Delay(500);
Jerome Coutant 3:45a625d2dcc4 76
Jerome Coutant 3:45a625d2dcc4 77 BSP_LCD_DrawBitmap(Xsize / 2 - 40, 100, (uint8_t *)stlogo);
Jerome Coutant 3:45a625d2dcc4 78 HAL_Delay(500);
Jerome Coutant 3:45a625d2dcc4 79
Jerome Coutant 3:45a625d2dcc4 80 BSP_LCD_DrawBitmap(Xsize - 100, 100, (uint8_t *)stlogo);
Jerome Coutant 3:45a625d2dcc4 81 HAL_Delay(500);
Jerome Coutant 3:45a625d2dcc4 82
Jerome Coutant 3:45a625d2dcc4 83 BSP_LCD_DrawBitmap(20, Ysize - 80, (uint8_t *)stlogo);
Jerome Coutant 3:45a625d2dcc4 84 HAL_Delay(500);
Jerome Coutant 3:45a625d2dcc4 85
Jerome Coutant 3:45a625d2dcc4 86 BSP_LCD_DrawBitmap(Xsize / 2 - 40, Ysize - 80, (uint8_t *)stlogo);
Jerome Coutant 3:45a625d2dcc4 87 HAL_Delay(500);
Jerome Coutant 3:45a625d2dcc4 88
Jerome Coutant 3:45a625d2dcc4 89 BSP_LCD_DrawBitmap(Xsize - 100, Ysize - 80, (uint8_t *)stlogo);
Jerome Coutant 3:45a625d2dcc4 90 HAL_Delay(500);
Jerome Coutant 3:45a625d2dcc4 91 break;
Jerome Coutant 3:45a625d2dcc4 92 }
Jerome Coutant 3:45a625d2dcc4 93 }
Jerome Coutant 3:45a625d2dcc4 94
jeromecoutant 0:db5cf2d28be1 95
jeromecoutant 0:db5cf2d28be1 96 int main()
jeromecoutant 0:db5cf2d28be1 97 {
Jerome Coutant 3:45a625d2dcc4 98 uint8_t LCD_Feature = 0;
Jerome Coutant 3:45a625d2dcc4 99
Jerome Coutant 3:45a625d2dcc4 100 BSP_LCD_Init();
Jerome Coutant 3:45a625d2dcc4 101 // BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT);
Jerome Coutant 3:45a625d2dcc4 102 BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
Jerome Coutant 3:45a625d2dcc4 103 BSP_LCD_SelectLayer(0);
Jerome Coutant 3:45a625d2dcc4 104
Jerome Coutant 3:45a625d2dcc4 105 Xsize = BSP_LCD_GetXSize();
Jerome Coutant 3:45a625d2dcc4 106 Ysize = BSP_LCD_GetYSize();
jeromecoutant 0:db5cf2d28be1 107
Jerome Coutant 3:45a625d2dcc4 108 BSP_LCD_Clear(LCD_COLOR_WHITE);
Jerome Coutant 3:45a625d2dcc4 109 BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
Jerome Coutant 3:45a625d2dcc4 110 BSP_LCD_FillRect(0, 0, Xsize, 80);
Jerome Coutant 3:45a625d2dcc4 111 BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
Jerome Coutant 3:45a625d2dcc4 112 BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
Jerome Coutant 3:45a625d2dcc4 113 BSP_LCD_SetFont(&Font24);
Jerome Coutant 3:45a625d2dcc4 114 BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"MBED LCD EXAMPLE", CENTER_MODE);
Jerome Coutant 3:45a625d2dcc4 115 BSP_LCD_SetFont(&Font12);
Jerome Coutant 3:45a625d2dcc4 116 BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"DISCOVERY STM32F769NI", CENTER_MODE);
jeromecoutant 0:db5cf2d28be1 117
Jerome Coutant 3:45a625d2dcc4 118 BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
Jerome Coutant 3:45a625d2dcc4 119 BSP_LCD_DrawRect(10, 90, Xsize - 20, Ysize - 100);
Jerome Coutant 3:45a625d2dcc4 120 BSP_LCD_DrawRect(11, 91, Xsize - 22, Ysize - 102);
Jerome Coutant 3:45a625d2dcc4 121
Jerome Coutant 3:45a625d2dcc4 122 HAL_Delay(1000);
jeromecoutant 0:db5cf2d28be1 123
Jerome Coutant 3:45a625d2dcc4 124 while (1) {
Jerome Coutant 3:45a625d2dcc4 125 LCD_Show_Feature(LCD_Feature);
Jerome Coutant 3:45a625d2dcc4 126 HAL_Delay(3000);
Jerome Coutant 3:45a625d2dcc4 127
Jerome Coutant 3:45a625d2dcc4 128 LCD_Feature++;
Jerome Coutant 3:45a625d2dcc4 129 if (LCD_Feature == 3) {
Jerome Coutant 3:45a625d2dcc4 130 LCD_Feature = 0;
Jerome Coutant 3:45a625d2dcc4 131 }
jeromecoutant 0:db5cf2d28be1 132 }
jeromecoutant 0:db5cf2d28be1 133 }