LCD TS

Dependencies:   mbed LCD_DISCO_F746NG BSP_DISCO_F746NG

Files at this revision

API Documentation at this revision

Comitter:
James1208
Date:
Thu Jun 16 08:53:35 2022 +0000
Parent:
3:0b57082839f2
Commit message:
commit

Changed in this revision

BSP_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
TS_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.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 0b57082839f2 -r 896fb491fbfb BSP_DISCO_F746NG.lib
--- a/BSP_DISCO_F746NG.lib	Thu Jun 16 08:47:53 2022 +0000
+++ b/BSP_DISCO_F746NG.lib	Thu Jun 16 08:53:35 2022 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#458ab1edf6b2
+https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#c9112f0c67e3
diff -r 0b57082839f2 -r 896fb491fbfb TS_DISCO_F746NG.lib
--- a/TS_DISCO_F746NG.lib	Thu Jun 16 08:47:53 2022 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/teams/ST/code/TS_DISCO_F746NG/#fe0cf5e2960f
diff -r 0b57082839f2 -r 896fb491fbfb main.cpp
--- a/main.cpp	Thu Jun 16 08:47:53 2022 +0000
+++ b/main.cpp	Thu Jun 16 08:53:35 2022 +0000
@@ -1,207 +1,46 @@
 #include "mbed.h"
-#include "TS_DISCO_F746NG.h"
 #include "LCD_DISCO_F746NG.h"
 
 LCD_DISCO_F746NG lcd;
-TS_DISCO_F746NG ts;
 
-InterruptIn draw_start(D7);
-InterruptIn draw_ask(D6);
-InterruptIn draw_pass(D5);
-InterruptIn draw_fail(D4);
-InterruptIn draw_proc(D3);
-
-DigitalOut ack(D2);
-DigitalOut yes_no(D1);
-DigitalOut ck(D0);
-
-int page = 5;
-
-void draw_start_rtn()
-{
-    page = 0;
-} // end
-
-void draw_ask_rtn()
-{
-    page = 1;
-} // end
-
-void draw_pass_rtn()
-{
-    page = 2;
-} // end
-
-void draw_fail_rtn()
-{
-    page = 3;
-} // end
-
-void draw_proc_rtn()
-{
-    page = 4;
-} // end
+DigitalOut led1(LED1);
 
 int main()
-{
-
-    TS_StateTypeDef TS_State;
-    uint8_t status;
-
-    int lcd_width = lcd.GetXSize();
-
-    draw_ask.mode(PullDown);
-    draw_start.mode(PullDown);
-    draw_pass.mode(PullDown);
-    draw_fail.mode(PullDown);
-    draw_proc.mode(PullDown);
-
-    draw_ask.rise(&draw_ask_rtn);
-    draw_start.rise(&draw_start_rtn);
-    draw_pass.rise(&draw_pass_rtn);
-    draw_fail.rise(&draw_fail_rtn);
-    draw_proc.rise(&draw_proc_rtn);
-
-    status = ts.Init(lcd_width, lcd.GetYSize());
-    
-    ack = 1;
-    yes_no = 1;
-    ck = 1;
-    
-    if (status != TS_OK) {
-        lcd.Clear(LCD_COLOR_RED);
-        lcd.SetBackColor(LCD_COLOR_RED);
-        lcd.SetTextColor(LCD_COLOR_BLACK);
-        lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE);
-        wait(1);
-    } // if (status != TS_OK)
+{  
+    led1 = 1;
 
-    while(1) {
-        switch (page) {
-            case 0:
-                lcd.Clear(LCD_COLOR_WHITE);
-                lcd.SetBackColor(LCD_COLOR_WHITE);
-                lcd.SetTextColor(LCD_COLOR_BLACK);
-                wait(0.1);
-                lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"INSERT DVD TRAY", CENTER_MODE);
-                lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"AND LABEL SHEET", CENTER_MODE);
-                lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"[ START ]", CENTER_MODE);
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(!(TS_State.touchDetected));
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(TS_State.touchDetected);
-
-                ack = 0;
-                wait_ms(50);
-                ack = 1;
-
-                page = 5;
-                break;
-
-            case 1:
-                lcd.Clear(LCD_COLOR_YELLOW);
-                lcd.SetBackColor(LCD_COLOR_YELLOW);
-                lcd.SetTextColor(LCD_COLOR_BLACK);
-                wait(0.1);
-                lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"MORE LABEL SHEETS?", CENTER_MODE);
-                lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"[ NO ]", LEFT_MODE);
-                lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"[ YES ]", RIGHT_MODE);
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(!(TS_State.touchDetected));
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(TS_State.touchDetected);
+    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);
 
-                if (TS_State.touchX[0] > (lcd_width/2)) {
-                    yes_no = 1;
-                    wait_ms(50);
-                    ck = 0;
-                    wait_ms(50);
-                    ck = 1;
-                } else {
-                    yes_no = 0;
-                    wait_ms(50);
-                    ck = 0;
-                    wait_ms(50);
-                    ck = 1;
-                } // if (TS_State.touchX[0] > (lcd_width/2))
-
-                page = 5;
-                break;
-
-            case 2:
-                lcd.Clear(LCD_COLOR_GREEN);
-                lcd.SetBackColor(LCD_COLOR_GREEN);
-                lcd.SetTextColor(LCD_COLOR_BLACK);
-                wait(0.1);
-                lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"PASS", CENTER_MODE);
-                lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"[ CONTINUE ]", CENTER_MODE);
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(!(TS_State.touchDetected));
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(TS_State.touchDetected);
-
-                ack = 0;
-                wait_ms(50);
-                ack = 1;
+      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);
 
-                page = 5;
-                break;
-
-            case 3:
-                lcd.Clear(LCD_COLOR_RED);
-                lcd.SetBackColor(LCD_COLOR_RED);
-                lcd.SetTextColor(LCD_COLOR_BLACK);
-                wait(0.1);
-                lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"FAIL", CENTER_MODE);
-                lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"[ CONTINUE ]", CENTER_MODE);
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(!(TS_State.touchDetected));
-
-                do {
-                    wait_ms(50);
-                    ts.GetState(&TS_State);
-                } while(TS_State.touchDetected);
+      lcd.SetBackColor(LCD_COLOR_ORANGE);
+      lcd.SetTextColor(LCD_COLOR_CYAN);
+      lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"HAVE FUN !!!", CENTER_MODE);
+      wait(1);
 
-                ack = 0;
-                wait_ms(50);
-                ack = 1;
-
-                page = 5;
-                break;
-
-            case 4:
-                lcd.Clear(LCD_COLOR_YELLOW);
-                lcd.SetBackColor(LCD_COLOR_YELLOW);
-                lcd.SetTextColor(LCD_COLOR_BLACK);
-                wait(0.1);
-                lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"PROCESSING...", CENTER_MODE);
-
-                page = 5;
-                break;
-
-            default:
-                break;
-        } // switch (page)
-    } // while (1)
-} // end
+      led1 = !led1;
+    }
+}
diff -r 0b57082839f2 -r 896fb491fbfb mbed.bld
--- a/mbed.bld	Thu Jun 16 08:47:53 2022 +0000
+++ b/mbed.bld	Thu Jun 16 08:53:35 2022 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file