From 7ccd7afce2a158eb852b5f7c61cd51e8febe56a9 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 31 Aug 2012 16:12:14 -0400 Subject: Fixups for Wire library builds. Add libraries directory to global include path, so Wire sub-headers can be included in a directory-independent way. Tweak Wire global declaration and definition so it builds. Signed-off-by: Marti Bolivar --- Makefile | 2 ++ libraries/Wire/HardWire.cpp | 2 +- libraries/Wire/HardWire.h | 2 +- libraries/Wire/Wire.cpp | 4 ++-- libraries/Wire/Wire.h | 6 +++--- libraries/Wire/WireBase.cpp | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 6a76000..1f19f37 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ BUILD_PATH = build LIBMAPLE_PATH := $(SRCROOT)/libmaple WIRISH_PATH := $(SRCROOT)/wirish SUPPORT_PATH := $(SRCROOT)/support +LIBRARIES_PATH := $(SRCROOT)/libraries # Support files for linker LDDIR := $(SUPPORT_PATH)/ld # Support files for this Makefile @@ -52,6 +53,7 @@ include $(MAKEDIR)/build-templates.mk # It slows compilation noticeably; remove after 1 release. TARGET_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \ -I$(WIRISH_PATH)/include/wirish +TARGET_FLAGS += -I$(LIBRARIES_PATH) # for internal lib. includes, e.g. GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -nostdlib \ -ffunction-sections -fdata-sections \ -Wl,--gc-sections $(TARGET_FLAGS) diff --git a/libraries/Wire/HardWire.cpp b/libraries/Wire/HardWire.cpp index 9182ae2..c2412f1 100644 --- a/libraries/Wire/HardWire.cpp +++ b/libraries/Wire/HardWire.cpp @@ -36,7 +36,7 @@ * users easy interaction with the I2C Hardware in a familiar method. */ -#include "HardWire.h" +#include uint8 HardWire::process() { int8 res = i2c_master_xfer(sel_hard, &itc_msg, 1, 0); diff --git a/libraries/Wire/HardWire.h b/libraries/Wire/HardWire.h index d3f4ed8..d6eb54a 100644 --- a/libraries/Wire/HardWire.h +++ b/libraries/Wire/HardWire.h @@ -39,7 +39,7 @@ #ifndef _HARDWIRE_H_ #define _HARDWIRE_H_ -#include "WireBase.h" +#include #include #include diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 9173234..d646132 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -37,7 +37,7 @@ * modifications by gke and ala42. */ -#include "Wire.h" +#include #define I2C_WRITE 0 #define I2C_READ 1 @@ -179,4 +179,4 @@ TwoWire::~TwoWire() { } // Declare the instance that the users of the library can use -TwoWire Wire(); \ No newline at end of file +TwoWire Wire(SCL, SDA, SOFT_STANDARD); diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index 812132b..d455b11 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -40,7 +40,7 @@ #ifndef _WIRE_H_ #define _WIRE_H_ -#include "WireBase.h" +#include #include /* @@ -116,7 +116,7 @@ class TwoWire : public WireBase { * Accept pin numbers for SCL and SDA lines. Set the delay needed * to create the timing for I2C's Standard Mode and Fast Mode. */ - TwoWire(uint8 = SCL, uint8 = SDA, uint8 = SOFT_STANDARD); + TwoWire(uint8 scl=SCL, uint8 sda=SDA, uint8 delay=SOFT_STANDARD); /* * Sets pins SDA and SCL to OUPTUT_OPEN_DRAIN, joining I2C bus as @@ -131,6 +131,6 @@ class TwoWire : public WireBase { ~TwoWire(); }; -extern TwoWire Wire(); +extern TwoWire Wire; #endif // _WIRE_H_ diff --git a/libraries/Wire/WireBase.cpp b/libraries/Wire/WireBase.cpp index e9b316d..3cb0174 100644 --- a/libraries/Wire/WireBase.cpp +++ b/libraries/Wire/WireBase.cpp @@ -38,7 +38,7 @@ * whether it is I2C hardware or emulating software. */ -#include "WireBase.h" +#include #include void WireBase::begin(uint8 self_addr) { -- cgit v1.2.3