Thread_lcd

Dependencies:   BSP_DISCO_F746NG

Files at this revision

API Documentation at this revision

Comitter:
iliatumash
Date:
Tue Oct 13 16:23:00 2020 +0000
Commit message:
Treads

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
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
diff -r 000000000000 -r 0ae76e57b20e .hgignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Tue Oct 13 16:23:00 2020 +0000
@@ -0,0 +1,2 @@
+BUILD
+mbed-os/
diff -r 000000000000 -r 0ae76e57b20e BSP_DISCO_F746NG.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F746NG.lib	Tue Oct 13 16:23:00 2020 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
diff -r 000000000000 -r 0ae76e57b20e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 13 16:23:00 2020 +0000
@@ -0,0 +1,74 @@
+#include "mbed.h"
+#include "stm32746g_discovery_lcd.h"
+
+
+DigitalOut led(LED1);
+Thread thread0, thread1, thread2, thread3;
+
+void printText(uint16_t line, uint32_t Color, char text[])
+{
+    BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
+    BSP_LCD_SetTextColor(Color);
+    BSP_LCD_DisplayStringAt(0, LINE(line),(uint8_t *)text, CENTER_MODE);
+    ThisThread::sleep_for(500);
+    BSP_LCD_ClearStringLine(line);
+    ThisThread::sleep_for(500);
+}
+
+void led_thread()
+{
+    while (true) {
+        led = !led;
+        ThisThread::sleep_for(100);
+    }
+}
+
+void lcd_tread1()
+{
+    uint16_t line = 1;
+    uint32_t color = LCD_COLOR_WHITE;
+    char text[] = "Ahoj";
+    while (true) {
+        printText(line, color, text);
+   }
+}
+
+void lcd_tread2()
+{
+    while (true) {
+        BSP_LCD_SetTextColor(LCD_COLOR_LIGHTRED);
+        BSP_LCD_FillCircle(100, 200, 36);
+        ThisThread::sleep_for(400);
+        BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
+        BSP_LCD_FillCircle(100, 200, 36);
+        ThisThread::sleep_for(400);
+    }
+}
+
+void lcd_tread3()
+{
+    while (true) {
+        BSP_LCD_SetTextColor(LCD_COLOR_LIGHTGREEN);
+        BSP_LCD_FillRect(250, 166, 70,70);
+        ThisThread::sleep_for(800);
+        BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
+        BSP_LCD_FillRect(250, 166, 70,70);
+        ThisThread::sleep_for(800);
+    }
+}
+
+int main()
+{
+    BSP_LCD_Init();
+    BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
+    BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
+    BSP_LCD_Clear(LCD_COLOR_BLUE);
+    BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
+    
+    while (1){
+    thread0.start(led_thread);
+    thread1.start(lcd_tread1);
+    thread2.start(lcd_tread2);
+    thread3.start(lcd_tread3);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 0ae76e57b20e mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Oct 13 16:23:00 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#699372421a3b388fe568e9be85b1a985749a438f