Pacemaker code Implementation for SFWRENG 3K04

Dependencies:   mbed Queue mbed-rtos FXOS8700Q

Fork of Pacemaker by Eric dollar

SWFRENG 3K04 Project to design, develop, and document a functional pacemaker.

The project uses the Freescale K64F Microcontroller and C++ mbed library.

dataStruct.cpp

Committer:
trane3
Date:
2016-11-29
Revision:
31:5e55042e025a
Parent:
29:c0d63940b0c7

File content as of revision 31:5e55042e025a:

#pragma once
#include "dataStruct.h"
#include "rtos.h"
#include "mbed.h"

dataStruct::dataStruct(hardware* hWare): myQueue(1,N){//,thread(&dataStruct::threadStarter){
    myHardware = hWare; 
//    thread.signal_set(START_THREAD);
    }
    
dataStruct::~dataStruct(){
    }

void dataStruct::threadStarter(void const *p){
    dataStruct *instance = (dataStruct*)p;
    instance->storeData();
    }

void dataStruct::storeData(){
//    thread.signal_wait(START_THREAD);
    while(true){
        //streamValue = myHardware->getSense();
        streamValue = 10;
        if(myQueue.GetNumberOfItems() <= N){
            myQueue.Put(&streamValue);
            }
        Thread::wait(4);
    }
}

double dataStruct::getData(){
//    queue temp = myQueue;
//    myQueue.Flush();
//    return temp;
    return myHardware->getSense();
}