Skip to content

Commit

Permalink
Fixups for Wire library builds.
Browse files Browse the repository at this point in the history
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 <mbolivar@leaflabs.com>
  • Loading branch information
Marti Bolivar committed Aug 31, 2012
1 parent 853d0b1 commit a62e15a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -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
Expand Down Expand Up @@ -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. <Wire/WireBase.h>
GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -nostdlib \
-ffunction-sections -fdata-sections \
-Wl,--gc-sections $(TARGET_FLAGS)
Expand Down
2 changes: 1 addition & 1 deletion libraries/Wire/HardWire.cpp
Expand Up @@ -36,7 +36,7 @@
* users easy interaction with the I2C Hardware in a familiar method.
*/

#include "HardWire.h"
#include <Wire/HardWire.h>

uint8 HardWire::process() {
int8 res = i2c_master_xfer(sel_hard, &itc_msg, 1, 0);
Expand Down
2 changes: 1 addition & 1 deletion libraries/Wire/HardWire.h
Expand Up @@ -39,7 +39,7 @@
#ifndef _HARDWIRE_H_
#define _HARDWIRE_H_

#include "WireBase.h"
#include <Wire/WireBase.h>
#include <wirish/wirish.h>
#include <libmaple/i2c.h>

Expand Down
4 changes: 2 additions & 2 deletions libraries/Wire/Wire.cpp
Expand Up @@ -37,7 +37,7 @@
* modifications by gke and ala42.
*/

#include "Wire.h"
#include <Wire/Wire.h>

#define I2C_WRITE 0
#define I2C_READ 1
Expand Down Expand Up @@ -179,4 +179,4 @@ TwoWire::~TwoWire() {
}

// Declare the instance that the users of the library can use
TwoWire Wire();
TwoWire Wire(SCL, SDA, SOFT_STANDARD);
6 changes: 3 additions & 3 deletions libraries/Wire/Wire.h
Expand Up @@ -40,7 +40,7 @@
#ifndef _WIRE_H_
#define _WIRE_H_

#include "WireBase.h"
#include <Wire/WireBase.h>
#include <wirish/wirish.h>

/*
Expand Down Expand Up @@ -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
Expand All @@ -131,6 +131,6 @@ class TwoWire : public WireBase {
~TwoWire();
};

extern TwoWire Wire();
extern TwoWire Wire;

#endif // _WIRE_H_
2 changes: 1 addition & 1 deletion libraries/Wire/WireBase.cpp
Expand Up @@ -38,7 +38,7 @@
* whether it is I2C hardware or emulating software.
*/

#include "WireBase.h"
#include <Wire/WireBase.h>
#include <wirish/wirish.h>

void WireBase::begin(uint8 self_addr) {
Expand Down

0 comments on commit a62e15a

Please sign in to comment.