diff --git a/groundStation/src/backend/bitwise.h b/common/bitwise.h similarity index 100% rename from groundStation/src/backend/bitwise.h rename to common/bitwise.h diff --git a/groundStation/src/backend/commands.c b/common/commands.c similarity index 100% rename from groundStation/src/backend/commands.c rename to common/commands.c diff --git a/groundStation/src/backend/commands.h b/common/commands.h similarity index 100% rename from groundStation/src/backend/commands.h rename to common/commands.h diff --git a/groundStation/src/backend/common/common.txt b/common/common.txt similarity index 50% rename from groundStation/src/backend/common/common.txt rename to common/common.txt index cfc7835508714bcbc03e48f3af52c4b69e172a2a..3a20094073732be5f5bed0035644f2193a85cdbc 100644 --- a/groundStation/src/backend/common/common.txt +++ b/common/common.txt @@ -1,7 +1,3 @@ The common files are: - - packet.h - - packet.c - setcontrol.h - setcontrol.c - - bitwise.h - - controller.h diff --git a/groundStation/src/backend/controller.h b/common/controller.h similarity index 100% rename from groundStation/src/backend/controller.h rename to common/controller.h diff --git a/groundStation/src/backend/common/examples.c b/common/examples_c similarity index 100% rename from groundStation/src/backend/common/examples.c rename to common/examples_c diff --git a/groundStation/src/backend/packet.c b/common/packet.c similarity index 100% rename from groundStation/src/backend/packet.c rename to common/packet.c diff --git a/groundStation/src/backend/packet.h b/common/packet.h similarity index 100% rename from groundStation/src/backend/packet.h rename to common/packet.h diff --git a/groundStation/Makefile b/groundStation/Makefile index 052f6bf8af89e079a93dd4c77711609316aead99..38c2e2d741e931412f2924fc9cc52f392fe10b23 100644 --- a/groundStation/Makefile +++ b/groundStation/Makefile @@ -6,10 +6,15 @@ GXX=g++ CFLAGS= -Wall -pedantic -Wextra -Werror -std=gnu99 -g -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable CXXFLAGS= -Wall -pedantic -Wextra -Werror -Wno-reorder -Wno-unused-variable -std=c++0x -g INCLUDES = $(foreach dir, $(INCDIR), -I$(dir)) -INCDIR=inc src/vrpn src/vrpn/quat src/vrpn/build $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR) +INCDIR=inc src/vrpn src/vrpn/quat src/vrpn/build $(COMSRCDIR) $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR) LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat OBJDIR=obj +# Common Objects +COMSRCDIR=../common +COMSOURCES := $(wildcard $(COMSRCDIR)/*.c ) +COMOBJECTS = $(COMSOURCES:$(COMSRCDIR)/%.c=$(OBJDIR)/%.o) + # Backend Specific Variables BEBINARY=BackEnd BESRCDIR=src/backend @@ -31,7 +36,7 @@ FECSOURCES := $(wildcard $(FESRCDIR)/*.c ) FECOBJECTS = $(FECSOURCES:$(FESRCDIR)/%.c=$(OBJDIR)/%.o) -OBJECTS= $(CLIOBJECTS) $(BECOBJECTS) $(BECPPOBJECTS) $(FECOBJECTS) +OBJECTS= $(COMOBJECTS) $(CLIOBJECTS) $(BECOBJECTS) $(BECPPOBJECTS) $(FECOBJECTS) # Default target all: logs objdir backend cli $(SYMLINKS) @@ -48,9 +53,12 @@ $(CLIOBJECTS) : $(OBJDIR)/%.o : $(CLISRCDIR)/%.c $(GCC) $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS) -backend: $(BECPPOBJECTS) $(BECOBJECTS) +backend: $(COMOBJECTS) $(BECPPOBJECTS) $(BECOBJECTS) $(GXX) $(CXXFLAGS) $^ -o $(BEBINARY) $(INCLUDES) $(LIBS) +$(COMOBJECTS) : $(OBJDIR)/%.o : $(COMSRCDIR)/%.c + $(GCC) $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS) + $(FECOBJECTS) : $(OBJDIR)/%.o : $(FESRCDIR)/%.c $(GCC) $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS) @@ -77,4 +85,4 @@ clean: rm -rf $(OBJDIR)/ $(BEBINARY) $(CLIBINARY) debug: - @echo $(OBJECTS) + @echo $(COMOBJECTS) diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c index 7b1a01f75b1cd2a1e400277d188069d87a3abe8a..ab4b67920e83d14b085ee34afc2edd0bcbf2b4d0 100644 --- a/groundStation/src/backend/backend.c +++ b/groundStation/src/backend/backend.c @@ -30,17 +30,17 @@ //user created includes #include "communication.h" -#include "commands.h" +#include "../../../common/commands.h" #include "vrpn_tracker.hpp" #include "type_def.h" -#include "packet.h" +#include "../../../common/packet.h" #include "responseparam.h" #include "update.h" #include "config.h" #include "cmHandler.h" #include "getparam.h" #include "setparam.h" -#include "bitwise.h" +#include "../../../common/bitwise.h" #define QUAD_BT_ADDR "00:06:66:64:61:D6" #define QUAD_BT_CHANNEL 0x01 diff --git a/groundStation/src/backend/callbacks.c b/groundStation/src/backend/callbacks.c index a47d521f24cb456858c7de567274caee82951023..c5499fadb3afa0abd771b35172dc47ff14d86354 100644 --- a/groundStation/src/backend/callbacks.c +++ b/groundStation/src/backend/callbacks.c @@ -1,4 +1,4 @@ -#include "commands.h" +#include "../../../common/commands.h" /* New stuff - this is nice and clean */ diff --git a/groundStation/src/backend/cmHandler.h b/groundStation/src/backend/cmHandler.h index f2761aa9b60ccbee08e699e6a035900e08e52cc3..de513f303afd0ffe0de5ba04c6a0989354b592a1 100644 --- a/groundStation/src/backend/cmHandler.h +++ b/groundStation/src/backend/cmHandler.h @@ -1,7 +1,7 @@ #ifndef _CMHANDLER_H #define _CMHANDLER_H -#include "controller.h" +#include "../../../common/controller.h" enum paramIndices { PARAM_ROLL_P , @@ -45,4 +45,4 @@ const char * cmToString(int msgType, const struct controller_message *cm); struct controller_message * stringToCm(const char * string, struct controller_message *cm); -#endif /* _CMHANDLER_H */ \ No newline at end of file +#endif /* _CMHANDLER_H */ diff --git a/groundStation/src/backend/communication.c b/groundStation/src/backend/communication.c index a6f14f29c36501907bee69b479b6541c2fe1fdf3..d0aa5c19aba69ddcc3cd3bdb12f7a9d38b62efc7 100644 --- a/groundStation/src/backend/communication.c +++ b/groundStation/src/backend/communication.c @@ -1,5 +1,5 @@ #include "communication.h" -#include "commands.h" +#include "../../../common/commands.h" #include <string.h> #include <ctype.h> diff --git a/groundStation/src/backend/getparam.c b/groundStation/src/backend/getparam.c index 98580741766e6187596c4519b6a8f3e2d1c0d3f5..16dc0c0a01724bac23a47308864a89c9b49ed346 100644 --- a/groundStation/src/backend/getparam.c +++ b/groundStation/src/backend/getparam.c @@ -1,6 +1,6 @@ #include "getparam.h" -#include "commands.h" -#include "bitwise.h" +#include "../../../common/commands.h" +#include "../../../common/bitwise.h" #include <sys/types.h> diff --git a/groundStation/src/backend/getparam.h b/groundStation/src/backend/getparam.h index c9d9096df464aae6e802e68f9a84236f99009c16..7e068f1676449a4af8e6a5e2ec560b00ec70b55d 100644 --- a/groundStation/src/backend/getparam.h +++ b/groundStation/src/backend/getparam.h @@ -1,8 +1,8 @@ #ifndef _getparam_h #define _getparam_h -#include "packet.h" -#include "controller.h" +#include "../../../common/packet.h" +#include "../../../common/controller.h" #include <sys/types.h> diff --git a/groundStation/src/backend/responseparam.c b/groundStation/src/backend/responseparam.c index f6a8d44b268493b0501759327334ed58e5cb0685..eee2f05c32be3d0004100d8255c67dbe3261bd07 100644 --- a/groundStation/src/backend/responseparam.c +++ b/groundStation/src/backend/responseparam.c @@ -1,6 +1,6 @@ #include "responseparam.h" -#include "commands.h" -#include "bitwise.h" +#include "../../../common/commands.h" +#include "../../../common/bitwise.h" #include <sys/types.h> diff --git a/groundStation/src/backend/responseparam.h b/groundStation/src/backend/responseparam.h index 5e3224477b46d8384e6f10b30f07e5571d089cfa..4daa8c3edc64279d02662efbabfa627d532d49b8 100644 --- a/groundStation/src/backend/responseparam.h +++ b/groundStation/src/backend/responseparam.h @@ -1,8 +1,8 @@ #ifndef _responseparam_h #define _responseparam_h -#include "packet.h" -#include "controller.h" +#include "../../../common/packet.h" +#include "../../../common/controller.h" #include <sys/types.h> diff --git a/groundStation/src/backend/setparam.c b/groundStation/src/backend/setparam.c index c97ed01f4d16d92ae18434d3dbf5d8da9c11b94a..6aaa71b0898d69aa339917d00234dbdf3688cf78 100644 --- a/groundStation/src/backend/setparam.c +++ b/groundStation/src/backend/setparam.c @@ -1,6 +1,6 @@ #include "setparam.h" -#include "commands.h" -#include "bitwise.h" +#include "../../../common/commands.h" +#include "../../../common/bitwise.h" #include <sys/types.h> diff --git a/groundStation/src/backend/setparam.h b/groundStation/src/backend/setparam.h index 671d7aa240ef43c6bb82fc8eaa1b29826b70c36c..d3d251a2e2351a6e6001d15b1e52f652e1e32b72 100644 --- a/groundStation/src/backend/setparam.h +++ b/groundStation/src/backend/setparam.h @@ -1,8 +1,8 @@ #ifndef _setparam_h #define _setparam_h -#include "packet.h" -#include "controller.h" +#include "../../../common/packet.h" +#include "../../../common/controller.h" #include <sys/types.h> diff --git a/groundStation/src/backend/update.c b/groundStation/src/backend/update.c index db546e05a3891ff0f9f52bc2ecdfc658012ed65b..c7553575fa3b3998e2168634e4a71e56a2c3c9e7 100644 --- a/groundStation/src/backend/update.c +++ b/groundStation/src/backend/update.c @@ -1,6 +1,6 @@ #include "update.h" -#include "commands.h" -#include "bitwise.h" +#include "../../../common/commands.h" +#include "../../../common/bitwise.h" #include <sys/types.h> diff --git a/groundStation/src/backend/update.h b/groundStation/src/backend/update.h index 783a861cacd013ce7ffad9558dabfffbb9c80481..6491823d74af6a29f7cd9c826301da79ef5457d6 100644 --- a/groundStation/src/backend/update.h +++ b/groundStation/src/backend/update.h @@ -1,7 +1,7 @@ #ifndef _update_h #define _update_h -#include "packet.h" +#include "../../../common/packet.h" #include <sys/types.h> diff --git a/quad/src/quad_app/commands.c b/quad/src/quad_app/commands.c index d1d22a4de05c1ec9eb722ca0de2c3d7b97c9469d..e9bada254a300676bc4a563b5d1183e02125693f 120000 --- a/quad/src/quad_app/commands.c +++ b/quad/src/quad_app/commands.c @@ -1 +1 @@ -../../../groundStation/src/backend/commands.c \ No newline at end of file +../../../groundStation/src/backend/common/commands.c \ No newline at end of file diff --git a/quad/src/quad_app/commands.h b/quad/src/quad_app/commands.h index 6c32c46d785373d6dd1078846158d3b4f3531341..92d6b32d4641fd6b8ea711d7141b7b03d484b72a 120000 --- a/quad/src/quad_app/commands.h +++ b/quad/src/quad_app/commands.h @@ -1 +1 @@ -../../../groundStation/src/backend/commands.h \ No newline at end of file +../../../groundStation/src/backend/common/commands.h \ No newline at end of file