Breath

Dependencies:   NeoStrip mbed

Fork of Breath by Ryan Williams

windSensor.h

Committer:
jamesmsong
Date:
2016-12-01
Revision:
1:86d9b36d9132
Parent:
0:397523d4133e

File content as of revision 1:86d9b36d9132:

#include "mbed.h"
#include "MPL3115.h"
#include "NeoStrip.h"
#include <vector>

class windSensor {
public:
    windSensor(PinName p, NeoStrip *_strip, PinName p2, PinName p3, int addr);
    /* Start victim breath */
    void sample();
    void startReading();
    void stopReading();
    void reset();
    bool breathDetected();
    bool pressureSpike();
    /* End victim breath */
    
    /* start give breath */
    float give_breath(void);
    /* end give breath */
    
    
private:
    /* start vicim breath */
    AnalogIn sensor;
    Ticker breathReader;

    volatile float thresh;
    //volatile bool Breath = false;     // set on each visit to interrupt routine
    volatile bool isBreathing;
    volatile int breathCount; //increment if breath is above thresh on each visit to interrupt routine
    /* end victim breath */
    
    /* start give breath */
    Timer t, q;
    vector<float> b;
    /* end give breath */
    vector<float> c;
    NeoStrip *strip;
    MPL3115 barometer; 
          
    bool spike;
};