Pacemaker code Implementation for SFWRENG 3K04
Dependencies: mbed Queue mbed-rtos FXOS8700Q
Fork of Pacemaker by
SWFRENG 3K04 Project to design, develop, and document a functional pacemaker.
The project uses the Freescale K64F Microcontroller and C++ mbed library.
dataStruct.cpp@31:5e55042e025a, 2016-11-29 (annotated)
- Committer:
- trane3
- Date:
- Tue Nov 29 22:01:54 2016 +0000
- Revision:
- 31:5e55042e025a
- Parent:
- 29:c0d63940b0c7
dedicated wam
Who changed what in which revision?
User | Revision | Line number | New 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 | 29:c0d63940b0c7 | 6 | dataStruct::dataStruct(hardware* hWare): myQueue(1,N){//,thread(&dataStruct::threadStarter){ |
noahzwiep | 16:08d5e5a3ee74 | 7 | myHardware = hWare; |
FiveDollar | 28:4f36e100ccbe | 8 | // thread.signal_set(START_THREAD); |
noahzwiep | 16:08d5e5a3ee74 | 9 | } |
noahzwiep | 16:08d5e5a3ee74 | 10 | |
noahzwiep | 16:08d5e5a3ee74 | 11 | dataStruct::~dataStruct(){ |
noahzwiep | 16:08d5e5a3ee74 | 12 | } |
noahzwiep | 16:08d5e5a3ee74 | 13 | |
noahzwiep | 16:08d5e5a3ee74 | 14 | void dataStruct::threadStarter(void const *p){ |
noahzwiep | 16:08d5e5a3ee74 | 15 | dataStruct *instance = (dataStruct*)p; |
noahzwiep | 16:08d5e5a3ee74 | 16 | instance->storeData(); |
noahzwiep | 16:08d5e5a3ee74 | 17 | } |
noahzwiep | 16:08d5e5a3ee74 | 18 | |
noahzwiep | 16:08d5e5a3ee74 | 19 | void dataStruct::storeData(){ |
FiveDollar | 28:4f36e100ccbe | 20 | // thread.signal_wait(START_THREAD); |
noahzwiep | 16:08d5e5a3ee74 | 21 | while(true){ |
trane3 | 31:5e55042e025a | 22 | //streamValue = myHardware->getSense(); |
trane3 | 31:5e55042e025a | 23 | streamValue = 10; |
noahzwiep | 16:08d5e5a3ee74 | 24 | if(myQueue.GetNumberOfItems() <= N){ |
noahzwiep | 16:08d5e5a3ee74 | 25 | myQueue.Put(&streamValue); |
noahzwiep | 16:08d5e5a3ee74 | 26 | } |
noahzwiep | 16:08d5e5a3ee74 | 27 | Thread::wait(4); |
noahzwiep | 16:08d5e5a3ee74 | 28 | } |
noahzwiep | 16:08d5e5a3ee74 | 29 | } |
noahzwiep | 16:08d5e5a3ee74 | 30 | |
trane3 | 31:5e55042e025a | 31 | double dataStruct::getData(){ |
trane3 | 31:5e55042e025a | 32 | // queue temp = myQueue; |
trane3 | 31:5e55042e025a | 33 | // myQueue.Flush(); |
trane3 | 31:5e55042e025a | 34 | // return temp; |
trane3 | 31:5e55042e025a | 35 | return myHardware->getSense(); |
noahzwiep | 16:08d5e5a3ee74 | 36 | } |