Basic example showing how to drive the LCD.

Dependencies:   BSP_DISCO_F746NG

Files at this revision

API Documentation at this revision

Comitter:
Jerome Coutant
Date:
Wed Nov 20 11:33:58 2019 +0100
Parent:
4:abedada304bf
Commit message:
Update with STM32Cube_FW_F7_V1.15.0

Changed in this revision

.hgignore Show annotated file Show diff for this revision Revisions of this file
BSP_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
LCD_DISCO_F746NG.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
diff -r abedada304bf -r e8f8a8037256 .hgignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Wed Nov 20 11:33:58 2019 +0100
@@ -0,0 +1,2 @@
+BUILD
+mbed-os/
diff -r abedada304bf -r e8f8a8037256 BSP_DISCO_F746NG.lib
--- a/BSP_DISCO_F746NG.lib	Thu Jun 08 13:47:01 2017 +0000
+++ b/BSP_DISCO_F746NG.lib	Wed Nov 20 11:33:58 2019 +0100
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#56384bddaba5
+https://mbed.org/teams/ST/code/BSP_DISCO_F746NG/#1050c589b2ad
diff -r abedada304bf -r e8f8a8037256 LCD_DISCO_F746NG.lib
--- a/LCD_DISCO_F746NG.lib	Thu Jun 08 13:47:01 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/ST/code/LCD_DISCO_F746NG/#d44525b1de98
diff -r abedada304bf -r e8f8a8037256 main.cpp
--- a/main.cpp	Thu Jun 08 13:47:01 2017 +0000
+++ b/main.cpp	Wed Nov 20 11:33:58 2019 +0100
@@ -1,46 +1,40 @@
 #include "mbed.h"
-#include "LCD_DISCO_F746NG.h"
-
-LCD_DISCO_F746NG lcd;
-
-DigitalOut led1(LED1);
+#include "stm32746g_discovery_lcd.h"
 
 int main()
-{  
-    led1 = 1;
+{
+    BSP_LCD_Init();
+    BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
+    BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
 
-    lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE);
-    wait(1);
-  
-    while(1)
-    {
-      lcd.Clear(LCD_COLOR_BLUE);
-      lcd.SetBackColor(LCD_COLOR_BLUE);
-      lcd.SetTextColor(LCD_COLOR_WHITE);
-      wait(0.3);
-      lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"DISCOVERY STM32F746NG", CENTER_MODE);
-      wait(1);
+    while (1) {
+        BSP_LCD_Clear(LCD_COLOR_BLACK);
+        BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
+        BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
+        BSP_LCD_SetTextColor(LCD_COLOR_DARKBLUE);
+
+        BSP_LCD_DisplayStringAt(0, 1, (uint8_t *)"MBED EXAMPLE", CENTER_MODE);
+        HAL_Delay(2000);
 
-      lcd.Clear(LCD_COLOR_GREEN);
-      
-      lcd.SetTextColor(LCD_COLOR_BLUE);
-      lcd.DrawRect(10, 20, 50, 50);
-      wait(0.1);
-      lcd.SetTextColor(LCD_COLOR_BROWN);
-      lcd.DrawCircle(80, 80, 50);
-      wait(0.1);
-      lcd.SetTextColor(LCD_COLOR_YELLOW);
-      lcd.DrawEllipse(150, 150, 50, 100);
-      wait(0.1);
-      lcd.SetTextColor(LCD_COLOR_RED);
-      lcd.FillCircle(200, 200, 40);
-      wait(1);
+        BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
+        BSP_LCD_SetTextColor(LCD_COLOR_ORANGE);
+        BSP_LCD_DisplayStringAt(0, 100, (uint8_t *)"DISCOVERY STM32F746NG", CENTER_MODE);
+        HAL_Delay(2000);
 
-      lcd.SetBackColor(LCD_COLOR_ORANGE);
-      lcd.SetTextColor(LCD_COLOR_CYAN);
-      lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"HAVE FUN !!!", CENTER_MODE);
-      wait(1);
+        BSP_LCD_Clear(LCD_COLOR_GREEN);
+        BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
+        BSP_LCD_DrawRect(10, 20, 50, 50);
+        BSP_LCD_SetTextColor(LCD_COLOR_BROWN);
+        BSP_LCD_DrawCircle(80, 80, 50);
+        BSP_LCD_SetTextColor(LCD_COLOR_YELLOW);
+        BSP_LCD_DrawEllipse(150, 150, 50, 100);
+        BSP_LCD_SetTextColor(LCD_COLOR_RED);
+        BSP_LCD_FillCircle(200, 200, 40);
+        HAL_Delay(2000);
 
-      led1 = !led1;
+        BSP_LCD_SetBackColor(LCD_COLOR_GREEN);
+        BSP_LCD_SetTextColor(LCD_COLOR_CYAN);
+        BSP_LCD_DisplayStringAt(0, 6, (uint8_t *)"HAVE FUN !!!", RIGHT_MODE);
+        HAL_Delay(2000);
     }
 }
diff -r abedada304bf -r e8f8a8037256 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Nov 20 11:33:58 2019 +0100
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#699372421a3b388fe568e9be85b1a985749a438f
diff -r abedada304bf -r e8f8a8037256 mbed.bld
--- a/mbed.bld	Thu Jun 08 13:47:01 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file