Guillaume Fricker / Mbed 2 deprecated Menu

Dependencies:   KS0108_PCF8574 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers menbedMenuParam.h Source File

menbedMenuParam.h

00001 #ifndef _MENBEDMENUPARAM_H_
00002 #define _MENBEDMENUPARAM_H_
00003 
00004 class MenbedMenuParam {
00005 public:
00006     // Copy of the initial value;
00007     float initVal;
00008     // Temporary copy of the parameter used to the hold the modified value
00009     // before it is committed.
00010     float tempVal;
00011     
00012     MenbedMenuParam (float (*initValFcn)(void), void (*finalValFcn)(float),
00013         bool liveUpdate, float min, float max,
00014         float inc);
00015         
00016     float getVal (void);
00017     void setVal (float v);
00018     bool liveUpdate (void) {return _liveUpdate;}
00019     float min (void) {return _min;}
00020     float max (void) {return _max;}
00021     float inc (void) {return _inc;}
00022             
00023 protected:
00024     // Pointer to a function returning a float containing the current value of
00025     // the parameter.
00026     float (*initValFcn)(void);
00027     // Pointer to a function taking a float that is called when the parameter
00028     // value is modified.
00029     void (*finalValFcn)(float);
00030     // Boolean indicating whether the finalValFcn should be called each time
00031     // the user makes a change to the variable or whether it should only be
00032     // called once the user confirms the change.
00033     bool _liveUpdate;
00034     // Minimum allowable value.
00035     float _min;
00036     // Maximum allowable value.
00037     float _max;
00038     // Amount by which to increment/decrement the parameter with each presses of
00039     // the up/down button.
00040     float _inc;
00041 };
00042 
00043 #endif /* _MENBEDMENUPARAM_H_ */