modification of the original demo to include subroutine for clearscreen and mainscreen

Dependencies:   BSP_DISCO_F769NI mbed-rtos mbed

Fork of DISCO-F769NI_TOUCHSCREEN_demo by ST

added some code to print actual touch coordinates to the LCD screen at the touch location.

Files at this revision

API Documentation at this revision

Comitter:
yawstick
Date:
Sun Jul 23 06:36:17 2017 +0000
Parent:
3:a8af91804931
Commit message:
update... prints touch coordinates to screen in location touched

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a8af91804931 -r 7a82acfec4da main.cpp
--- a/main.cpp	Fri Jul 07 08:31:33 2017 +0000
+++ b/main.cpp	Sun Jul 23 06:36:17 2017 +0000
@@ -2,7 +2,7 @@
 #include "stm32f769i_discovery.h"
 #include "stm32f769i_discovery_ts.h"
 #include "stm32f769i_discovery_lcd.h"
-
+char buff[50];
 char string();
 
 void mainscreen(); 
@@ -18,18 +18,19 @@
               if(TS_State.touchDetected) {                              /* One or dual touch have been detected          */
               x1 = TS_State.touchX[0];                                  /* Get X and Y position of the first touch post calibrated */
               y1 = TS_State.touchY[0];
-             /* string =  "  x1" , y1 " ; */
-              
-              printf("Touch Detected x=%d y=%d\n\r", x1, y1);
               if ((x1 > 0 & x1 < 88) & (y1 > 392 & y1 < 480)) {
                       clearscreen();
                      }
-                     BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
-              BSP_LCD_SetTextColor(LCD_COLOR_MAGENTA);
-               BSP_LCD_SetFont(&Font16);
-              BSP_LCD_DisplayStringAt(x1, y1, (uint8_t *)"< Touch Detected (x1 y1) ", LEFT_MODE);
+              BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
+              BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
+              BSP_LCD_SetFont(&Font16);
+              printf("Touch Detected x=%d y=%d\n\r", x1, y1);   
+              sprintf(buff,"< (%d,%d)", x1, y1 );
+              BSP_LCD_DisplayStringAt(x1, y1, (uint8_t *)buff, LEFT_MODE);
+              wait_ms(50);              
+              /* BSP_LCD_DisplayStringAt(x1, y1, (uint8_t *)"< Touch Detected (x1 y1) ", LEFT_MODE); */
              BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
-              BSP_LCD_FillRect(x1, y1, 20, 20);
+             /* BSP_LCD_FillRect(x1, y1, 20, 20);   */
            /*   BSP_LCD_FillRect(0, 380, 100, 100);       */
         }
     }