Pacemaker code Implementation for SFWRENG 3K04

Dependencies:   FXOS8700Q Queue mbed-rtos mbed

Fork of Pacemaker by Eric dollar

Committer:
FiveDollar
Date:
Tue Nov 29 21:30:19 2016 +0000
Revision:
30:0cb4890910cd
Parent:
29:c0d63940b0c7
this is the messed up code that i tried to fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noahzwiep 16:08d5e5a3ee74 1 #pragma once
noahzwiep 16:08d5e5a3ee74 2 #include "dataStruct.h"
noahzwiep 16:08d5e5a3ee74 3 #include "rtos.h"
FiveDollar 29:c0d63940b0c7 4 #include "mbed.h"
noahzwiep 16:08d5e5a3ee74 5
FiveDollar 30:0cb4890910cd 6 void dataStruct(hardware* hWare){
FiveDollar 30:0cb4890910cd 7 //,thread(&dataStruct::threadStarter){
noahzwiep 16:08d5e5a3ee74 8 myHardware = hWare;
FiveDollar 28:4f36e100ccbe 9 // thread.signal_set(START_THREAD);
noahzwiep 16:08d5e5a3ee74 10 }
FiveDollar 30:0cb4890910cd 11
noahzwiep 16:08d5e5a3ee74 12
FiveDollar 30:0cb4890910cd 13 //void threadStarter(void const *p){
FiveDollar 30:0cb4890910cd 14 // dataStruct *instance = (dataStruct*)p;
FiveDollar 30:0cb4890910cd 15 // instance->storeData();
FiveDollar 30:0cb4890910cd 16 // }
noahzwiep 16:08d5e5a3ee74 17
FiveDollar 30:0cb4890910cd 18 void storeData(){
FiveDollar 28:4f36e100ccbe 19 // thread.signal_wait(START_THREAD);
noahzwiep 16:08d5e5a3ee74 20 while(true){
FiveDollar 30:0cb4890910cd 21 streamValue = io->getSense();
noahzwiep 16:08d5e5a3ee74 22 if(myQueue.GetNumberOfItems() <= N){
noahzwiep 16:08d5e5a3ee74 23 myQueue.Put(&streamValue);
noahzwiep 16:08d5e5a3ee74 24 }
noahzwiep 16:08d5e5a3ee74 25 Thread::wait(4);
noahzwiep 16:08d5e5a3ee74 26 }
noahzwiep 16:08d5e5a3ee74 27 }
noahzwiep 16:08d5e5a3ee74 28
FiveDollar 30:0cb4890910cd 29 queue getData(){
noahzwiep 16:08d5e5a3ee74 30 queue temp = myQueue;
noahzwiep 16:08d5e5a3ee74 31 myQueue.Flush();
noahzwiep 16:08d5e5a3ee74 32 return temp;
noahzwiep 16:08d5e5a3ee74 33 }