Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Revision:
0:826c6171fc1b
diff -r 000000000000 -r 826c6171fc1b UI/Menu/Menu.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/Menu/Menu.h	Wed Jun 20 14:57:48 2012 +0000
@@ -0,0 +1,49 @@
+#define _ITEM_MAX 10
+#define NAMESIZ 20
+
+typedef int (*FunctionPtr)();
+
+/** Simple menu interface model
+ */
+class Menu {
+public:
+
+    /** Create a new menu model
+     */
+    Menu();
+    
+    /** add a new menu item
+     */
+    void add(char *name, FunctionPtr f);
+    
+    /** select the next menu item as the current item
+     */
+    void next(void);
+    
+    /** select the previous menu item as the current item
+     */
+    void prev(void);
+    
+    /** run the function associated with the current item
+     */
+    void select(void);
+    
+    /** return the text for the current item
+     */
+    char *getItemName(void);
+
+    /** return text for a specified item
+     */
+    char *getItemName(int i);
+    
+    /** print all the menu items
+     */
+    void printAll(void);
+    
+private:
+    short _item;
+    short _itemCount;
+    char _name[_ITEM_MAX][NAMESIZ];
+    FunctionPtr _exec[_ITEM_MAX];
+};
+