diff --git a/libraries/AP_HAL/AP_HAL_Namespace.h b/libraries/AP_HAL/AP_HAL_Namespace.h index 931652632d..35c67d9b72 100644 --- a/libraries/AP_HAL/AP_HAL_Namespace.h +++ b/libraries/AP_HAL/AP_HAL_Namespace.h @@ -2,6 +2,7 @@ #ifndef __AP_HAL_NAMESPACE_H__ #define __AP_HAL_NAMESPACE_H__ +#include #include "string.h" #include "utility/FastDelegate.h" @@ -29,10 +30,6 @@ #define DELEGATE_FUNCTION(rettype, ...) fastdelegate::FastDelegate0 -#ifndef APM_BUILD_FUNCTOR -#define APM_BUILD_FUNCTOR 0 -#endif - #if APM_BUILD_FUNCTOR #include "utility/functor.h" diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index f071463bca..06140e3456 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -51,37 +51,7 @@ public: }; }; -/* - define common vehicle build types. Note that the APM_BUILD_DIRECTORY - define is only available with makefile based build, not with - arduino. - Also note that code needs to support other APM_BUILD_DIRECTORY - values for example sketches - */ -#define APM_BUILD_APMrover2 1 -#define APM_BUILD_ArduCopter 2 -#define APM_BUILD_ArduPlane 3 -#define APM_BUILD_AntennaTracker 4 -#define APM_BUILD_UNKNOWN 5 -/* - using this macro catches cases where we try to check vehicle type on - build systems that don't support it - */ -#ifdef APM_BUILD_DIRECTORY -#define APM_BUILD_TYPE(type) ((type) == APM_BUILD_DIRECTORY) -#else -#define APM_BUILD_TYPE(type) ((type) == APM_BUILD_UNKNOWN) -#endif - -#ifndef APM_BUILD_FUNCTOR -#define APM_BUILD_FUNCTOR 0 -#endif - -#if APM_BUILD_TYPE(APM_BUILD_APMrover2) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) -# define APM_BUILD_DELEGATES 1 -#else -# define APM_BUILD_DELEGATES 0 -#endif +#include "AP_Vehicle_Type.h" #endif // AP_VEHICLE_H diff --git a/libraries/AP_Vehicle/AP_Vehicle_Type.h b/libraries/AP_Vehicle/AP_Vehicle_Type.h new file mode 100644 index 0000000000..97c144e6a4 --- /dev/null +++ b/libraries/AP_Vehicle/AP_Vehicle_Type.h @@ -0,0 +1,52 @@ +/* + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +#ifndef AP_VEHICLE_TYPE_H +#define AP_VEHICLE_TYPE_H + +/* + define common vehicle build types. Note that the APM_BUILD_DIRECTORY + define is only available with makefile based build, not with + arduino. + Also note that code needs to support other APM_BUILD_DIRECTORY + values for example sketches + */ +#define APM_BUILD_APMrover2 1 +#define APM_BUILD_ArduCopter 2 +#define APM_BUILD_ArduPlane 3 +#define APM_BUILD_AntennaTracker 4 +#define APM_BUILD_UNKNOWN 5 + +/* + using this macro catches cases where we try to check vehicle type on + build systems that don't support it + */ +#ifdef APM_BUILD_DIRECTORY +#define APM_BUILD_TYPE(type) ((type) == APM_BUILD_DIRECTORY) +#else +#define APM_BUILD_TYPE(type) ((type) == APM_BUILD_UNKNOWN) +#endif + +#if APM_BUILD_TYPE(APM_BUILD_APMrover2) +# define APM_BUILD_FUNCTOR 1 +# define APM_BUILD_DELEGATES 0 +#elif APM_BUILD_TYPE(APM_BUILD_ArduPlane) +# define APM_BUILD_FUNCTOR 0 +# define APM_BUILD_DELEGATES 1 +#else +# define APM_BUILD_FUNCTOR 0 +# define APM_BUILD_DELEGATES 0 +#endif + +#endif // AP_VEHICLE_TYPE_H