Pacemaker code Implementation for SFWRENG 3K04

Dependencies:   FXOS8700Q Queue mbed-rtos mbed

Fork of Pacemaker by Eric dollar

Revision:
25:d816de7067da
Parent:
23:719584670460
Child:
26:3b49e8c3793f
diff -r 4af25128cedf -r d816de7067da interface.cpp
--- a/interface.cpp	Thu Nov 24 03:51:30 2016 +0000
+++ b/interface.cpp	Thu Nov 24 04:53:30 2016 +0000
@@ -1,4 +1,4 @@
-    #pragma once
+#pragma once
 #include "mbed.h"
 #include "interface.h"
 #include "hardware.h"
@@ -7,26 +7,28 @@
 #include "pulse.h"
 #include "voor.h"
 #include "rtos.h"
+#include "queue.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string>
 
 //CONSTRUCTORS*****************************
-interface::interface(){
+interface::interface(): myQueue(1,N){
     }
 
 interface::~interface(){};
 
-interface::interface(Serial* inputPC){
+interface::interface(Serial* inputPC): myQueue(1,N){
     pc = inputPC;
     }
 
-interface::interface(Serial* inputPC , pulse* p ,genData* genData, chamberData* atrium , chamberData* ventricle){
+interface::interface(Serial* inputPC , pulse* p ,genData* genData, chamberData* atrium , chamberData* ventricle, hardware* hardw): myQueue(1,N) {
     generalData = genData;
     pc = inputPC;
     interfacePulse = p;
     atrData = atrium;
-    ventData = ventricle;
+    ventData = ventricle; 
+    myHardware = hardw; 
     }
 //********************************************
 
@@ -80,7 +82,7 @@
         case '3':
             interface::genDataScreen();
         case '4':
-            pc->printf("\nNot setup yet");
+            interface::getEgram();
             break;
         case '5':
             interface::startScreen();  
@@ -299,6 +301,43 @@
             interface::getData(chamber);
     }  
  }
+ 
+void interface::getEgram(){
+    myDataStruct = new dataStruct(myHardware);
+    while(true){
+        Thread::wait(52);
+        myQueue = myDataStruct->getData();
+        //I know below doesn't look neat, but it just will print values to the screen for now. One day we may do a graph. 
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 1 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 2 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 3 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 4 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 5 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 6 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 7 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 8 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 9 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 10 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 11 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 12 = %d\r", nTemp );
+        myQueue.Get( &nTemp );
+        pc->printf( "Item 13 = %d\r", nTemp );
+    }
+    delete myDataStruct;
+}
+ 
 char* interface::getInput(){
     char buffer[5];
     fgets (buffer,5,stdin);