Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use WiringPi git repo and update wiring pi to 2.4.6 to fix Kernel BCM issue. #98

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
302e19e
Change Git Repo to Official
pjgpetecodes Jun 9, 2019
d07b898
Remove patches
pjgpetecodes Jun 9, 2019
59c9d61
Point at my git repo
pjgpetecodes Jun 9, 2019
9884759
Update version number
pjgpetecodes Jun 9, 2019
8b7e073
Update version to correct format
pjgpetecodes Jun 9, 2019
76e6feb
Change directory name to match proper repo
pjgpetecodes Jun 9, 2019
f1f204a
Update directory name again
pjgpetecodes Jun 9, 2019
bab1f2e
Fix to match latest GPIO Make File
pjgpetecodes Jun 9, 2019
2e9b1a7
Change to match latest DevLib
pjgpetecodes Jun 9, 2019
2c62be1
Add spaces
pjgpetecodes Jun 9, 2019
3f4b79d
Add Spaces
pjgpetecodes Jun 9, 2019
d0ef2bc
Update gpio_Makefile.patch
pjgpetecodes Jun 9, 2019
28b2164
Match to latest
pjgpetecodes Jun 9, 2019
f4c86e4
Fix typo
pjgpetecodes Jun 9, 2019
852c0d0
Remove PulseIn
pjgpetecodes Jun 9, 2019
e756dd9
Remove error exports
pjgpetecodes Jun 9, 2019
8386a21
Remove PI_MODEL_UNKNOWN
pjgpetecodes Jun 9, 2019
7fec313
Remove wiringPiISRCancel
pjgpetecodes Jun 9, 2019
61208fe
Remove File
pjgpetecodes Jun 9, 2019
9b86b8c
Remove tcs34725
pjgpetecodes Jun 9, 2019
fb18174
remove tcs34725
pjgpetecodes Jun 9, 2019
4494646
Remove tcs34725
pjgpetecodes Jun 9, 2019
8fa1385
Create wiringPi_Makefile Patch
pjgpetecodes Jun 9, 2019
27db010
Add wiringPi MakeFile Patch
pjgpetecodes Jun 9, 2019
745ad4b
Fix WiringPi Path
pjgpetecodes Jun 9, 2019
f3a5eec
Fix Wiring Pi Include Casing
pjgpetecodes Jun 9, 2019
fae8e74
Set version to match WiringPi Version
pjgpetecodes Jun 9, 2019
01f08d4
Swap github repo back to WiringPi
pjgpetecodes Jun 9, 2019
f3a6776
Set Github address back to mine.
pjgpetecodes Jun 12, 2019
de02fc2
Updated to publish new NPM module
pjgpetecodes Oct 6, 2019
048766a
Added note about note contacting Gordon Henderson for Support
pjgpetecodes Oct 7, 2019
506a0fd
Change to LF from CRLF
pjgpetecodes Oct 7, 2019
0a34083
Add note that only supports node V6
pjgpetecodes Oct 7, 2019
22b9c03
Change add.h ForceSet to DefineOwnProperty
pjgpetecodes Oct 7, 2019
a6cabb5
Update Version Number
pjgpetecodes Oct 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
Node.js bindings to [wiringPi](http://www.wiringpi.com)
Node.js bindings to [wiringPi](http://www.wiringpi.com) (See note below!)

Based on the awesome work of [Soarez](https://github.com/Soarez/node-wiring-pi)

This version fixes the BCM identification issue present in the original Wiring-Pi node Module.

The original version relied on a very old version of Wiring-Pi.

Note: This version currently only supports Node V6... What this space for a version which supports later versions

****************************************************

Please note:

This statically linked version of Wiring Pi is not supported in anyway by Gordon Henderson.

Do not email Gordon with any issues you find with this Package as it is not his responsibility.

Thanks!

*****************************************************

## Install

```
npm install wiring-pi
npm install wiring-pi-2019
```

## Usage

```javascript
var wpi = require('wiring-pi');
var wpi = require('wiring-pi-2019');
```
## Documentation

Expand Down Expand Up @@ -39,3 +57,4 @@ Chris Continanza | [csquared](https://github.com/csquared) | [@csquared](https:/
Tao Yuan | [taoyuan](https://github.com/taoyuan) | [@taoyvan](https://twitter.com/taoyvan)
Tom Janson | [tjanson](https://github.com/tjanson) |
Vincent Terraillon | [LouTerrailloune](https://github.com/LouTerrailloune) | [@pure74vincent](https://twitter.com/pure74vincent)
Pete Gallagher | [pjgpetecodes](https://github.com/pjgpetecodes) | [@pete_codes](https://twitter.com/pete_codes)
11 changes: 5 additions & 6 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@
'src/devlib/maxdetect.cc',
'src/devlib/piFace.cc',
'src/devlib/piGlow.cc',
'src/devlib/piNes.cc',
'src/devlib/tcs34725.cc'
'src/devlib/piNes.cc'
],
'include_dirs': [
'wiringpi/wiringPi',
'wiringpi/devLib'
'WiringPi/wiringPi',
'WiringPi/devLib'
],
'libraries': [
'<!(pwd)/wiringpi/wiringPi/libwiringPi.a',
'<!(pwd)/wiringpi/devLib/libwiringPiDev.a'
'<!(pwd)/WiringPi/wiringPi/libwiringPi.a',
'<!(pwd)/WiringPi/devLib/libwiringPiDev.a'
],
'cflags': [
'-Wall'
Expand Down
15 changes: 8 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,36 @@ check_git_clone() {
rm ./install.log 2>/dev/null 1>&2

echo -n "Cloning libWiringPi ... "
rm -Rf ./wiringpi 2>/dev/null 1>&2
git clone https://github.com/nekuz0r/wiringpi.git -b 2.25 > ./install.log 2>&1
rm -Rf ./WiringPi 2>/dev/null 1>&2
git clone https://github.com/WiringPi/WiringPi.git > ./install.log 2>&1
check_git_clone
#git submodule init
#check_git_clone
#git submodule update
#check_git_clone
echo "done."

patch ./wiringpi/devLib/Makefile < ./patchs/devLib_Makefile.patch
patch ./wiringpi/gpio/Makefile < ./patchs/gpio_Makefile.patch
patch ./WiringPi/devLib/Makefile < ./patchs/devLib_Makefile.patch
patch ./WiringPi/gpio/Makefile < ./patchs/gpio_Makefile.patch
patch ./WiringPi/wiringPi/Makefile < ./patchs/wiringpi_Makefile.patch

echo -n "Making libWiringPi ... "
cd ./wiringpi/wiringPi/
cd ./WiringPi/wiringPi/
make clean >> ../../install.log 2>&1
make static >> ../../install.log 2>&1
check_make_ok "libWiringPi" 1
cd ../../
echo "done."

cd ./wiringpi/devLib/
cd ./WiringPi/devLib/
echo -n "Making devLib ..."
make clean >> ../../install.log 2>&1
make static >> ../../install.log 2>&1
check_make_ok "devLib" 0
cd ../../
echo "done."

cd ./wiringpi/gpio/
cd ./WiringPi/gpio/
echo -n "Unistalling gpio utility ... "
sudo make uninstall >> ../../install.log 2>&1
echo "done."
Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "wiring-pi",
"version": "2.2.1",
"description": "Bindings to wiringPi",
"name": "wiring-pi-2019",
"version": "1.0.4",
"description": "Bindings to latest wiringPi (Solves BCM Issue) (Node v6 only)",
"main": "lib/exports.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"install": "/bin/bash ./install.sh"
},
"repository": {
"type": "git",
"url": "[email protected]:WiringPi/WiringPi-Node.git"
"url": "[email protected]:pjgpetecodes/WiringPi-Node.git"
},
"keywords": [
"wiringPi",
Expand All @@ -19,10 +19,12 @@
"raspberrypi",
"bcm2835"
],
"author": "Igor Soarez <[email protected]>",
"author": "Pete Gallagher <[email protected]>",
"contributors": [
"Leandre Gohy <[email protected]>",
"Eugene Ware <[email protected]>"
"Eugene Ware <[email protected]>",
"Igor Soarez <[email protected]>",
"Pete Gallagher <[email protected]>"
],
"license": "BSD"
}
16 changes: 11 additions & 5 deletions patchs/devLib_Makefile.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
--- Makefile_org 2014-07-04 09:48:18.000000000 +0200
+++ Makefile 2014-07-04 10:12:15.000000000 +0200
@@ -26,6 +26,7 @@
VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
DESTDIR=/usr
PREFIX=/local
VERSION=$(shell cat ../VERSION)
DESTDIR?=/usr
PREFIX?=/local
+PWD=`pwd`

LDCONFIG?=ldconfig

ifneq ($V,1)
Q ?= @
endif

STATIC=libwiringPiDev.a
DYNAMIC=libwiringPiDev.so.$(VERSION)
@@ -33,7 +34,7 @@
@@ -40,7 +41,7 @@
#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
-INCLUDE = -I.
+INCLUDE = -I. -I$(PWD)/../wiringPi
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC

12 changes: 8 additions & 4 deletions patchs/gpio_Makefile.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
+++ Makefile 2014-07-04 10:13:01.000000000 +0200
@@ -25,14 +25,15 @@

DESTDIR=/usr
PREFIX=/local
DESTDIR?=/usr
PREFIX?=/local
+PWD=`pwd`

ifneq ($V,1)
Q ?= @
endif

#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
-INCLUDE = -I$(DESTDIR)$(PREFIX)/include
+INCLUDE = -I$(PWD)/../wiringPi -I$(PWD)/../devLib
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe

-LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
+LDFLAGS = -L$(PWD)/../wiringPi -L$(PWD)/../devLib
LIBS = -lwiringPi -lwiringPiDev -lpthread -lm
LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt

# May not need to alter anything below this line
35 changes: 35 additions & 0 deletions patchs/wiringpi_Makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--- Makefile 2019-06-09 16:11:11.208024572 +0000
+++ Makefile_new 2019-06-09 21:53:22.894082583 +0000
@@ -69,9 +69,13 @@

all: $(DYNAMIC)

-.PHONY: static
-static:
- $Q cat noMoreStatic
+static: $(STATIC)
+
+$(STATIC): $(OBJ)
+ $Q echo "[Link (Static)]"
+ $Q ar rcs $(STATIC) $(OBJ)
+ $Q ranlib $(STATIC)
+# @size $(STATIC)

$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
@@ -104,6 +108,15 @@
$Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
$Q $(LDCONFIG)

+.PHONY: install-static
+install-static: $(STATIC)
+ $Q echo "[Install Headers]"
+ $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
+ $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
+ $Q echo "[Install Static Lib]"
+ $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
+ $Q install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
+
.PHONY: install-deb
install-deb: $(DYNAMIC)
$Q echo "[Install Headers: deb]"
8 changes: 4 additions & 4 deletions src/addon.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
v8::FunctionTemplate::New(isolate, nodemodule::name)->GetFunction())

#define EXPORT_CONSTANT_INT(name) \
target->ForceSet(v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
target->DefineOwnProperty(target->CreationContext(), v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
v8::Int32::New(isolate, name), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));

#define EXPORT_CONSTANT_STRING(name) \
target->ForceSet(v8::String::NewFrontUtf8(isolate, #name, v8::String::kInternalizedString), \
target->DefineOwnProperty(target->CreationContext(), v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
v8::String::NewFromUtf8(isolate, name), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));

#define EXPORT_CONSTANT_INT_ARRAY(name, array, length) \
Expand All @@ -55,7 +55,7 @@
for (int i = 0; i < length; i++) { \
arr->Set(i, v8::Int32::New(isolate, array[i])); \
} \
target->ForceSet(v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
target->DefineOwnProperty(target->CreationContext(), v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
arr, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); \
}

Expand All @@ -65,7 +65,7 @@
for (int i = 0; i < length; i++) { \
arr->Set(i, v8::String::NewFromUtf8(isolate, array[i])); \
} \
target->ForceSet(v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
target->DefineOwnProperty(target->CreationContext(), v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
arr, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); \
}

Expand Down
6 changes: 3 additions & 3 deletions src/devlib/devlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "piFace.h"
#include "piGlow.h"
#include "piNes.h"
#include "tcs34725.h"
//#include "tcs34725.h"

IMPLEMENT_EXPORT_INIT(devlib) {
INIT(ds1302);
Expand All @@ -19,5 +19,5 @@ IMPLEMENT_EXPORT_INIT(devlib) {
INIT(piFace);
INIT(piGlow);
INIT(piNes);
INIT(tcs34725);
}
//INIT(tcs34725);
}
Loading