Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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 <mbolivar@leaflabs.com>
  • Loading branch information...
commit a62e15ab598750da7f75cbf22068d6db94de7396 1 parent 853d0b1
@mbolivar mbolivar authored
View
2  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. <Wire/WireBase.h>
GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -nostdlib \
-ffunction-sections -fdata-sections \
-Wl,--gc-sections $(TARGET_FLAGS)
View
2  libraries/Wire/HardWire.cpp
@@ -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);
View
2  libraries/Wire/HardWire.h
@@ -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>
View
4 libraries/Wire/Wire.cpp
@@ -37,7 +37,7 @@
* modifications by gke and ala42.
*/
-#include "Wire.h"
+#include <Wire/Wire.h>
#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();
+TwoWire Wire(SCL, SDA, SOFT_STANDARD);
View
6 libraries/Wire/Wire.h
@@ -40,7 +40,7 @@
#ifndef _WIRE_H_
#define _WIRE_H_
-#include "WireBase.h"
+#include <Wire/WireBase.h>
#include <wirish/wirish.h>
/*
@@ -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_
View
2  libraries/Wire/WireBase.cpp
@@ -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) {

0 comments on commit a62e15a

Please sign in to comment.
Something went wrong with that request. Please try again.