4 errors
Dependencies: KS0108_PCF8574 mbed
menbed/include/menbedStructure.h@0:936f1c020120, 2012-09-05 (annotated)
- Committer:
- GuiTwo
- Date:
- Wed Sep 05 07:21:59 2012 +0000
- Revision:
- 0:936f1c020120
With KS0108;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GuiTwo | 0:936f1c020120 | 1 | #ifndef _MENBEDSTRUCTURE_H_ |
GuiTwo | 0:936f1c020120 | 2 | #define _MENBEDSTRUCTURE_H_ |
GuiTwo | 0:936f1c020120 | 3 | |
GuiTwo | 0:936f1c020120 | 4 | #include "mbed.h" |
GuiTwo | 0:936f1c020120 | 5 | |
GuiTwo | 0:936f1c020120 | 6 | struct menuParam; |
GuiTwo | 0:936f1c020120 | 7 | struct menuItem; |
GuiTwo | 0:936f1c020120 | 8 | struct menu; |
GuiTwo | 0:936f1c020120 | 9 | |
GuiTwo | 0:936f1c020120 | 10 | typedef struct menuParam menuParam_t; |
GuiTwo | 0:936f1c020120 | 11 | typedef struct menuItem menuItem_t; |
GuiTwo | 0:936f1c020120 | 12 | typedef struct menu menu_t; |
GuiTwo | 0:936f1c020120 | 13 | |
GuiTwo | 0:936f1c020120 | 14 | struct menuParam{ |
GuiTwo | 0:936f1c020120 | 15 | // Pointer to a function returning a float containing the current value of |
GuiTwo | 0:936f1c020120 | 16 | // the parameter. |
GuiTwo | 0:936f1c020120 | 17 | float (*initValFcn)(void); |
GuiTwo | 0:936f1c020120 | 18 | // Pointer to a function taking a float that is called when the parameter |
GuiTwo | 0:936f1c020120 | 19 | // value is modified. |
GuiTwo | 0:936f1c020120 | 20 | void (*finalValFcn)(float); |
GuiTwo | 0:936f1c020120 | 21 | // Copy of the initial value; |
GuiTwo | 0:936f1c020120 | 22 | float initVal; |
GuiTwo | 0:936f1c020120 | 23 | // Temporary copy of the parameter used to the hold the modified value |
GuiTwo | 0:936f1c020120 | 24 | // before it is committed. |
GuiTwo | 0:936f1c020120 | 25 | float tempVal; |
GuiTwo | 0:936f1c020120 | 26 | // Boolean indicating whether the finalValFcn should be called each time |
GuiTwo | 0:936f1c020120 | 27 | // the user makes a change to the variable or whether it should only be |
GuiTwo | 0:936f1c020120 | 28 | // called once the user confirms the change. |
GuiTwo | 0:936f1c020120 | 29 | bool liveUpdate; |
GuiTwo | 0:936f1c020120 | 30 | // Minimum allowable value. |
GuiTwo | 0:936f1c020120 | 31 | float min; |
GuiTwo | 0:936f1c020120 | 32 | // Maximum allowable value. |
GuiTwo | 0:936f1c020120 | 33 | float max; |
GuiTwo | 0:936f1c020120 | 34 | // Amount by which to increment/decrement the parameter with each presses of |
GuiTwo | 0:936f1c020120 | 35 | // the up/down button. |
GuiTwo | 0:936f1c020120 | 36 | float inc; |
GuiTwo | 0:936f1c020120 | 37 | }; |
GuiTwo | 0:936f1c020120 | 38 | |
GuiTwo | 0:936f1c020120 | 39 | struct menuItem{ |
GuiTwo | 0:936f1c020120 | 40 | // Pointer to function that will be called when menu item selected. This |
GuiTwo | 0:936f1c020120 | 41 | // may be a null pointer if no function should be called. |
GuiTwo | 0:936f1c020120 | 42 | void (*selFcn)(); |
GuiTwo | 0:936f1c020120 | 43 | // New menu to display when item selected. This can be set to null if a |
GuiTwo | 0:936f1c020120 | 44 | // new menu item should not be called when the menu item is selected. |
GuiTwo | 0:936f1c020120 | 45 | menu_t *childMenu; |
GuiTwo | 0:936f1c020120 | 46 | // If true, childMenuIsAncestor indicates that the child menu's parent menu |
GuiTwo | 0:936f1c020120 | 47 | // should be set to null. This will prevent the user from moving to the |
GuiTwo | 0:936f1c020120 | 48 | // from the child menu back to the current menu. This is useful when the |
GuiTwo | 0:936f1c020120 | 49 | // menu item is something like "Goto root menu". Once the user is in the |
GuiTwo | 0:936f1c020120 | 50 | // root menu, we don't want the user to press and hold the select key or |
GuiTwo | 0:936f1c020120 | 51 | // press the cancel key in order to return to the current menu. |
GuiTwo | 0:936f1c020120 | 52 | bool childMenuIsAncestor; |
GuiTwo | 0:936f1c020120 | 53 | // Pointer a structure which itself points to a float that will be displayed |
GuiTwo | 0:936f1c020120 | 54 | // in place of the %f in the text of the menu item. If the param struct |
GuiTwo | 0:936f1c020120 | 55 | // has an inc memeber that is non-zero, the parameter can be modified by the |
GuiTwo | 0:936f1c020120 | 56 | // user. In particular, when the user selects this menu item, the parameter |
GuiTwo | 0:936f1c020120 | 57 | // is highlighted and the user can then use the up and down buttons to |
GuiTwo | 0:936f1c020120 | 58 | // modify its value. |
GuiTwo | 0:936f1c020120 | 59 | menuParam_t *param; |
GuiTwo | 0:936f1c020120 | 60 | // Array of char pointers to the strings that will be catenated to form |
GuiTwo | 0:936f1c020120 | 61 | // the text of the menu item. To insert either a menu parameter or state |
GuiTwo | 0:936f1c020120 | 62 | // variable into the menu item text, make one of the strings a printf-style |
GuiTwo | 0:936f1c020120 | 63 | // conversion specifier for a float. (Note: only floats are allowed, |
GuiTwo | 0:936f1c020120 | 64 | // integer are not.) The last string must be an empty string ("") to |
GuiTwo | 0:936f1c020120 | 65 | // indicate it is the last string in the array. If the empty string is |
GuiTwo | 0:936f1c020120 | 66 | // omitted, unpredictable behavior will result. |
GuiTwo | 0:936f1c020120 | 67 | char *text[]; |
GuiTwo | 0:936f1c020120 | 68 | }; |
GuiTwo | 0:936f1c020120 | 69 | |
GuiTwo | 0:936f1c020120 | 70 | |
GuiTwo | 0:936f1c020120 | 71 | #endif /* _MENBEDSTRUCTURE_H_ */ |