From 7f06fa94a5d601e85ee929fd56a7e2f5ce0241ab Mon Sep 17 00:00:00 2001
From: Pat Hickey <pat@moreproductive.org>
Date: Thu, 18 Oct 2012 20:49:36 -0700
Subject: [PATCH] AP_Menu: create new library with menu from AP_Common

---
 libraries/AP_Common/AP_Common.h                           | 1 -
 libraries/{AP_Common/menu.cpp => AP_Menu/AP_Menu.cpp}     | 2 +-
 libraries/{AP_Common/include/menu.h => AP_Menu/AP_Menu.h} | 6 +++---
 libraries/AP_Menu/examples/menu/Makefile                  | 1 +
 libraries/{AP_Common => AP_Menu}/examples/menu/menu.pde   | 2 ++
 5 files changed, 7 insertions(+), 5 deletions(-)
 rename libraries/{AP_Common/menu.cpp => AP_Menu/AP_Menu.cpp} (99%)
 rename libraries/{AP_Common/include/menu.h => AP_Menu/AP_Menu.h} (98%)
 create mode 100644 libraries/AP_Menu/examples/menu/Makefile
 rename libraries/{AP_Common => AP_Menu}/examples/menu/menu.pde (94%)

diff --git a/libraries/AP_Common/AP_Common.h b/libraries/AP_Common/AP_Common.h
index 98cb5bd61..0cfdbc3da 100644
--- a/libraries/AP_Common/AP_Common.h
+++ b/libraries/AP_Common/AP_Common.h
@@ -34,7 +34,6 @@ typedef struct {
 } prog_char_t;
 
 #include <stdint.h>
-#include "include/menu.h"               /// simple menu subsystem
 #include "c++.h" // c++ additions
 //#include "AP_Vector.h"
 //#include "AP_Loop.h"
diff --git a/libraries/AP_Common/menu.cpp b/libraries/AP_Menu/AP_Menu.cpp
similarity index 99%
rename from libraries/AP_Common/menu.cpp
rename to libraries/AP_Menu/AP_Menu.cpp
index 784dd6064..ab912dac2 100644
--- a/libraries/AP_Common/menu.cpp
+++ b/libraries/AP_Menu/AP_Menu.cpp
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <avr/pgmspace.h>
 
-#include "include/menu.h"
+#include "AP_Menu.h"
 
 // statics
 char Menu::_inbuf[MENU_COMMANDLINE_MAX];
diff --git a/libraries/AP_Common/include/menu.h b/libraries/AP_Menu/AP_Menu.h
similarity index 98%
rename from libraries/AP_Common/include/menu.h
rename to libraries/AP_Menu/AP_Menu.h
index 452daa056..7a9540376 100644
--- a/libraries/AP_Common/include/menu.h
+++ b/libraries/AP_Menu/AP_Menu.h
@@ -13,8 +13,8 @@
 /// Arguments passed to the handler function are pre-converted to both
 /// long and float for convenience.
 
-#ifndef __AP_COMMON_MENU_H
-#define __AP_COMMON_MENU_H
+#ifndef __AP_MENU_H__
+#define __AP_MENU_H__
 
 #include <inttypes.h>
 
@@ -140,4 +140,4 @@ private:
     static const char __menu_name__ ## name[] PROGMEM = prompt;      \
     static Menu name(__menu_name__ ## name, commands, sizeof(commands) / sizeof(commands[0]), preprompt)
 
-#endif
+#endif // __AP_COMMON_MENU_H__
diff --git a/libraries/AP_Menu/examples/menu/Makefile b/libraries/AP_Menu/examples/menu/Makefile
new file mode 100644
index 000000000..d1f40fd90
--- /dev/null
+++ b/libraries/AP_Menu/examples/menu/Makefile
@@ -0,0 +1 @@
+include ../../../AP_Common/Arduino.mk
diff --git a/libraries/AP_Common/examples/menu/menu.pde b/libraries/AP_Menu/examples/menu/menu.pde
similarity index 94%
rename from libraries/AP_Common/examples/menu/menu.pde
rename to libraries/AP_Menu/examples/menu/menu.pde
index 05a4dfdbe..32d016e53 100644
--- a/libraries/AP_Common/examples/menu/menu.pde
+++ b/libraries/AP_Menu/examples/menu/menu.pde
@@ -1,6 +1,8 @@
 
 #include <FastSerial.h>
 #include <AP_Common.h>
+#include <AP_Param.h>
+#include <AP_Menu.h>
 
 FastSerialPort0(Serial);
 
-- 
GitLab