Basic example showing how to drive the LCD.

Dependencies:   BSP_DISCO_F746NG

Committer:
Jerome Coutant
Date:
Wed Nov 20 11:33:58 2019 +0100
Revision:
5:e8f8a8037256
Parent:
0:b045ca817e2c
Update with STM32Cube_FW_F7_V1.15.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:b045ca817e2c 1 #include "mbed.h"
Jerome Coutant 5:e8f8a8037256 2 #include "stm32746g_discovery_lcd.h"
bcostm 0:b045ca817e2c 3
bcostm 0:b045ca817e2c 4 int main()
Jerome Coutant 5:e8f8a8037256 5 {
Jerome Coutant 5:e8f8a8037256 6 BSP_LCD_Init();
Jerome Coutant 5:e8f8a8037256 7 BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
Jerome Coutant 5:e8f8a8037256 8 BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
bcostm 0:b045ca817e2c 9
Jerome Coutant 5:e8f8a8037256 10 while (1) {
Jerome Coutant 5:e8f8a8037256 11 BSP_LCD_Clear(LCD_COLOR_BLACK);
Jerome Coutant 5:e8f8a8037256 12 BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
Jerome Coutant 5:e8f8a8037256 13 BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
Jerome Coutant 5:e8f8a8037256 14 BSP_LCD_SetTextColor(LCD_COLOR_DARKBLUE);
Jerome Coutant 5:e8f8a8037256 15
Jerome Coutant 5:e8f8a8037256 16 BSP_LCD_DisplayStringAt(0, 1, (uint8_t *)"MBED EXAMPLE", CENTER_MODE);
Jerome Coutant 5:e8f8a8037256 17 HAL_Delay(2000);
bcostm 0:b045ca817e2c 18
Jerome Coutant 5:e8f8a8037256 19 BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
Jerome Coutant 5:e8f8a8037256 20 BSP_LCD_SetTextColor(LCD_COLOR_ORANGE);
Jerome Coutant 5:e8f8a8037256 21 BSP_LCD_DisplayStringAt(0, 100, (uint8_t *)"DISCOVERY STM32F746NG", CENTER_MODE);
Jerome Coutant 5:e8f8a8037256 22 HAL_Delay(2000);
bcostm 0:b045ca817e2c 23
Jerome Coutant 5:e8f8a8037256 24 BSP_LCD_Clear(LCD_COLOR_GREEN);
Jerome Coutant 5:e8f8a8037256 25 BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
Jerome Coutant 5:e8f8a8037256 26 BSP_LCD_DrawRect(10, 20, 50, 50);
Jerome Coutant 5:e8f8a8037256 27 BSP_LCD_SetTextColor(LCD_COLOR_BROWN);
Jerome Coutant 5:e8f8a8037256 28 BSP_LCD_DrawCircle(80, 80, 50);
Jerome Coutant 5:e8f8a8037256 29 BSP_LCD_SetTextColor(LCD_COLOR_YELLOW);
Jerome Coutant 5:e8f8a8037256 30 BSP_LCD_DrawEllipse(150, 150, 50, 100);
Jerome Coutant 5:e8f8a8037256 31 BSP_LCD_SetTextColor(LCD_COLOR_RED);
Jerome Coutant 5:e8f8a8037256 32 BSP_LCD_FillCircle(200, 200, 40);
Jerome Coutant 5:e8f8a8037256 33 HAL_Delay(2000);
bcostm 0:b045ca817e2c 34
Jerome Coutant 5:e8f8a8037256 35 BSP_LCD_SetBackColor(LCD_COLOR_GREEN);
Jerome Coutant 5:e8f8a8037256 36 BSP_LCD_SetTextColor(LCD_COLOR_CYAN);
Jerome Coutant 5:e8f8a8037256 37 BSP_LCD_DisplayStringAt(0, 6, (uint8_t *)"HAVE FUN !!!", RIGHT_MODE);
Jerome Coutant 5:e8f8a8037256 38 HAL_Delay(2000);
bcostm 0:b045ca817e2c 39 }
bcostm 0:b045ca817e2c 40 }