Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
menbedStructure.h
00001 #ifndef _MENBEDSTRUCTURE_H_ 00002 #define _MENBEDSTRUCTURE_H_ 00003 00004 #include "mbed.h" 00005 00006 struct menuParam; 00007 struct menuItem; 00008 struct menu; 00009 00010 typedef struct menuParam menuParam_t; 00011 typedef struct menuItem menuItem_t; 00012 typedef struct menu menu_t; 00013 00014 struct menuParam{ 00015 // Pointer to a function returning a float containing the current value of 00016 // the parameter. 00017 float (*initValFcn)(void); 00018 // Pointer to a function taking a float that is called when the parameter 00019 // value is modified. 00020 void (*finalValFcn)(float); 00021 // Copy of the initial value; 00022 float initVal; 00023 // Temporary copy of the parameter used to the hold the modified value 00024 // before it is committed. 00025 float tempVal; 00026 // Boolean indicating whether the finalValFcn should be called each time 00027 // the user makes a change to the variable or whether it should only be 00028 // called once the user confirms the change. 00029 bool liveUpdate; 00030 // Minimum allowable value. 00031 float min; 00032 // Maximum allowable value. 00033 float max; 00034 // Amount by which to increment/decrement the parameter with each presses of 00035 // the up/down button. 00036 float inc; 00037 }; 00038 00039 struct menuItem{ 00040 // Pointer to function that will be called when menu item selected. This 00041 // may be a null pointer if no function should be called. 00042 void (*selFcn)(); 00043 // New menu to display when item selected. This can be set to null if a 00044 // new menu item should not be called when the menu item is selected. 00045 menu_t *childMenu; 00046 // If true, childMenuIsAncestor indicates that the child menu's parent menu 00047 // should be set to null. This will prevent the user from moving to the 00048 // from the child menu back to the current menu. This is useful when the 00049 // menu item is something like "Goto root menu". Once the user is in the 00050 // root menu, we don't want the user to press and hold the select key or 00051 // press the cancel key in order to return to the current menu. 00052 bool childMenuIsAncestor; 00053 // Pointer a structure which itself points to a float that will be displayed 00054 // in place of the %f in the text of the menu item. If the param struct 00055 // has an inc memeber that is non-zero, the parameter can be modified by the 00056 // user. In particular, when the user selects this menu item, the parameter 00057 // is highlighted and the user can then use the up and down buttons to 00058 // modify its value. 00059 menuParam_t *param; 00060 // Array of char pointers to the strings that will be catenated to form 00061 // the text of the menu item. To insert either a menu parameter or state 00062 // variable into the menu item text, make one of the strings a printf-style 00063 // conversion specifier for a float. (Note: only floats are allowed, 00064 // integer are not.) The last string must be an empty string ("") to 00065 // indicate it is the last string in the array. If the empty string is 00066 // omitted, unpredictable behavior will result. 00067 char *text[]; 00068 }; 00069 00070 00071 #endif /* _MENBEDSTRUCTURE_H_ */
Generated on Thu Jul 14 2022 12:14:44 by
