Lucas Borges
/
MenuLCD_Copy
this locks like shit
Fork of MenuLCD_copy by
menbed/include/menbedMenuParam.h@0:92357d1220f3, 2017-05-19 (annotated)
- Committer:
- ViniR
- Date:
- Fri May 19 13:07:52 2017 +0000
- Revision:
- 0:92357d1220f3
Ent?o PARA...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ViniR | 0:92357d1220f3 | 1 | #ifndef _MENBEDMENUPARAM_H_ |
ViniR | 0:92357d1220f3 | 2 | #define _MENBEDMENUPARAM_H_ |
ViniR | 0:92357d1220f3 | 3 | #include <string> |
ViniR | 0:92357d1220f3 | 4 | class MenbedMenuParam { |
ViniR | 0:92357d1220f3 | 5 | public: |
ViniR | 0:92357d1220f3 | 6 | // Copy of the initial value; |
ViniR | 0:92357d1220f3 | 7 | float initVal; |
ViniR | 0:92357d1220f3 | 8 | string initValString; |
ViniR | 0:92357d1220f3 | 9 | // Temporary copy of the parameter used to the hold the modified value |
ViniR | 0:92357d1220f3 | 10 | // before it is committed. |
ViniR | 0:92357d1220f3 | 11 | float tempVal; |
ViniR | 0:92357d1220f3 | 12 | |
ViniR | 0:92357d1220f3 | 13 | MenbedMenuParam (float (*initValFcn)(void), void (*finalValFcn)(float), |
ViniR | 0:92357d1220f3 | 14 | bool liveUpdate, float min, float max, |
ViniR | 0:92357d1220f3 | 15 | float inc); |
ViniR | 0:92357d1220f3 | 16 | |
ViniR | 0:92357d1220f3 | 17 | float getVal (void); |
ViniR | 0:92357d1220f3 | 18 | void setVal (float v); |
ViniR | 0:92357d1220f3 | 19 | bool liveUpdate (void) {return _liveUpdate;} |
ViniR | 0:92357d1220f3 | 20 | float min (void) {return _min;} |
ViniR | 0:92357d1220f3 | 21 | float max (void) {return _max;} |
ViniR | 0:92357d1220f3 | 22 | float inc (void) {return _inc;} |
ViniR | 0:92357d1220f3 | 23 | |
ViniR | 0:92357d1220f3 | 24 | protected: |
ViniR | 0:92357d1220f3 | 25 | // Pointer to a function returning a float containing the current value of |
ViniR | 0:92357d1220f3 | 26 | // the parameter. |
ViniR | 0:92357d1220f3 | 27 | float (*initValFcn)(void); |
ViniR | 0:92357d1220f3 | 28 | // Pointer to a function taking a float that is called when the parameter |
ViniR | 0:92357d1220f3 | 29 | // value is modified. |
ViniR | 0:92357d1220f3 | 30 | string (*initValStringFcn)(void); |
ViniR | 0:92357d1220f3 | 31 | // Pointer to a function taking a float that is called when the parameter |
ViniR | 0:92357d1220f3 | 32 | // value is modified. |
ViniR | 0:92357d1220f3 | 33 | void (*finalValFcn)(float); |
ViniR | 0:92357d1220f3 | 34 | // Boolean indicating whether the finalValFcn should be called each time |
ViniR | 0:92357d1220f3 | 35 | // the user makes a change to the variable or whether it should only be |
ViniR | 0:92357d1220f3 | 36 | // called once the user confirms the change. |
ViniR | 0:92357d1220f3 | 37 | void (*finalValStringFcn)(string); |
ViniR | 0:92357d1220f3 | 38 | // Boolean indicating whether the finalValFcn should be called each time |
ViniR | 0:92357d1220f3 | 39 | // the user makes a change to the variable or whether it should only be |
ViniR | 0:92357d1220f3 | 40 | // called once the user confirms the change. |
ViniR | 0:92357d1220f3 | 41 | bool _liveUpdate; |
ViniR | 0:92357d1220f3 | 42 | // Minimum allowable value. |
ViniR | 0:92357d1220f3 | 43 | float _min; |
ViniR | 0:92357d1220f3 | 44 | // Maximum allowable value. |
ViniR | 0:92357d1220f3 | 45 | float _max; |
ViniR | 0:92357d1220f3 | 46 | // Amount by which to increment/decrement the parameter with each presses of |
ViniR | 0:92357d1220f3 | 47 | // the up/down button. |
ViniR | 0:92357d1220f3 | 48 | float _inc; |
ViniR | 0:92357d1220f3 | 49 | }; |
ViniR | 0:92357d1220f3 | 50 | |
ViniR | 0:92357d1220f3 | 51 | #endif /* _MENBEDMENUPARAM_H_ */ |