MH K8 firmware with HV control.

Dependencies:   mbed NOKIA_5110

Fork of muonhunter-K8 by Oliver Keller

Files at this revision

API Documentation at this revision

Comitter:
mihaly
Date:
Mon Apr 22 14:00:08 2019 +0000
Parent:
10:534172e71f4f
Commit message:
K8 fimrware initial

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jul 19 21:58:36 2017 +0000
+++ b/main.cpp	Mon Apr 22 14:00:08 2019 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "hvcontrol.cpp"
 #include "detection.cpp"
-//#include <queue>
+#include <queue>
 #include "NOKIA_5110.h"
 
 volatile double targetVoltage1 = 400;
@@ -20,7 +20,8 @@
 
 //set the coincidence times in us below
 int coincidence_wait = 50; //150;
-bool buzzer  = 1;
+bool buzzer  = 0;
+bool muonLED = 0;
 
 /* NO USER CONFIGURABLE OPTIONS BELOW
 */
@@ -40,7 +41,7 @@
 int minutes = 0; //global minutes counter
 
 //storing a detections in a FIFO queue
-//queue<Detection> detections;
+queue<Detection> detections;
 
 //High voltage controls
 HVControl hv1(PA_3, PA_0);
@@ -80,7 +81,7 @@
 
 void muon_buzz(void)
 {
-    C_led = 1;
+    if(muonLED) C_led = 1;
 
     if(buzzer) {
         for(int i = 0; i < 32; i++) {
@@ -140,7 +141,7 @@
             muon_buzz();
             muon_total++;
             gm2_total++;
-            mdet = 1;
+            if(muonLED) mdet = 1;
         }
         wait(1e-7);
     }
@@ -162,7 +163,7 @@
             muon_buzz();
             muon_total++;
             gm1_total++;
-            mdet = 1;
+            if(muonLED) mdet = 1;
         }
         wait(1e-7);
     }
@@ -348,13 +349,13 @@
         myLcd.DrawString(number);
         
         
-//        while(!detections.empty()){
-//            Detection temp = detections.front();
-//
-//            pc.printf("Ch: %d, Time: %.2fs, V1: %.1fV, V2: %.1fV \n\r", temp.channel, temp.time, v1, v2);
-//            pc.printf("Total GM1: %d, Total GM2: %d, Total Coinc: %d \n\r \n\r", gm1_total, gm2_total, muon_total);
-//            detections.pop();
-//        }
+        while(!detections.empty()){
+            Detection temp = detections.front();
+
+            pc.printf("Ch: %d, Time: %.2fs, V1: %.1fV, V2: %.1fV \n\r", temp.channel, temp.time, v1, v2);
+            pc.printf("Total GM1: %d, Total GM2: %d, Total Coinc: %d \n\r \n\r", gm1_total, gm2_total, muon_total);
+            detections.pop();
+        }
         
         pc.printf("%.fs, GM1: %d, GM2: %d, Muons: %d \n\r", main_t.read(), gm1_total, gm2_total, muon_total);
         pc.printf("V1: %.1fV, V2: %.1fV \n\r", v1, v2);