소스 검색

Fixups for Wire library builds.

Marti Bolivar 5 년 전
부모
커밋
a62e15ab59
6개의 변경된 파일10개의 추가작업 그리고 8개의 파일을 삭제
  1. 2 0
      Makefile
  2. 1 1
      libraries/Wire/HardWire.cpp
  3. 1 1
      libraries/Wire/HardWire.h
  4. 2 2
      libraries/Wire/Wire.cpp
  5. 3 3
      libraries/Wire/Wire.h
  6. 1 1
      libraries/Wire/WireBase.cpp

+ 2 - 0
Makefile 파일 보기

@@ -15,6 +15,7 @@ BUILD_PATH = build
15 15
 LIBMAPLE_PATH := $(SRCROOT)/libmaple
16 16
 WIRISH_PATH := $(SRCROOT)/wirish
17 17
 SUPPORT_PATH := $(SRCROOT)/support
18
+LIBRARIES_PATH := $(SRCROOT)/libraries
18 19
 # Support files for linker
19 20
 LDDIR := $(SUPPORT_PATH)/ld
20 21
 # Support files for this Makefile
@@ -52,6 +53,7 @@ include $(MAKEDIR)/build-templates.mk
52 53
 # It slows compilation noticeably; remove after 1 release.
53 54
 TARGET_FLAGS    += -I$(LIBMAPLE_PATH)/include/libmaple                       \
54 55
                    -I$(WIRISH_PATH)/include/wirish
56
+TARGET_FLAGS += -I$(LIBRARIES_PATH) # for internal lib. includes, e.g. <Wire/WireBase.h>
55 57
 GLOBAL_CFLAGS   := -Os -g3 -gdwarf-2 -nostdlib \
56 58
                    -ffunction-sections -fdata-sections \
57 59
 		   -Wl,--gc-sections $(TARGET_FLAGS)

+ 1 - 1
libraries/Wire/HardWire.cpp 파일 보기

@@ -36,7 +36,7 @@
36 36
  * users easy interaction with the I2C Hardware in a familiar method.
37 37
  */
38 38
 
39
-#include "HardWire.h"
39
+#include <Wire/HardWire.h>
40 40
 
41 41
 uint8 HardWire::process() {
42 42
     int8 res = i2c_master_xfer(sel_hard, &itc_msg, 1, 0);

+ 1 - 1
libraries/Wire/HardWire.h 파일 보기

@@ -39,7 +39,7 @@
39 39
 #ifndef _HARDWIRE_H_
40 40
 #define _HARDWIRE_H_
41 41
 
42
-#include "WireBase.h"
42
+#include <Wire/WireBase.h>
43 43
 #include <wirish/wirish.h>
44 44
 #include <libmaple/i2c.h>
45 45
 

+ 2 - 2
libraries/Wire/Wire.cpp 파일 보기

@@ -37,7 +37,7 @@
37 37
  * modifications by gke and ala42.
38 38
  */
39 39
 
40
-#include "Wire.h"
40
+#include <Wire/Wire.h>
41 41
 
42 42
 #define I2C_WRITE 0
43 43
 #define I2C_READ  1
@@ -179,4 +179,4 @@ TwoWire::~TwoWire() {
179 179
 }
180 180
 
181 181
 // Declare the instance that the users of the library can use
182
-TwoWire Wire();
182
+TwoWire Wire(SCL, SDA, SOFT_STANDARD);

+ 3 - 3
libraries/Wire/Wire.h 파일 보기

@@ -40,7 +40,7 @@
40 40
 #ifndef _WIRE_H_
41 41
 #define _WIRE_H_
42 42
 
43
-#include "WireBase.h"
43
+#include <Wire/WireBase.h>
44 44
 #include <wirish/wirish.h>
45 45
 
46 46
 /*
@@ -116,7 +116,7 @@ class TwoWire : public WireBase {
116 116
      * Accept pin numbers for SCL and SDA lines. Set the delay needed
117 117
      * to create the timing for I2C's Standard Mode and Fast Mode.
118 118
      */
119
-    TwoWire(uint8 = SCL, uint8 = SDA, uint8 = SOFT_STANDARD);
119
+    TwoWire(uint8 scl=SCL, uint8 sda=SDA, uint8 delay=SOFT_STANDARD);
120 120
 
121 121
     /*
122 122
      * Sets pins SDA and SCL to OUPTUT_OPEN_DRAIN, joining I2C bus as
@@ -131,6 +131,6 @@ class TwoWire : public WireBase {
131 131
     ~TwoWire();
132 132
 };
133 133
 
134
-extern TwoWire Wire();
134
+extern TwoWire Wire;
135 135
 
136 136
 #endif // _WIRE_H_

+ 1 - 1
libraries/Wire/WireBase.cpp 파일 보기

@@ -38,7 +38,7 @@
38 38
  * whether it is I2C hardware or emulating software.
39 39
  */
40 40
 
41
-#include "WireBase.h"
41
+#include <Wire/WireBase.h>
42 42
 #include <wirish/wirish.h>
43 43
 
44 44
 void WireBase::begin(uint8 self_addr) {