March 11 2022, Vertically Lined Scope i Working

Dependencies:   mbed QEI DmTftLibraryEx

Revision:
30:e45282a70a4d
Parent:
27:654100855f5c
Child:
32:1be3d79ff4db
--- a/Display/DisplayDriver.cpp	Fri Mar 04 15:31:53 2022 +0000
+++ b/Display/DisplayDriver.cpp	Fri Mar 11 10:10:21 2022 +0000
@@ -29,6 +29,8 @@
 // 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 );
 
@@ -488,6 +490,18 @@
     Tft.setTextColor    (background, foreground);
 }
 
+void    LCM_SetPixel    (uint16_t ui_X, uint16_t ui_Y, uint16_t ui16_Color) {
+    Tft.setPixel    (ui_X, ui_Y, ui16_Color);
+}
+
+void    LCM_DrawLine    (uint16_t ui_X0, uint16_t ui_Y0, uint16_t ui_X1, uint16_t ui_Y1, uint16_t ui16_Color) {
+    Tft.drawLine    (ui_X0, ui_Y0, ui_X1, ui_Y1, ui16_Color);
+}
+
+DmTftBase & getDmTft(){
+    return Tft;
+}
+
 // LA:  Color RGB Component(s)
 //      ======================
 //
@@ -523,3 +537,39 @@
     return  (R+ G+ B);
 }
 
+extern  float   af_PlotSamples[240];
+extern  uint16_t    aui16_PlotSamples[240];
+extern  uint16_t    aui16_PlotClears_Lo[240];
+extern  uint16_t    aui16_PlotClears_Hi[240];
+
+void    LCM_PlotVector  (void) {
+uint16_t    ui16_Index000;
+//uint16_t    ui16_ActualSample;
+//uint16_t    ui16_PreviousSample;
+//uint16_t    ui16_Length;
+//int16_t    i16_Length;
+
+    // LA:  Scope Bar Plot, Theory of Operation
+    //      ===================================
+    //
+    //  Any pixel of the Horizontal Scope Line will be plot, thus, I can play with VERTICAL lines only instead of Point2Point Lines.
+    //  Any Vertical Line will start from where the previous plot ended, The Vertical Length is the difference among the Plots
+    //
+    //  In order to clear the previous plot, 2 arrays have been created.
+    //  There, it is possible to hold the components of any line that has been previously written on any Vertical
+    //  Before writing a new vertical, Simply clear the previous.
+    //
+    for (ui16_Index000 = 1; ui16_Index000 < 240; ui16_Index000++) {
+
+        // LA:  Clear Previous Plot by means of the Hi/Lo Array(s)
+        //
+        Tft.drawVerticalLineEx  (ui16_Index000, 300 - aui16_PlotClears_Hi[ui16_Index000], (int16_t) aui16_PlotClears_Hi[ui16_Index000]- aui16_PlotClears_Lo[ui16_Index000], Scale2RGBColor(31, 31, 31));
+
+        // LA:  Then PLOT the New
+        //
+        aui16_PlotClears_Hi[ui16_Index000] = (uint16_t) (af_PlotSamples[ui16_Index000]* 100);
+        aui16_PlotClears_Lo[ui16_Index000] =   (uint16_t) (af_PlotSamples[ui16_Index000- 1]* 100);
+        //
+        Tft.drawVerticalLineEx  (ui16_Index000, 300 - aui16_PlotClears_Hi[ui16_Index000], (int16_t) aui16_PlotClears_Hi[ui16_Index000]- aui16_PlotClears_Lo[ui16_Index000], Scale2RGBColor(0, 0, 0));
+    }
+}