this locks like shit

Dependencies:   MenuLCD mbed

Fork of MenuLCD_copy by Vinícius Alves

Committer:
ViniR
Date:
Fri May 19 13:07:52 2017 +0000
Revision:
0:92357d1220f3
Ent?o PARA...

Who changed what in which revision?

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