Release candidate version. The pointer in GAS Pressure display is changed to a triangle.
Dependencies: UniGraphic mbed vt100
Please note, at 2-Mar-2018 the current version of mbed-lib has a defect in Ticker.
https://os.mbed.com/forum/bugs-suggestions/topic/29287/
So, mbed lib version 157 is intentionally being used.
Please do not update mbed library until the problem in the above URL is fixed.
In this version, format of GAS Pressure Display has been changed.
moto
edge_sensor/edge_pressure.h@0:774324cbc5a6, 2018-03-02 (annotated)
- Committer:
- Rhyme
- Date:
- Fri Mar 02 07:56:09 2018 +0000
- Revision:
- 0:774324cbc5a6
Release candidate version. GAS Pressure pointer is now a triangle.; Some source file clean-up was done.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:774324cbc5a6 | 1 | #ifndef _EDGE_PRESSURE_H_ |
Rhyme | 0:774324cbc5a6 | 2 | #define _EDGE_PRESSURE_H_ |
Rhyme | 0:774324cbc5a6 | 3 | #include "mbed.h" |
Rhyme | 0:774324cbc5a6 | 4 | #include "edge_sensor.h" |
Rhyme | 0:774324cbc5a6 | 5 | #include "PSE530.h" |
Rhyme | 0:774324cbc5a6 | 6 | |
Rhyme | 0:774324cbc5a6 | 7 | /** |
Rhyme | 0:774324cbc5a6 | 8 | * edge_pressure edge_sensor for measuring gas presssure |
Rhyme | 0:774324cbc5a6 | 9 | */ |
Rhyme | 0:774324cbc5a6 | 10 | |
Rhyme | 0:774324cbc5a6 | 11 | class edge_pressure : public edge_sensor { |
Rhyme | 0:774324cbc5a6 | 12 | public: |
Rhyme | 0:774324cbc5a6 | 13 | /** |
Rhyme | 0:774324cbc5a6 | 14 | * constructor |
Rhyme | 0:774324cbc5a6 | 15 | * @param *pse PSE530 pressure sensor object |
Rhyme | 0:774324cbc5a6 | 16 | */ |
Rhyme | 0:774324cbc5a6 | 17 | edge_pressure(PSE530 *pse, DigitalOut *en) ; |
Rhyme | 0:774324cbc5a6 | 18 | |
Rhyme | 0:774324cbc5a6 | 19 | /** |
Rhyme | 0:774324cbc5a6 | 20 | * destructor |
Rhyme | 0:774324cbc5a6 | 21 | */ |
Rhyme | 0:774324cbc5a6 | 22 | ~edge_pressure(void) ; |
Rhyme | 0:774324cbc5a6 | 23 | |
Rhyme | 0:774324cbc5a6 | 24 | /** |
Rhyme | 0:774324cbc5a6 | 25 | * reset and clear internal values |
Rhyme | 0:774324cbc5a6 | 26 | */ |
Rhyme | 0:774324cbc5a6 | 27 | virtual void reset(void) ; |
Rhyme | 0:774324cbc5a6 | 28 | |
Rhyme | 0:774324cbc5a6 | 29 | /** |
Rhyme | 0:774324cbc5a6 | 30 | * prepare for sampling (not used) |
Rhyme | 0:774324cbc5a6 | 31 | */ |
Rhyme | 0:774324cbc5a6 | 32 | virtual void prepare(void) ; |
Rhyme | 0:774324cbc5a6 | 33 | |
Rhyme | 0:774324cbc5a6 | 34 | /** |
Rhyme | 0:774324cbc5a6 | 35 | * sample the value |
Rhyme | 0:774324cbc5a6 | 36 | * @returns 0: success non-0: failure |
Rhyme | 0:774324cbc5a6 | 37 | */ |
Rhyme | 0:774324cbc5a6 | 38 | virtual int sample(void) ; |
Rhyme | 0:774324cbc5a6 | 39 | |
Rhyme | 0:774324cbc5a6 | 40 | /** |
Rhyme | 0:774324cbc5a6 | 41 | * deliver the sampled value to afero cloud |
Rhyme | 0:774324cbc5a6 | 42 | */ |
Rhyme | 0:774324cbc5a6 | 43 | virtual int deliver(void) ; |
Rhyme | 0:774324cbc5a6 | 44 | |
Rhyme | 0:774324cbc5a6 | 45 | /** |
Rhyme | 0:774324cbc5a6 | 46 | * show the value in the display (TFT) |
Rhyme | 0:774324cbc5a6 | 47 | */ |
Rhyme | 0:774324cbc5a6 | 48 | virtual void show(void) ; |
Rhyme | 0:774324cbc5a6 | 49 | // virtual void send_config(void) ; /* send config data to cloud */ |
Rhyme | 0:774324cbc5a6 | 50 | // virtual void recv_config(void) ; /* receive config data from cloud */ |
Rhyme | 0:774324cbc5a6 | 51 | |
Rhyme | 0:774324cbc5a6 | 52 | /** |
Rhyme | 0:774324cbc5a6 | 53 | * get_value sample sensor value and calcurate it to the metric value |
Rhyme | 0:774324cbc5a6 | 54 | * @returns measured value in kgf/cm2 |
Rhyme | 0:774324cbc5a6 | 55 | */ |
Rhyme | 0:774324cbc5a6 | 56 | float get_value(void) ; |
Rhyme | 0:774324cbc5a6 | 57 | |
Rhyme | 0:774324cbc5a6 | 58 | /** |
Rhyme | 0:774324cbc5a6 | 59 | * Set threshold mode |
Rhyme | 0:774324cbc5a6 | 60 | * @param mode int 0: absolute value 1: relative value in percent |
Rhyme | 0:774324cbc5a6 | 61 | */ |
Rhyme | 0:774324cbc5a6 | 62 | void set_thr_mode(int mode) { _thr_mode = mode ; } |
Rhyme | 0:774324cbc5a6 | 63 | |
Rhyme | 0:774324cbc5a6 | 64 | /** |
Rhyme | 0:774324cbc5a6 | 65 | * Get threshold mode |
Rhyme | 0:774324cbc5a6 | 66 | * @returns the mode 0: absolute value 1: relative value in percent |
Rhyme | 0:774324cbc5a6 | 67 | */ |
Rhyme | 0:774324cbc5a6 | 68 | int get_thr_mode(void) { return _thr_mode ; } |
Rhyme | 0:774324cbc5a6 | 69 | |
Rhyme | 0:774324cbc5a6 | 70 | /** |
Rhyme | 0:774324cbc5a6 | 71 | * Set higher threshold |
Rhyme | 0:774324cbc5a6 | 72 | * @param thr_high int16_t the higher threshold |
Rhyme | 0:774324cbc5a6 | 73 | */ |
Rhyme | 0:774324cbc5a6 | 74 | void set_thr_high(int16_t thr_high) ; |
Rhyme | 0:774324cbc5a6 | 75 | |
Rhyme | 0:774324cbc5a6 | 76 | /** |
Rhyme | 0:774324cbc5a6 | 77 | * Get higher threshold, the value is calcurated with expected value |
Rhyme | 0:774324cbc5a6 | 78 | * @param expected float the expected pressure value for current temperature |
Rhyme | 0:774324cbc5a6 | 79 | */ |
Rhyme | 0:774324cbc5a6 | 80 | float get_thr_high(float expected) ; |
Rhyme | 0:774324cbc5a6 | 81 | |
Rhyme | 0:774324cbc5a6 | 82 | /** |
Rhyme | 0:774324cbc5a6 | 83 | * Set lower threshold |
Rhyme | 0:774324cbc5a6 | 84 | * @param thr_low int16_t the lower threshold |
Rhyme | 0:774324cbc5a6 | 85 | */ |
Rhyme | 0:774324cbc5a6 | 86 | void set_thr_low(int16_t thr_low) ; |
Rhyme | 0:774324cbc5a6 | 87 | |
Rhyme | 0:774324cbc5a6 | 88 | /** |
Rhyme | 0:774324cbc5a6 | 89 | * Get lower threshold, the value is calcurated with expected value |
Rhyme | 0:774324cbc5a6 | 90 | * @param expected float the expected pressure value for current temperature |
Rhyme | 0:774324cbc5a6 | 91 | */ |
Rhyme | 0:774324cbc5a6 | 92 | float get_thr_low(float expected) ; |
Rhyme | 0:774324cbc5a6 | 93 | |
Rhyme | 0:774324cbc5a6 | 94 | /** |
Rhyme | 0:774324cbc5a6 | 95 | * draw triangle pointer for GAS pressure mode display |
Rhyme | 0:774324cbc5a6 | 96 | */ |
Rhyme | 0:774324cbc5a6 | 97 | |
Rhyme | 0:774324cbc5a6 | 98 | void drawPointer(int c) ; |
Rhyme | 0:774324cbc5a6 | 99 | |
Rhyme | 0:774324cbc5a6 | 100 | private: |
Rhyme | 0:774324cbc5a6 | 101 | PSE530 *_pse ; |
Rhyme | 0:774324cbc5a6 | 102 | DigitalOut *_en ; |
Rhyme | 0:774324cbc5a6 | 103 | float _value ; |
Rhyme | 0:774324cbc5a6 | 104 | float _thr_high ; |
Rhyme | 0:774324cbc5a6 | 105 | float _thr_low ; |
Rhyme | 0:774324cbc5a6 | 106 | int _thr_mode ; |
Rhyme | 0:774324cbc5a6 | 107 | float _expected ; |
Rhyme | 0:774324cbc5a6 | 108 | float _higher ; |
Rhyme | 0:774324cbc5a6 | 109 | float _lower ; |
Rhyme | 0:774324cbc5a6 | 110 | } ; |
Rhyme | 0:774324cbc5a6 | 111 | |
Rhyme | 0:774324cbc5a6 | 112 | float temp2expected(float temp) ; |
Rhyme | 0:774324cbc5a6 | 113 | extern float *current_temp ; |
Rhyme | 0:774324cbc5a6 | 114 | |
Rhyme | 0:774324cbc5a6 | 115 | #endif /* _EDGE_PRESSURE_H_ */ |