![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Breath
Fork of Breath by
windSensor.h@1:86d9b36d9132, 2016-12-01 (annotated)
- Committer:
- jamesmsong
- Date:
- Thu Dec 01 03:04:38 2016 +0000
- Revision:
- 1:86d9b36d9132
- Parent:
- 0:397523d4133e
Breath
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
otis22894 | 0:397523d4133e | 1 | #include "mbed.h" |
jamesmsong | 1:86d9b36d9132 | 2 | #include "MPL3115.h" |
otis22894 | 0:397523d4133e | 3 | #include "NeoStrip.h" |
otis22894 | 0:397523d4133e | 4 | #include <vector> |
otis22894 | 0:397523d4133e | 5 | |
otis22894 | 0:397523d4133e | 6 | class windSensor { |
otis22894 | 0:397523d4133e | 7 | public: |
jamesmsong | 1:86d9b36d9132 | 8 | windSensor(PinName p, NeoStrip *_strip, PinName p2, PinName p3, int addr); |
otis22894 | 0:397523d4133e | 9 | /* Start victim breath */ |
otis22894 | 0:397523d4133e | 10 | void sample(); |
otis22894 | 0:397523d4133e | 11 | void startReading(); |
otis22894 | 0:397523d4133e | 12 | void stopReading(); |
otis22894 | 0:397523d4133e | 13 | void reset(); |
otis22894 | 0:397523d4133e | 14 | bool breathDetected(); |
jamesmsong | 1:86d9b36d9132 | 15 | bool pressureSpike(); |
jamesmsong | 1:86d9b36d9132 | 16 | /* End victim breath */ |
otis22894 | 0:397523d4133e | 17 | |
otis22894 | 0:397523d4133e | 18 | /* start give breath */ |
otis22894 | 0:397523d4133e | 19 | float give_breath(void); |
otis22894 | 0:397523d4133e | 20 | /* end give breath */ |
otis22894 | 0:397523d4133e | 21 | |
jamesmsong | 1:86d9b36d9132 | 22 | |
otis22894 | 0:397523d4133e | 23 | private: |
otis22894 | 0:397523d4133e | 24 | /* start vicim breath */ |
otis22894 | 0:397523d4133e | 25 | AnalogIn sensor; |
otis22894 | 0:397523d4133e | 26 | Ticker breathReader; |
otis22894 | 0:397523d4133e | 27 | |
otis22894 | 0:397523d4133e | 28 | volatile float thresh; |
otis22894 | 0:397523d4133e | 29 | //volatile bool Breath = false; // set on each visit to interrupt routine |
otis22894 | 0:397523d4133e | 30 | volatile bool isBreathing; |
otis22894 | 0:397523d4133e | 31 | volatile int breathCount; //increment if breath is above thresh on each visit to interrupt routine |
otis22894 | 0:397523d4133e | 32 | /* end victim breath */ |
otis22894 | 0:397523d4133e | 33 | |
otis22894 | 0:397523d4133e | 34 | /* start give breath */ |
otis22894 | 0:397523d4133e | 35 | Timer t, q; |
otis22894 | 0:397523d4133e | 36 | vector<float> b; |
otis22894 | 0:397523d4133e | 37 | /* end give breath */ |
otis22894 | 0:397523d4133e | 38 | vector<float> c; |
otis22894 | 0:397523d4133e | 39 | NeoStrip *strip; |
jamesmsong | 1:86d9b36d9132 | 40 | MPL3115 barometer; |
jamesmsong | 1:86d9b36d9132 | 41 | |
jamesmsong | 1:86d9b36d9132 | 42 | bool spike; |
otis22894 | 0:397523d4133e | 43 | }; |