KSM edits

Dependencies:   mbed RA8875

Revision:
19:fee3f71fab2d
Parent:
18:307303d9c8f6
Child:
20:d25fb9c55781
--- a/main.cpp	Mon Mar 04 12:09:46 2019 +0000
+++ b/main.cpp	Wed Jul 10 13:30:27 2019 +0000
@@ -17,11 +17,14 @@
 #include "BPG_Arial20x20.h"
 #include "BPG_Arial31x32.h"
 #include "BPG_Arial63x63.h"
+#include "Button.h"
 
 // These two defines can be enabled, or commented out
-#define BIG_SCREEN
+//#define BIG_SCREEN
 //#define CAP_TOUCH
 #define LCD_C 16         // color - bits per pixel
+                             // Needed for Resistive Touch
+void CalibrateTS(void);
 
 #ifdef CAP_TOUCH
 RA8875 lcd(p5, p6, p7, p12, NC, p9,p10,p13, "tft"); // MOSI,MISO,SCK,/ChipSelect,/reset, SDA,SCL,/IRQ, name
@@ -40,6 +43,8 @@
 
 Serial pc(USBTX, USBRX);            // And a little feedback
 Timer measurement;
+Button button_calibration((loc_t)10, (loc_t)10, (loc_t)20, (loc_t)20, (color_t)RGB(255,255,0), &lcd, "CAL");
+Button button_data_rate_select((loc_t)10, (loc_t)10, (loc_t)20, (loc_t)20, (color_t)RGB(255,255,0), &lcd, "250");
 
 RetCode_t callback(RA8875::filecmd_t cmd, uint8_t * buffer, uint16_t size)
 {
@@ -83,7 +88,7 @@
     lcd.frequency(500000);
     lcd.Reset();
     lcd.init(LCD_W, LCD_H, LCD_C, 40);
-
+    lcd.Backlight(.9);
     // **************************
     //RunTestSet(lcd, pc);  // If the library was compiled for test mode...
 
@@ -118,9 +123,23 @@
 
     //lcd.AttachPrintHandler(callback);
     //lcd.PrintScreen(0,0,LCD_W,LCD_H,8);
-
+    button_calibration.draw();
 
-    while(1) {
-        ;       // end
+    while(1) 
+    {
+        TouchCode_t touch;
+        
+        touch = lcd.TouchPanelReadable();
+        if(touch)
+        {
+            for(int i = 0; i < lcd.TouchChannels(); i++)
+            {
+                point_t xy = lcd.TouchCoordinates(i);
+                if(button_calibration.isPressed(xy.x, xy.y))
+                {
+                    lcd.rect(0,0, LCD_W,LCD_H, BrightCyan);
+                };       // end
+            }
+        }
     }
-}
+}
\ No newline at end of file