Gas Pressure Display Updated Power control for Pressure sensor added

Dependencies:   UniGraphic mbed vt100

Committer:
Rhyme
Date:
Fri Feb 16 08:27:50 2018 +0000
Revision:
0:37c8ecde13c2
control PSE530 power via PTC5 (pse530_en)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:37c8ecde13c2 1 #ifndef _EDGE_ACCEL_H_
Rhyme 0:37c8ecde13c2 2 #define _EDGE_ACCEL_H_
Rhyme 0:37c8ecde13c2 3 #include "mbed.h"
Rhyme 0:37c8ecde13c2 4 #include "edge_sensor.h"
Rhyme 0:37c8ecde13c2 5 #include "MMA8451Q.h"
Rhyme 0:37c8ecde13c2 6
Rhyme 0:37c8ecde13c2 7 /**
Rhyme 0:37c8ecde13c2 8 * edge_accel edge_sensor which manage the accelerometer sensor (MMA8451Q)
Rhyme 0:37c8ecde13c2 9 * @note The behavior of this class is somewhat exceptional as an edge_sensor
Rhyme 0:37c8ecde13c2 10 * @note it samples and accumulates data which is the abs sum of current
Rhyme 0:37c8ecde13c2 11 * @note values and previous values every 0.1 sec
Rhyme 0:37c8ecde13c2 12 * @note and in each "interval" it delivers the averaged value
Rhyme 0:37c8ecde13c2 13 */
Rhyme 0:37c8ecde13c2 14
Rhyme 0:37c8ecde13c2 15 class edge_accel : public edge_sensor {
Rhyme 0:37c8ecde13c2 16 public:
Rhyme 0:37c8ecde13c2 17 /**
Rhyme 0:37c8ecde13c2 18 * constructor
Rhyme 0:37c8ecde13c2 19 * @param the MMA8451Q object
Rhyme 0:37c8ecde13c2 20 */
Rhyme 0:37c8ecde13c2 21 edge_accel(MMA8451Q *accel) ;
Rhyme 0:37c8ecde13c2 22
Rhyme 0:37c8ecde13c2 23 /**
Rhyme 0:37c8ecde13c2 24 * destructor
Rhyme 0:37c8ecde13c2 25 */
Rhyme 0:37c8ecde13c2 26 ~edge_accel(void) ;
Rhyme 0:37c8ecde13c2 27
Rhyme 0:37c8ecde13c2 28 /**
Rhyme 0:37c8ecde13c2 29 * clear and reset interval values
Rhyme 0:37c8ecde13c2 30 */
Rhyme 0:37c8ecde13c2 31 virtual void reset(void) ;
Rhyme 0:37c8ecde13c2 32 // virtual void prepare(void) ;
Rhyme 0:37c8ecde13c2 33
Rhyme 0:37c8ecde13c2 34 /**
Rhyme 0:37c8ecde13c2 35 * sample calculate the average value
Rhyme 0:37c8ecde13c2 36 * from _accumulation and _sample_count
Rhyme 0:37c8ecde13c2 37 * the average value is assigned to _value
Rhyme 0:37c8ecde13c2 38 * and currnt _sample_count is stored in _num_sampled
Rhyme 0:37c8ecde13c2 39 * then both _accumuation and _sample_count will be cleared
Rhyme 0:37c8ecde13c2 40 * @returns 0: success non-0: failure
Rhyme 0:37c8ecde13c2 41 */
Rhyme 0:37c8ecde13c2 42 virtual int sample(void) ;
Rhyme 0:37c8ecde13c2 43
Rhyme 0:37c8ecde13c2 44 /**
Rhyme 0:37c8ecde13c2 45 * deliver the value to the afero cloud
Rhyme 0:37c8ecde13c2 46 */
Rhyme 0:37c8ecde13c2 47 virtual int deliver(void) ;
Rhyme 0:37c8ecde13c2 48
Rhyme 0:37c8ecde13c2 49 /**
Rhyme 0:37c8ecde13c2 50 * show the data in the display (TFT)
Rhyme 0:37c8ecde13c2 51 */
Rhyme 0:37c8ecde13c2 52 virtual void show(void) ;
Rhyme 0:37c8ecde13c2 53
Rhyme 0:37c8ecde13c2 54 /**
Rhyme 0:37c8ecde13c2 55 * accum this is the real sampling
Rhyme 0:37c8ecde13c2 56 * and the differences of sampled values
Rhyme 0:37c8ecde13c2 57 * and previous values are calcurated and accumulated
Rhyme 0:37c8ecde13c2 58 * @returns 0: success non-0: failure
Rhyme 0:37c8ecde13c2 59 */
Rhyme 0:37c8ecde13c2 60 int accum(void) ;
Rhyme 0:37c8ecde13c2 61
Rhyme 0:37c8ecde13c2 62 /**
Rhyme 0:37c8ecde13c2 63 * Clear internal values
Rhyme 0:37c8ecde13c2 64 */
Rhyme 0:37c8ecde13c2 65 void clear_value(void) ;
Rhyme 0:37c8ecde13c2 66
Rhyme 0:37c8ecde13c2 67 private:
Rhyme 0:37c8ecde13c2 68 MMA8451Q *_accel ;
Rhyme 0:37c8ecde13c2 69 float _value ;
Rhyme 0:37c8ecde13c2 70 int32_t _num_sampled ;
Rhyme 0:37c8ecde13c2 71 int32_t _sample_count ;
Rhyme 0:37c8ecde13c2 72 int32_t _accumulation ;
Rhyme 0:37c8ecde13c2 73 int16_t _prev_x ;
Rhyme 0:37c8ecde13c2 74 int16_t _prev_y ;
Rhyme 0:37c8ecde13c2 75 int16_t _prev_z ;
Rhyme 0:37c8ecde13c2 76 } ;
Rhyme 0:37c8ecde13c2 77
Rhyme 0:37c8ecde13c2 78 #endif /* _EDGE_ACCEL_H_ */