diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-10 22:17:49 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-06-10 22:17:49 +0200 |
commit | 5f926a60d2c80ed00665d6a09690b90ce531d8a2 (patch) | |
tree | 375e0c5ff9245f571f1c1bd1c9cd1e1580cdf8bf | |
parent | dc2d8b106942684132a39adc6e207bbc9419f893 (diff) | |
download | code-5f926a60d2c80ed00665d6a09690b90ce531d8a2.tar.gz |
Add include guards, fix compilation with arduino-makefile
Include guards are needed because files are concatenated.
https://github.com/Lekensteyn/arduino-makefile
(forked from https://github.com/tomswartz07/arduino-makefile)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Venus_Skeleton/Makefile | 43 | ||||
-rw-r--r-- | Venus_Skeleton/calibration_wall-e.h | 6 | ||||
-rw-r--r-- | Venus_Skeleton/comm.h | 5 | ||||
-rw-r--r-- | Venus_Skeleton/dataTypes.h | 5 |
5 files changed, 28 insertions, 32 deletions
@@ -2,3 +2,4 @@ .*.sw? __pycache__/ *.py[oc] +bin/ diff --git a/Venus_Skeleton/Makefile b/Venus_Skeleton/Makefile index c2c5198..f150b58 100644 --- a/Venus_Skeleton/Makefile +++ b/Venus_Skeleton/Makefile @@ -1,35 +1,16 @@ -#CC = /usr/share/arduino/hardware/tools/avr/bin/avr-gcc -CC = avr-gcc -WFLAGS = -Wall -Wextra -Wno-attributes -WFLAGS += -fdiagnostics-color=auto -EXTRA_CFLAGS = $(shell cat .syntastic_c_config) -O2 $(CFLAGS) -MY_SOURCES = Venus_Skeleton.ino comm.cpp -MY_OBJECTS = $(patsubst %.cpp,%.o,$(patsubst %.ino,%.o,$(MY_SOURCES))) -LIBS_SOURCES = $(wildcard libs/*/*.cpp) -LIBS_OBJECTS = $(patsubst %.cpp,%.o,$(LIBS_SOURCES)) -SOURCES = $(MY_SOURCES) $(LIBS_SOURCES) -OBJECTS = $(MY_OBJECTS) $(LIBS_OBJECTS) -PROGRAM ?= main +PROJECT = Venus_Skeleton +ARDUINO_MODEL = uno +#PORT = /dev/ttyACM* +ARDUINO = 163 +#ARDUINO_DIR = /usr/share/arduino +#ARDUINO_VARIANT = $(ARDUINO_DIR)/hardware/arduino/avr/variants/standard -_V_0 = @ -_V = $(_V_$(V)) +ARDUINO_LIBS = Serial Servo Wire +USER_LIBDIR = ./libs +USER_LIBS = HMC5883L IRremote TrueRandom -.PHONY: main clean check -check: - rm -f $(MY_OBJECTS) - $(MAKE) $(MY_OBJECTS) -# Note: does not compile due to link errors. -$(PROGRAM): $(OBJECTS) - $(_V)$(CC) $(WFLAGS) $(EXTRA_CFLAGS) $(OBJECTS) -o $@ +CEXTRA = -fdiagnostics-color=auto +#CEXTRA += -Wall -Wextra -Wno-attributes -clean: - $(_V)rm -f $(PROGRAM) $(OBJECTS) - -# Not my code... -libs/%.o: libs/%.cpp - $(_V)$(CC) -w $(EXTRA_CFLAGS) -c -o $@ $< -%.o: %.cpp - $(_V)$(CC) $(WFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< -%.o: %.ino - $(_V)$(CC) $(WFLAGS) $(EXTRA_CFLAGS) -c -x c++ -o $@ $< +include ~/Arduino/arduino-makefile/Makefile diff --git a/Venus_Skeleton/calibration_wall-e.h b/Venus_Skeleton/calibration_wall-e.h index 16e0ebe..c859a84 100644 --- a/Venus_Skeleton/calibration_wall-e.h +++ b/Venus_Skeleton/calibration_wall-e.h @@ -1,3 +1,5 @@ +#ifndef CALIBRATION_WALL_E_H +#define CALIBRATION_WALL_E_H // WALLY configuration file #define calObstacleTurretMaxDist 50 @@ -27,4 +29,6 @@ #define CAL_TURRET_TO_CENTER_DIST 6 -#define CAL_SAMPLE_TURRET_MAX_DIST 27
\ No newline at end of file +#define CAL_SAMPLE_TURRET_MAX_DIST 27 + +#endif /* !CALIBRATION_WALL_E_H */ diff --git a/Venus_Skeleton/comm.h b/Venus_Skeleton/comm.h index 26e8d7b..bca5aab 100644 --- a/Venus_Skeleton/comm.h +++ b/Venus_Skeleton/comm.h @@ -1,3 +1,6 @@ +#ifndef COMM_H +#define COMM_H + typedef enum { RESET1 = 0x81, RESET2 = 0x82, @@ -40,3 +43,5 @@ static inline void serial_print_debug(long n) { static inline void serial_print_debug(float n) { serial_print_debug(String(n)); } + +#endif /* !COMM_H */ diff --git a/Venus_Skeleton/dataTypes.h b/Venus_Skeleton/dataTypes.h index f19eaf5..2f2aa69 100644 --- a/Venus_Skeleton/dataTypes.h +++ b/Venus_Skeleton/dataTypes.h @@ -1,3 +1,6 @@ +#ifndef DATATYPES_H +#define DATATYPES_H + // **************** // ** Data types ** // **************** @@ -63,3 +66,5 @@ typedef enum { OPMODE_LABSEQUENCE, OPMODE_ERROR } opmode_t; + +#endif /* !DATATYPES_H */ |