Base 4 Scope (4 March 2022)

Dependencies:   mbed QEI DmTftLibrary

Revision:
21:ab8027016a2c
Parent:
20:626b92b70bf7
Child:
22:12c555cade79
diff -r 626b92b70bf7 -r ab8027016a2c Display/Menu.cpp
--- a/Display/Menu.cpp	Thu Nov 08 10:14:39 2018 +0000
+++ b/Display/Menu.cpp	Thu Jan 20 08:15:44 2022 +0000
@@ -12,12 +12,20 @@
 Maintainer: Gregory Cristian & Gilbert Menth
 */
 
+//#include "DmTftRa8875.h"
+//#include "mbed.h"
+//#include "Eeprom.h"
+//#include "DisplayDriver.h"
+#include "DmTftIli9341.h"
+#include "DmTouch.h"
+#include "DmTouchCalibration.h"
+
 #include <stdio.h>
 #include "mbed.h"
 #include "Menu.h"
 #include "DisplayDriver.h"
 #include "Eeprom.h"
-#include "DemoApplication.h"
+//#include "DemoApplication.h"
 #include "main.h"
 #include "app_config.h"
 
@@ -46,6 +54,12 @@
 #define RANGING_FULLSCALE_MIN   10
 #define RANGING_FULLSCALE_MAX   30000
 
+// DmTftIli9341( PinName cs, PinName dc, PinName mosi, PinName miso, PinName clk )
+// DM_TFT28_105
+//DmTftIli9341 Tft( D10, D9, D11, D12, D13 );
+//DmTouch Touch( DmTouch::DM_TFT28_105, D9, D11, D12 );
+//DmTouchCalibration Calibration = DmTouchCalibration( &Tft, &Touch );
+
 /*!
  * \brief Bitmap of Semtech Logo stored here (copied from a C file).
  */
@@ -256,15 +270,15 @@
  * Config" to be able to restore the page before "Radio Congig", witch can be
  * PingPong, PER or START_PAGE. The goal is to speed menu navigation.
  */
-static uint8_t CurrentPage  = START_PAGE;
-static uint8_t PreviousPage = START_PAGE;
+//static uint8_t CurrentPage  = START_PAGE;
+//static uint8_t PreviousPage = START_PAGE;
 
 /*!
  * \brief In "Radio Config Freq", we can update the central frequency. To avoid 
  * keyboard, we use (+) et (-) keys. CurrentFreqBase is the offset to be applied
  * when we increase or decrease the frequency.
  */
-static FreqBase CurrentFreqBase = FB100K;
+//static FreqBase CurrentFreqBase = FB100K;
 
 
 void CheckScreen( void );
@@ -280,14 +294,81 @@
 {
     DisplayDriverInit( );
     GraphObjectDraw( &( MenuObjects[PAGE_BORDER] ), NULL, false, false );
-    GraphObjectDraw( &( MenuObjects[TITLE_LINE] ), NULL, false, false );
-    MenuSetPage( START_PAGE );
+//    GraphObjectDraw( &( MenuObjects[TITLE_LINE] ), NULL, false, false );
+//    MenuSetPage( START_PAGE );
     CheckScreenTouch.attach_us( &CheckScreen, 100000 );     // every 100 ms
 
     // Page Utilities only for GPS and proximity sensor :
     CheckPageRefresh.attach_us( &CheckRefresh, 1000000 );   // every 1 s
 }
 
+void    StabilusMenu    (void) {
+
+    uint8_t graphObjectTouched = 0xFF;
+//    static uint8_t refresh = false;
+
+    if  (CheckScreenFlag == true) {
+        if  (ScreenBeenDebounced == false) {
+            ScreenBeenDebounced = true;
+            CheckScreenFlag = false;
+            DebouncedScreenTouch.attach_us  (&DebouncedScreen,
+                                            150000);            // every 150 ms
+            GraphObjectTouched  (MenuObjects,
+                                GRAPH_OBJECTS_COUNT,
+                                &graphObjectTouched);
+        }
+    }
+
+    StabilusMainPage( graphObjectTouched );
+}
+
+void    StabilusMainPage (uint8_t graphObjectTouched) {
+
+    uint16_t x, y = 0;
+    bool touched = false;
+
+    // remove all button and text (except title, page border and line)
+    // and disable all button (touchActive = false).
+
+/*
+    GraphObject_t clearRect =   {NULL,
+                                GO_RECTANGLE, 3, 35, 282, 230, 1,
+                                BACK_COLOR,
+                                BACK_COLOR,
+                                true,
+                                BACK_COLOR,
+                                NULL,
+                                false};
+    //
+    GraphObjectClear    (&clearRect,
+                        true );
+*/
+
+//    for (uint8_t i = 0; i < GRAPH_OBJECTS_COUNT; i++ ) {
+//        MenuObjects[i].TouchActive = false;
+//    }
+
+    TouchedXYT (&x, &y, &touched);
+    sprintf (StringText,
+            "%d", touched);
+    sprintf (StringText2,
+            "%d", x);
+    sprintf (StringText3,
+            "%d", y);
+    DrawText(TITLE_TEXT, (uint8_t*)StringText, NULL, NULL );
+    
+    //    DisplayDriverDrawLogo( SemtechLogo, 20, 37 );
+        DrawActiveButton( BTN2_BORDER, ( uint8_t* )StringText2, NULL );
+        DrawActiveButton( BTN3_BORDER, ( uint8_t* )StringText3, NULL );
+    //    DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Outdoor ranging demo", NULL );
+    //    DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Radio Test Modes", NULL );
+    //    DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Radio Settings", NULL );
+    //    DrawActiveButton( BTN7_BORDER, ( uint8_t* )"Utilities", NULL );
+
+//    CurrentPage = START_PAGE;
+}
+
+/*
 uint8_t MenuHandler( bool refresh )
 {
     uint8_t graphObjectTouched = 0xFF;
@@ -1415,7 +1496,9 @@
     }
     return CurrentPage;
 }
+*/
 
+/*
 void MenuSetPage( uint8_t page )
 {
     if( page != CurrentPage )
@@ -1908,7 +1991,9 @@
             break;
     }
 }
+*/
 
+/*
 void DisplayCurrentRadioParams( uint8_t page )
 {
     switch( page )
@@ -1994,7 +2079,9 @@
             break;
     }
 }
+*/
 
+/*
 char* GetMenuRadioFrameType( void )
 {
     switch( Eeprom.EepromData.DemoSettings.ModulationType )
@@ -2007,7 +2094,9 @@
         default:                  return ( char* )" LORA";
     }
 }
+*/
 
+/*
 char* GetRadioModulationParameters1( void )
 {
     if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
@@ -2065,7 +2154,9 @@
         return ( char* )"";
     }
 }
+*/
 
+/*
 char* GetRadioModulationParameters2( void )
 {
     if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
@@ -2119,7 +2210,9 @@
         return ( char* )"";
     }
 }
+*/
 
+/*
 char* GetRadioModulationParameters3( void )
 {
     if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
@@ -2163,7 +2256,9 @@
         return ( char* )"";
     }
 }
+*/
 
+/*
 char* GetRadioFrequency( void )
 {
     sprintf( StringText2, "%lu Hz", \
@@ -2473,6 +2568,7 @@
         default:                   return ( char* )"X";
     }
 }
+*/
 
 void CheckScreen( void )
 {