diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56bee6c..f91daa1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,21 @@
# CHANGELOG
-## v2.1.0 *[not released yes]*
- * **Update:** libWiringPi to [custom][nekuz0r-libWiringPi] v2.21 `nekuz0r`
+## v2.1.0 *[not released yet]*
+ * **Update:** libWiringPi to [custom][nekuz0r-libWiringPi] v2.25 `nekuz0r`
+ * **Update:** wiringPiISR now keeps event loop running `nekuz0r`
+ * **Update:** piModelNames string array `nekuz0r`
+ * **Update:** piMakerNames string array `nekuz0r`
+ * **Update:** install.sh now clone tagged version of the custom libWiringPi
+ * **Add:** support for node 0.12.0
* **Add:** raspberry pi A+ support `nekuz0r`
+ * **Add:** raspberry pi 2 support `nekuz0r`
+ * **Add:** constant PI_MODEL_AP `nekuz0r`
+ * **Add:** constant PI_MODEL_2 `nekuz0r`
+ * **Add:** constant PI_MARKER_MBEST `nekuz0r`
+ * **Add:** wiringPiISRCancel `nekuz0r`
+ * **Add:** wiringPiSPISetupMode `nekuz0r`
+ * **Fix:** blink.js example `louterrailloune`
+ * **Fix:** SPI speed select argument `noddy76`
## v2.0.0 *[Jan 1 2015]*
* **Update:** libWiringPi to [custom][nekuz0r-libWiringPi] v2.20 `nekuz0r`
diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md
index b1548c6..e4792d1 100644
--- a/DOCUMENTATION.md
+++ b/DOCUMENTATION.md
@@ -136,13 +136,23 @@ This is an un-documented special to let you set any pin to any mode.
`mode` can be one of the following values:
-* `WPI_MODE_PINS`
- >= 1.0.0
-* `WPI_MODE_PHYS`
- >= 1.0.0
-* `WPI_MODE_GPIO`
- >= 1.0.0
-
+* `FSEL_INPT`
+ >= 2.1.0
+* `FSEL_OUTP`
+ >= 2.1.0
+* `FSEL_ALT0`
+ >= 2.1.0
+* `FSEL_ALT1`
+ >= 2.1.0
+* `FSEL_ALT2`
+ >= 2.1.0
+* `FSEL_ALT3`
+ >= 2.1.0
+* `FSEL_ALT4`
+ >= 2.1.0
+* `FSEL_ALT5`
+ >= 2.1.0
+
### pinMode(pin, mode)
>= 0.1.0
@@ -176,7 +186,7 @@ If you need to change the pin mode, the you can do it with the gpio program in a
>= 1.1.0
* `SOFT_TONE_OUTPUT`
>= 1.1.0
-
+
### pullUpDnControl(pin, pud)
>= 0.2.0
@@ -194,7 +204,7 @@ The internal pull up/down resistors have a value of approximately 50KΩ on the R
>= 0.2.0
* `PUD_UP` *pull to 3.3v*
>= 0.2.0
-
+
### digitalRead(pin)
>= 0.1.1
@@ -258,7 +268,7 @@ Gives up and returns 0 if no pulse starts within a specified time out.
>= 0.1.2
* `LOW`
>= 0.1.2
-
+
### delay(milliseconds)
>= 1.1.0
@@ -318,6 +328,8 @@ wpi.wiringPiISR(7, wpi.INT_EDGE_FALLING, function(delta) {
console.log('Pin 7 changed to LOW (', delta, ')');
});
```
+### wiringPiISRCancel(pin)
+ >= 2.1.0
---
@@ -355,12 +367,16 @@ Indexes of each string table have corresponding constants
>= 2.0.0
* `PI_MODEL_A`
>= 1.1.0
+ * `PI_MODEL_AP`
+ >= 2.1.0
* `PI_MODEL_B`
>= 1.1.0
* `PI_MODEL_BP`
>= 2.0.0
* `PI_MODEL_CM`
>= 1.1.1
+ * `PI_MODEL_2`
+ >= 2.1.0
* `PI_REVISION_NAMES`
@@ -380,6 +396,8 @@ Indexes of each string table have corresponding constants
>= 2.0.0
* `PI_MAKER_EGOMAN`
>= 2.0.0
+ * `PI_MAKER_MBEST`
+ >= 2.1.0
* `PI_MAKER_SONY`
>= 2.0.0
* `PI_MAKER_QISDA`
@@ -429,7 +447,7 @@ The mark:space mode is traditional, however the default mode in the Pi is “bal
* `PWM_MODE_BAL` *balanced*
* `PWM_MODE_MS` *mark:space*
-
+
### pwmSetRange(range)
>= 0.1.1
@@ -541,6 +559,9 @@ The returned value is the Linux file-descriptor for the device, or -1 on error.
If an error has happened, you may use the standard errno global variable to see why.
+### wiringPiSPISetupMode(channel, speed, mode)
+ >= 2.1.0
+
---
## Serial
@@ -556,7 +577,7 @@ The return value is the file descriptor or -1 for any error, in which case errno
**NOTE: The file descriptor (fd) returned is a standard Linux file descriptor.**
-**You can use the standard read(), write(), etc. system calls on this file descriptor as required.**
+**You can use the standard read(), write(), etc. system calls on this file descriptor as required.**
**E.g. you may wish to write a larger block of binary data where the serialPutchar() or serialPuts() function may not be the most appropriate function to use, in which case, you can use write() to send the data.**
diff --git a/install.sh b/install.sh
index 001b72d..33a973f 100644
--- a/install.sh
+++ b/install.sh
@@ -40,7 +40,7 @@ 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 > ./install.log 2>&1
+git clone https://github.com/nekuz0r/wiringpi.git -b 2.25 > ./install.log 2>&1
check_git_clone
#git submodule init
#check_git_clone
diff --git a/package.json b/package.json
index 88eed48..9979e88 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "wiring-pi",
- "version": "2.0.0",
+ "version": "2.1.0",
"description": "Bindings to wiringPi",
"main": "lib/exports.js",
"scripts": {
diff --git a/patchs/devLib_Makefile.patch b/patchs/devLib_Makefile.patch
index 8ae4125..cb9fc41 100644
--- a/patchs/devLib_Makefile.patch
+++ b/patchs/devLib_Makefile.patch
@@ -14,6 +14,6 @@
CC = gcc
-INCLUDE = -I.
+INCLUDE = -I. -I$(PWD)/../wiringPi
+ DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC
- LIBS =
diff --git a/src/addon.cc b/src/addon.cc
index ab1dec3..a7a58bc 100644
--- a/src/addon.cc
+++ b/src/addon.cc
@@ -20,12 +20,20 @@ bool find_int(const int value, const int array[], size_t s) {
return false;
}
+#if NODE_VERSION_AT_LEAST(0, 11, 0)
+void throw_error(v8::Isolate* isolate, const char* format, ...) {
+#else
void throw_error(const char* format, ...) {
+#endif
char buffer[256];
va_list args;
va_start(args, format);
vsnprintf(buffer, 156, format, args);
va_end(args);
- v8::ThrowException(v8::Exception::Error(v8::String::New(buffer)));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(isolate, buffer)));
+ #else
+ v8::ThrowException(v8::Exception::Error(v8::String::New(buffer)));
+ #endif
}
\ No newline at end of file
diff --git a/src/addon.h b/src/addon.h
index 666f552..091973e 100644
--- a/src/addon.h
+++ b/src/addon.h
@@ -2,6 +2,7 @@
#define _ADDON_H_
#include
+ #include
using namespace v8;
@@ -19,71 +20,157 @@
bool find_string(const char* string, const char* array[], size_t s);
bool find_int(const int value, const int array[], size_t s);
- void throw_error(const char* fmt, ...);
+
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ void throw_error(v8::Isolate* isolate, const char* fmt, ...);
+ #else
+ void throw_error(const char* fmt, ...);
+ #endif
+
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+
+ #define DECLARE(name) \
+ namespace nodemodule { \
+ static void name(const v8::FunctionCallbackInfo& args); \
+ }
+
+ #define IMPLEMENT(name) \
+ void nodemodule::name(const v8::FunctionCallbackInfo& args)
- #define DECLARE(name) \
- namespace nodemodule { \
- static v8::Handle name(const v8::Arguments& args); \
- }
+ #define EXPORT_FUNCTION(name) \
+ target->Set(v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
+ v8::FunctionTemplate::New(isolate, nodemodule::name)->GetFunction())
+
+ #define EXPORT_CONSTANT_INT(name) \
+ target->ForceSet(v8::String::NewFromUtf8(isolate, #name, v8::String::kInternalizedString), \
+ v8::Int32::New(isolate, name), static_cast(v8::ReadOnly | v8::DontDelete));
+
+ #define EXPORT_CONSTANT_STRING(name) \
+ target->ForceSet(v8::String::NewFrontUtf8(isolate, #name, v8::String::kInternalizedString), \
+ v8::String::NewFromUtf8(isolate, name), static_cast(v8::ReadOnly | v8::DontDelete));
- #define IMPLEMENT(name) \
- v8::Handle nodemodule::name(const v8::Arguments& args)
+ #define EXPORT_CONSTANT_INT_ARRAY(name, array, length) \
+ { \
+ v8::Local arr = v8::Array::New(isolate, length); \
+ 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), \
+ arr, static_cast(v8::ReadOnly | v8::DontDelete)); \
+ }
+
+ #define EXPORT_CONSTANT_STRING_ARRAY(name, array, length) \
+ { \
+ v8::Local arr = v8::Array::New(isolate, length); \
+ 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), \
+ arr, static_cast(v8::ReadOnly | v8::DontDelete)); \
+ }
- #define EXPORT_FUNCTION(name) \
- target->Set(v8::String::NewSymbol(#name), \
- v8::FunctionTemplate::New(nodemodule::name)->GetFunction())
+ #define NODE_MODULE_INIT() \
+ namespace nodemodule { \
+ void init(v8::Handle target); \
+ } \
+ void nodemodule::init(v8::Handle target)
- #define EXPORT_CONSTANT_INT(name) \
- target->Set(v8::String::NewSymbol(#name), \
- v8::Int32::New(name), static_cast(v8::ReadOnly | v8::DontDelete));
+ #define NODE_MODULE_DECLARE(name) NODE_MODULE(name, nodemodule::init)
+ #define IMPLEMENT_EXPORT_INIT(name) void nodemodule::init##name(v8::Isolate* isolate, v8::Handle target)
+ #define DECLARE_EXPORT_INIT(name) \
+ namespace nodemodule { \
+ void init##name(v8::Isolate* isolate, v8::Handle target); \
+ }
+
+ #define INIT(name) nodemodule::init##name(isolate, target);
+
+ #define SCOPE_OPEN() \
+ v8::Isolate* isolate = args.GetIsolate(); \
+ v8::HandleScope scope(isolate)
+ #define SCOPE_CLOSE(obj) args.GetReturnValue().Set(obj)
+
+ #else
- #define EXPORT_CONSTANT_STRING(name) \
- target->Set(v8::String::NewSymbol(#name), \
- v8::String::New(name), static_cast(v8::ReadOnly | v8::DontDelete));
+ #define DECLARE(name) \
+ namespace nodemodule { \
+ static v8::Handle name(const v8::Arguments& args); \
+ }
+
+ #define IMPLEMENT(name) \
+ v8::Handle nodemodule::name(const v8::Arguments& args)
- #define EXPORT_CONSTANT_INT_ARRAY(name, array, length) \
- { \
- v8::Local arr = v8::Array::New(); \
- for (int i = 0; i < length; i++) { \
- arr->Set(i, v8::Int32::New(array[i])); \
- } \
- target->Set(v8::String::NewSymbol(#name), arr, static_cast(v8::ReadOnly | v8::DontDelete)); \
- }
+ #define EXPORT_FUNCTION(name) \
+ target->Set(v8::String::NewSymbol(#name), \
+ v8::FunctionTemplate::New(nodemodule::name)->GetFunction())
+
+ #define EXPORT_CONSTANT_INT(name) \
+ target->Set(v8::String::NewSymbol(#name), \
+ v8::Int32::New(name), static_cast(v8::ReadOnly | v8::DontDelete));
- #define EXPORT_CONSTANT_STRING_ARRAY(name, array, length) \
- { \
- v8::Local arr = v8::Array::New(); \
- for (int i = 0; i < length; i++) { \
- arr->Set(i, v8::String::New(array[i])); \
+ #define EXPORT_CONSTANT_STRING(name) \
+ target->Set(v8::String::NewSymbol(#name), \
+ v8::String::New(name), static_cast(v8::ReadOnly | v8::DontDelete));
+
+ #define EXPORT_CONSTANT_INT_ARRAY(name, array, length) \
+ { \
+ v8::Local arr = v8::Array::New(length); \
+ for (int i = 0; i < length; i++) { \
+ arr->Set(i, v8::Int32::New(array[i])); \
+ } \
+ target->Set(v8::String::NewSymbol(#name), arr, static_cast(v8::ReadOnly | v8::DontDelete)); \
+ }
+
+ #define EXPORT_CONSTANT_STRING_ARRAY(name, array, length) \
+ { \
+ v8::Local arr = v8::Array::New(length); \
+ for (int i = 0; i < length; i++) { \
+ arr->Set(i, v8::String::New(array[i])); \
+ } \
+ target->Set(v8::String::NewSymbol(#name), arr, static_cast(v8::ReadOnly | v8::DontDelete)); \
+ }
+
+ #define NODE_MODULE_INIT() \
+ namespace nodemodule { \
+ void init(v8::Handle target); \
} \
- target->Set(v8::String::NewSymbol(#name), arr, static_cast(v8::ReadOnly | v8::DontDelete)); \
- }
-
- #define NODE_MODULE_INIT() \
- namespace nodemodule { \
- void init(v8::Handle target); \
- } \
- void nodemodule::init(v8::Handle target)
- #define NODE_MODULE_DECLARE(name) NODE_MODULE(name, nodemodule::init)
- #define IMPLEMENT_EXPORT_INIT(name) void nodemodule::init##name(v8::Handle target)
- #define DECLARE_EXPORT_INIT(name) \
- namespace nodemodule { \
- void init##name(v8::Handle target); \
- }
+ void nodemodule::init(v8::Handle target)
+ #define NODE_MODULE_DECLARE(name) NODE_MODULE(name, nodemodule::init)
+ #define IMPLEMENT_EXPORT_INIT(name) void nodemodule::init##name(v8::Handle target)
+ #define DECLARE_EXPORT_INIT(name) \
+ namespace nodemodule { \
+ void init##name(v8::Handle target); \
+ }
+
+ #define INIT(name) nodemodule::init##name(target);
+
+ #define SCOPE_OPEN() v8::HandleScope scope
+ #define SCOPE_CLOSE(obj) return scope.Close(obj)
+
+ #endif
+
- #define INIT(name) nodemodule::init##name(target);
- #define SCOPE_OPEN() v8::HandleScope scope
- #define SCOPE_CLOSE(obj) return scope.Close(obj)
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ #define UNDEFINED() v8::Undefined(isolate)
+ #define INT32(v) v8::Int32::New(isolate, v)
+ #define UINT32(v) v8::Uint32::NewFromUnsigned(isolate, v)
+ #define STRING(v) v8::String::NewFromUtf8(isolate, v)
+ #else
+ #define UNDEFINED() v8::Undefined()
+ #define INT32(v) v8::Int32::New(v)
+ #define UINT32(v) v8::Uint32::NewFromUnsigned(v)
+ #define STRING(v) v8::String::New(v)
+ #endif
- #define UNDEFINED() v8::Undefined()
- #define INT32(v) v8::Int32::New(v)
- #define UINT32(v) v8::Uint32::New(v)
- #define STRING(v) v8::String::New(v)
-
- #define THROW_ERROR(fmt, ...) \
- throw_error(fmt, __VA_ARGS__); \
- SCOPE_CLOSE(UNDEFINED())
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ #define THROW_ERROR(fmt, ...) \
+ throw_error(isolate, fmt, __VA_ARGS__); \
+ SCOPE_CLOSE(UNDEFINED());
+ #else
+ #define THROW_ERROR(fmt, ...) \
+ throw_error(fmt, __VA_ARGS__); \
+ SCOPE_CLOSE(UNDEFINED())
+ #endif
#define SET_ARGUMENT_NAME(id, name) static const char* arg##id = #name
#define GET_ARGUMENT_NAME(id) arg##id
@@ -122,7 +209,10 @@
#define GET_ARGUMENT_AS_NUMBER(id) GET_ARGUMENT_AS_TYPE(id, NumberValue)
#define GET_ARGUMENT_AS_STRING(id) GET_ARGUMENT_AS_TYPE(id, ToString)
#define GET_ARGUMENT_AS_LOCAL_FUNCTION(id) v8::Local::Cast(args[id])
- #define GET_ARGUMENT_AS_PERSISTENT_FUNCTION(id) v8::Persistent::New(GET_ARGUMENT_AS_LOCAL_FUNCTION(id))
+
+ #if !NODE_VERSION_AT_LEAST(0, 11, 0)
+ #define GET_ARGUMENT_AS_PERSISTENT_FUNCTION(id) v8::Persistent::New(GET_ARGUMENT_AS_LOCAL_FUNCTION(id))
+ #endif
#define LIST(...) { __VA_ARGS__ }
#define CHECK_ARGUMENT_IN_STRINGS(id, value, T) \
diff --git a/src/devlib/ds1302.cc b/src/devlib/ds1302.cc
index fe6e127..15ba05a 100644
--- a/src/devlib/ds1302.cc
+++ b/src/devlib/ds1302.cc
@@ -94,9 +94,17 @@ IMPLEMENT(ds1302clockRead) {
int clockData[8];
::ds1302clockRead(clockData);
- v8::Local res = v8::Array::New(8);
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::Local res = v8::Array::New(isolate, 8);
+ #else
+ v8::Local res = v8::Array::New(8);
+ #endif
for (int i = 0; i < 8; i++) {
- res->Set(i, v8::Int32::New(clockData[i]));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ res->Set(i, v8::Int32::New(isolate, clockData[i]));
+ #else
+ res->Set(i, v8::Int32::New(clockData[i]));
+ #endif
}
SCOPE_CLOSE(res);
diff --git a/src/devlib/lcd.cc b/src/devlib/lcd.cc
index 6fbd787..32495e8 100644
--- a/src/devlib/lcd.cc
+++ b/src/devlib/lcd.cc
@@ -203,7 +203,11 @@ IMPLEMENT(lcdPuts) {
CHECK_ARGUMENT_TYPE_STRING(1);
int fd = GET_ARGUMENT_AS_INT32(0);
- v8::String::AsciiValue data(GET_ARGUMENT_AS_STRING(1));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::String::Utf8Value data(GET_ARGUMENT_AS_STRING(1));
+ #else
+ v8::String::AsciiValue data(GET_ARGUMENT_AS_STRING(1));
+ #endif
::lcdPuts(fd, *data);
diff --git a/src/devlib/lcd128x64.cc b/src/devlib/lcd128x64.cc
index 2e4c2bb..1a6ffe1 100644
--- a/src/devlib/lcd128x64.cc
+++ b/src/devlib/lcd128x64.cc
@@ -60,9 +60,15 @@ IMPLEMENT(lcd128x64orientCoordinates) {
int x, y;
::lcd128x64orientCoordinates(&x, &y);
- v8::Local res = v8::Array::New(2);
- res->Set(0, v8::Int32::New(x));
- res->Set(1, v8::Int32::New(y));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::Local res = v8::Array::New(isolate, 2);
+ res->Set(0, v8::Int32::New(isolate, x));
+ res->Set(1, v8::Int32::New(isolate, y));
+ #else
+ v8::Local res = v8::Array::New(2);
+ res->Set(0, v8::Int32::New(x));
+ res->Set(1, v8::Int32::New(y));
+ #endif
SCOPE_CLOSE(res);
}
@@ -75,9 +81,15 @@ IMPLEMENT(lcd128x64getScreenSize) {
int x, y;
::lcd128x64getScreenSize(&x, &y);
- v8::Local res = v8::Array::New(2);
- res->Set(0, v8::Int32::New(x));
- res->Set(1, v8::Int32::New(y));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::Local res = v8::Array::New(isolate, 2);
+ res->Set(0, v8::Int32::New(isolate, x));
+ res->Set(1, v8::Int32::New(isolate, y));
+ #else
+ v8::Local res = v8::Array::New(2);
+ res->Set(0, v8::Int32::New(x));
+ res->Set(1, v8::Int32::New(y));
+ #endif
SCOPE_CLOSE(res);
}
@@ -291,7 +303,11 @@ IMPLEMENT(lcd128x64puts) {
int x = GET_ARGUMENT_AS_INT32(0);
int y = GET_ARGUMENT_AS_INT32(1);
- v8::String::AsciiValue string(GET_ARGUMENT_AS_STRING(2));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::String::Utf8Value string(GET_ARGUMENT_AS_STRING(2));
+ #else
+ v8::String::AsciiValue string(GET_ARGUMENT_AS_STRING(2));
+ #endif
int bgColor = GET_ARGUMENT_AS_INT32(3);
int fgColor = GET_ARGUMENT_AS_INT32(4);
diff --git a/src/devlib/maxdetect.cc b/src/devlib/maxdetect.cc
index 75b674c..e921d46 100644
--- a/src/devlib/maxdetect.cc
+++ b/src/devlib/maxdetect.cc
@@ -18,13 +18,26 @@ IMPLEMENT(maxDetectRead) {
unsigned char buffer[4];
int res = ::maxDetectRead(pin, buffer);
- v8::Local data = v8::Array::New(4);
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::Local data = v8::Array::New(isolate, 4);
+ #else
+ v8::Local data = v8::Array::New(4);
+ #endif
for (int i = 0; i < 4; i++) {
- data->Set(i, Int32::New(buffer[i]));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ data->Set(i, Int32::New(isolate, buffer[i]));
+ #else
+ data->Set(i, Int32::New(buffer[i]));
+ #endif
}
- v8::Local ret = v8::Array::New(2);
- ret->Set(0, Int32::New(res));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::Local ret = v8::Array::New(isolate, 2);
+ ret->Set(0, Int32::New(isolate, res));
+ #else
+ v8::Local ret = v8::Array::New(2);
+ ret->Set(0, Int32::New(res));
+ #endif
ret->Set(1, data);
SCOPE_CLOSE(ret);
@@ -44,10 +57,17 @@ IMPLEMENT(readRHT03) {
int temp, rh;
int res = ::readRHT03(pin, &temp, &rh);
- v8::Local ret = v8::Array::New(3);
- ret->Set(0, v8::Int32::New(res));
- ret->Set(1, v8::Int32::New(temp));
- ret->Set(2, v8::Int32::New(rh));
+ #if NODE_VERSION_AT_LEAST(0, 11, 0)
+ v8::Local ret = v8::Array::New(isolate, 3);
+ ret->Set(0, v8::Int32::New(isolate, res));
+ ret->Set(1, v8::Int32::New(isolate, temp));
+ ret->Set(2, v8::Int32::New(isolate, rh));
+ #else
+ v8::Local ret = v8::Array::New(3);
+ ret->Set(0, v8::Int32::New(res));
+ ret->Set(1, v8::Int32::New(temp));
+ ret->Set(2, v8::Int32::New(rh));
+ #endif
SCOPE_CLOSE(ret);
}
diff --git a/src/devlib/tcs34725.cc b/src/devlib/tcs34725.cc
index d25026d..b07b27a 100644
--- a/src/devlib/tcs34725.cc
+++ b/src/devlib/tcs34725.cc
@@ -26,11 +26,19 @@ IMPLEMENT(tcs34725ReadRGBC) {
::tcs34725ReadRGBC(id, &r, &g, &b, &c);
- Local