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_PRESSURE_H_
Rhyme 0:37c8ecde13c2 2 #define _EDGE_PRESSURE_H_
Rhyme 0:37c8ecde13c2 3 #include "mbed.h"
Rhyme 0:37c8ecde13c2 4 #include "edge_sensor.h"
Rhyme 0:37c8ecde13c2 5 #include "PSE530.h"
Rhyme 0:37c8ecde13c2 6
Rhyme 0:37c8ecde13c2 7 /**
Rhyme 0:37c8ecde13c2 8 * edge_pressure edge_sensor for measuring gas presssure
Rhyme 0:37c8ecde13c2 9 */
Rhyme 0:37c8ecde13c2 10
Rhyme 0:37c8ecde13c2 11 class edge_pressure : public edge_sensor {
Rhyme 0:37c8ecde13c2 12 public:
Rhyme 0:37c8ecde13c2 13 /**
Rhyme 0:37c8ecde13c2 14 * constructor
Rhyme 0:37c8ecde13c2 15 * @param *pse PSE530 pressure sensor object
Rhyme 0:37c8ecde13c2 16 */
Rhyme 0:37c8ecde13c2 17 edge_pressure(PSE530 *pse, DigitalOut *en) ;
Rhyme 0:37c8ecde13c2 18
Rhyme 0:37c8ecde13c2 19 /**
Rhyme 0:37c8ecde13c2 20 * destructor
Rhyme 0:37c8ecde13c2 21 */
Rhyme 0:37c8ecde13c2 22 ~edge_pressure(void) ;
Rhyme 0:37c8ecde13c2 23
Rhyme 0:37c8ecde13c2 24 /**
Rhyme 0:37c8ecde13c2 25 * reset and clear internal values
Rhyme 0:37c8ecde13c2 26 */
Rhyme 0:37c8ecde13c2 27 virtual void reset(void) ;
Rhyme 0:37c8ecde13c2 28
Rhyme 0:37c8ecde13c2 29 /**
Rhyme 0:37c8ecde13c2 30 * prepare for sampling (not used)
Rhyme 0:37c8ecde13c2 31 */
Rhyme 0:37c8ecde13c2 32 virtual void prepare(void) ;
Rhyme 0:37c8ecde13c2 33
Rhyme 0:37c8ecde13c2 34 /**
Rhyme 0:37c8ecde13c2 35 * sample the value
Rhyme 0:37c8ecde13c2 36 * @returns 0: success non-0: failure
Rhyme 0:37c8ecde13c2 37 */
Rhyme 0:37c8ecde13c2 38 virtual int sample(void) ;
Rhyme 0:37c8ecde13c2 39
Rhyme 0:37c8ecde13c2 40 /**
Rhyme 0:37c8ecde13c2 41 * deliver the sampled value to afero cloud
Rhyme 0:37c8ecde13c2 42 */
Rhyme 0:37c8ecde13c2 43 virtual int deliver(void) ;
Rhyme 0:37c8ecde13c2 44
Rhyme 0:37c8ecde13c2 45 /**
Rhyme 0:37c8ecde13c2 46 * show the value in the display (TFT)
Rhyme 0:37c8ecde13c2 47 */
Rhyme 0:37c8ecde13c2 48 virtual void show(void) ;
Rhyme 0:37c8ecde13c2 49 // virtual void send_config(void) ; /* send config data to cloud */
Rhyme 0:37c8ecde13c2 50 // virtual void recv_config(void) ; /* receive config data from cloud */
Rhyme 0:37c8ecde13c2 51
Rhyme 0:37c8ecde13c2 52 /**
Rhyme 0:37c8ecde13c2 53 * get_value sample sensor value and calcurate it to the metric value
Rhyme 0:37c8ecde13c2 54 * @returns measured value in kgf/cm2
Rhyme 0:37c8ecde13c2 55 */
Rhyme 0:37c8ecde13c2 56 float get_value(void) ;
Rhyme 0:37c8ecde13c2 57
Rhyme 0:37c8ecde13c2 58 /**
Rhyme 0:37c8ecde13c2 59 * Set threshold mode
Rhyme 0:37c8ecde13c2 60 * @param mode int 0: absolute value 1: relative value in percent
Rhyme 0:37c8ecde13c2 61 */
Rhyme 0:37c8ecde13c2 62 void set_thr_mode(int mode) { _thr_mode = mode ; }
Rhyme 0:37c8ecde13c2 63
Rhyme 0:37c8ecde13c2 64 /**
Rhyme 0:37c8ecde13c2 65 * Get threshold mode
Rhyme 0:37c8ecde13c2 66 * @returns the mode 0: absolute value 1: relative value in percent
Rhyme 0:37c8ecde13c2 67 */
Rhyme 0:37c8ecde13c2 68 int get_thr_mode(void) { return _thr_mode ; }
Rhyme 0:37c8ecde13c2 69
Rhyme 0:37c8ecde13c2 70 /**
Rhyme 0:37c8ecde13c2 71 * Set higher threshold
Rhyme 0:37c8ecde13c2 72 * @param thr_high int16_t the higher threshold
Rhyme 0:37c8ecde13c2 73 */
Rhyme 0:37c8ecde13c2 74 void set_thr_high(int16_t thr_high) ;
Rhyme 0:37c8ecde13c2 75
Rhyme 0:37c8ecde13c2 76 /**
Rhyme 0:37c8ecde13c2 77 * Get higher threshold, the value is calcurated with expected value
Rhyme 0:37c8ecde13c2 78 * @param expected float the expected pressure value for current temperature
Rhyme 0:37c8ecde13c2 79 */
Rhyme 0:37c8ecde13c2 80 float get_thr_high(float expected) ;
Rhyme 0:37c8ecde13c2 81
Rhyme 0:37c8ecde13c2 82 /**
Rhyme 0:37c8ecde13c2 83 * Set lower threshold
Rhyme 0:37c8ecde13c2 84 * @param thr_low int16_t the lower threshold
Rhyme 0:37c8ecde13c2 85 */
Rhyme 0:37c8ecde13c2 86 void set_thr_low(int16_t thr_low) ;
Rhyme 0:37c8ecde13c2 87
Rhyme 0:37c8ecde13c2 88 /**
Rhyme 0:37c8ecde13c2 89 * Get lower threshold, the value is calcurated with expected value
Rhyme 0:37c8ecde13c2 90 * @param expected float the expected pressure value for current temperature
Rhyme 0:37c8ecde13c2 91 */
Rhyme 0:37c8ecde13c2 92 float get_thr_low(float expected) ;
Rhyme 0:37c8ecde13c2 93
Rhyme 0:37c8ecde13c2 94 private:
Rhyme 0:37c8ecde13c2 95 PSE530 *_pse ;
Rhyme 0:37c8ecde13c2 96 DigitalOut *_en ;
Rhyme 0:37c8ecde13c2 97 float _value ;
Rhyme 0:37c8ecde13c2 98 float _thr_high ;
Rhyme 0:37c8ecde13c2 99 float _thr_low ;
Rhyme 0:37c8ecde13c2 100 int _thr_mode ;
Rhyme 0:37c8ecde13c2 101 float _expected ;
Rhyme 0:37c8ecde13c2 102 float _higher ;
Rhyme 0:37c8ecde13c2 103 float _lower ;
Rhyme 0:37c8ecde13c2 104 } ;
Rhyme 0:37c8ecde13c2 105
Rhyme 0:37c8ecde13c2 106 float temp2expected(float temp) ;
Rhyme 0:37c8ecde13c2 107 extern float *current_temp ;
Rhyme 0:37c8ecde13c2 108
Rhyme 0:37c8ecde13c2 109 #endif /* _EDGE_PRESSURE_H_ */