From 5de11359ebb1cf5ae623035e4594be9ceefcf9cc Mon Sep 17 00:00:00 2001 From: Brendan Bartels <bbartels@iastate.edu> Date: Fri, 24 Mar 2017 17:47:27 -0500 Subject: [PATCH] quad: separate commands files into their own library --- groundStation/Makefile | 2 +- quad/Makefile | 1 + quad/src/commands/Makefile | 6 ++++++ quad/src/{quad_app => commands}/cb_default.h | 3 +-- quad/src/{quad_app => commands}/commands.c | 0 quad/src/{quad_app => commands}/commands.h | 6 ++++-- quad/src/quad_app/Makefile | 2 +- quad/src/quad_app/callbacks.h | 2 -- 8 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 quad/src/commands/Makefile rename quad/src/{quad_app => commands}/cb_default.h (75%) rename quad/src/{quad_app => commands}/commands.c (100%) rename quad/src/{quad_app => commands}/commands.h (94%) diff --git a/groundStation/Makefile b/groundStation/Makefile index 76fb0bf38..9a681cbe8 100644 --- a/groundStation/Makefile +++ b/groundStation/Makefile @@ -7,7 +7,7 @@ CFLAGS= -Wall -pedantic -Wextra -Werror -std=gnu99 -g -Wno-unused-parameter -Wno CXXFLAGS= -Wall -pedantic -Wextra -Werror -Wno-reorder -Wno-unused-variable -std=c++0x -g INCLUDES = $(foreach dir, $(INCDIR), -I$(dir)) INCDIR=../quad/inc src/vrpn src/vrpn/quat src/vrpn/build $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR) -LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat -lcomputation_graph -L../quad/lib -lquad_app +LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat -lcomputation_graph -L../quad/lib -lcommands OBJDIR=obj # Common Objects diff --git a/quad/Makefile b/quad/Makefile index f784e354f..101e598e7 100644 --- a/quad/Makefile +++ b/quad/Makefile @@ -13,6 +13,7 @@ libs: $(MAKE) -C src/test $(MAKE) -C src/queue $(MAKE) -C src/computation_graph + $(MAKE) -C src/commands $(MAKE) -C src/quad_app zybo: diff --git a/quad/src/commands/Makefile b/quad/src/commands/Makefile new file mode 100644 index 000000000..8cc8ffee3 --- /dev/null +++ b/quad/src/commands/Makefile @@ -0,0 +1,6 @@ +TOP=../.. + +NAME = commands +REQLIBS = -ltest + +include $(TOP)/library.mk diff --git a/quad/src/quad_app/cb_default.h b/quad/src/commands/cb_default.h similarity index 75% rename from quad/src/quad_app/cb_default.h rename to quad/src/commands/cb_default.h index aa308108b..5581c442c 100644 --- a/quad/src/quad_app/cb_default.h +++ b/quad/src/commands/cb_default.h @@ -1,11 +1,10 @@ #include "commands.h" -#include "type_def.h" /* The cb_default used on the groundStation. This file MUST NOT BE INCLUDED * by anything except for commands.c */ /* cb_default used by portable commands.c */ -int cb_default(modular_structs_t *structs) +int cb_default(struct modular_structs *structs) { return 0; } diff --git a/quad/src/quad_app/commands.c b/quad/src/commands/commands.c similarity index 100% rename from quad/src/quad_app/commands.c rename to quad/src/commands/commands.c diff --git a/quad/src/quad_app/commands.h b/quad/src/commands/commands.h similarity index 94% rename from quad/src/quad_app/commands.h rename to quad/src/commands/commands.h index d4b0f2e2c..98c6615f5 100644 --- a/quad/src/quad_app/commands.h +++ b/quad/src/commands/commands.h @@ -5,8 +5,6 @@ #include <stdlib.h> #include <string.h> -#include "callbacks.h" - #define MAX_CMD_TEXT_LENGTH 100 enum Message{ @@ -58,6 +56,10 @@ enum MessageTypeID{ MAX_TYPE_ID // 20 - Just used to keep track of the size. Must remain at the end }; +struct modular_structs; +struct metadata; +typedef int (command_cb)(struct modular_structs *, struct metadata *, unsigned char *, unsigned short); + /* * Message type struct used to keep track of the callback function * pointers located in commands.c diff --git a/quad/src/quad_app/Makefile b/quad/src/quad_app/Makefile index aea297458..4c9cdd92f 100644 --- a/quad/src/quad_app/Makefile +++ b/quad/src/quad_app/Makefile @@ -1,6 +1,6 @@ TOP=../.. NAME = quad_app -REQLIBS = -ltest -lcomputation_graph -lm -lqueue +REQLIBS = -ltest -lcomputation_graph -lm -lqueue -lcommands include $(TOP)/library.mk diff --git a/quad/src/quad_app/callbacks.h b/quad/src/quad_app/callbacks.h index 80d0bbc43..3a13626db 100644 --- a/quad/src/quad_app/callbacks.h +++ b/quad/src/quad_app/callbacks.h @@ -4,8 +4,6 @@ /* Grab some stupid stuff from legacy code */ struct modular_structs; struct metadata; - -/* Make commands.c happy */ typedef int (command_cb)(struct modular_structs *, struct metadata *, unsigned char *, unsigned short); #endif -- GitLab