Logic code

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
EricGlunn
Date:
Tue Apr 21 22:00:33 2020 +0000
Parent:
2:9a88de905577
Commit message:
No Trigger Option yet, barebones oscilloscope

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 9a88de905577 -r 60f30ca6a65d main.cpp
--- a/main.cpp	Tue Apr 21 03:31:20 2020 +0000
+++ b/main.cpp	Tue Apr 21 22:00:33 2020 +0000
@@ -126,11 +126,11 @@
 }
 
 void oScope_sample_func(void){
-    oScopeArray[oScopeCount]=a1*254;
-    oScopeCount++;
+    oScopeArray[oScopeCount++]=a1*254;
 }
 
 void oScope_poll_trig(){
+    /*
     float first, second;
     bool run_poll =true;  
     while(run_poll){
@@ -138,7 +138,7 @@
         wait (.001);
         second=a1;
         if( (second - first)>.1){run_poll = false;}
-    }
+    } */
     
     switch(oScopeTime) {
     
@@ -173,6 +173,9 @@
     case ms1000:
         oScopeCut.attach(oScope_kill_func, 1);
         break;
+    default:
+        oScopeCut.attach(oScope_kill_func, .01);
+        break;
     }   
     
     oScopeTicker.attach_us(oScope_sample_func, 50);
@@ -190,6 +193,7 @@
             tickerboi.detach();             //detach Ticker
             DigitalStatus=0;                //turn off status LED
             AnalogStatus=0;
+            
             if(oScopeStatus){
                 oScope_kill_func();
             }
@@ -234,12 +238,14 @@
             newAnalog=false;
         }
         
-        if(oScope_poll){ oScope_poll_trig(); }
+        if(oScope_poll){ 
+            oScope_poll=false;
+            oScope_poll_trig(); }
         
         if(newoScope){
             PC.putc(FULL);
-            for(int j=0; j<=oScopeCount; j++){
-                PC.putc(oScopeArray[oScopeCount]);
+            for(int j=0; j<oScopeCount; j++){
+                PC.putc(oScopeArray[j]);
             }
             oScopeCount=0;
             newoScope=false;