From a7f7ac478fd80b7da09768f0309ea0f36b02c06b Mon Sep 17 00:00:00 2001 From: Leandre Gohy Date: Fri, 4 Jul 2014 20:24:09 +0200 Subject: [PATCH] devlib support fix compilation errors --- binding.gyp | 3 ++- src/devlib/ds1302.cc | 3 ++- src/devlib/gertboard.cc | 2 +- src/devlib/lcd.cc | 6 +++--- src/devlib/lcd128x64.cc | 16 ++++++++-------- src/devlib/maxdetect.cc | 4 ++-- src/devlib/piGlow.cc | 6 +++--- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/binding.gyp b/binding.gyp index 2449a72..b122b75 100644 --- a/binding.gyp +++ b/binding.gyp @@ -46,7 +46,8 @@ 'src/devlib/piNes.cc' ], 'include_dirs': [ - 'wiringpi/wiringPi' + 'wiringpi/wiringPi', + 'wiringpi/devLib' ], 'libraries': [ ' DECLARE(ds1302rtcRead); @@ -41,6 +41,7 @@ IMPLEMENT(ds1302rtcWrite) { CHECK_ARGUMENTS_LENGTH_EQUAL(2); CHECK_ARGUMENT_TYPE_INT32(0); + CHECK_ARGUMENT_TYPE_INT32(1); int reg = GET_ARGUMENT_AS_INT32(0); unsigned int data = GET_ARGUMENT_AS_UINT32(1); diff --git a/src/devlib/gertboard.cc b/src/devlib/gertboard.cc index 17387b3..8cc9b37 100644 --- a/src/devlib/gertboard.cc +++ b/src/devlib/gertboard.cc @@ -14,7 +14,7 @@ IMPLEMENT(gertboardAnalogSetup) { int pinBase = GET_ARGUMENT_AS_INT32(0); - int res = ::getboardAnalogSetup(pinBase); + int res = ::gertboardAnalogSetup(pinBase); SCOPE_CLOSE(INT32(res)); } diff --git a/src/devlib/lcd.cc b/src/devlib/lcd.cc index 8866800..6fbd787 100644 --- a/src/devlib/lcd.cc +++ b/src/devlib/lcd.cc @@ -156,15 +156,15 @@ IMPLEMENT(lcdCharDef) { CHECK_ARGUMENT_TYPE_INT32(0); CHECK_ARGUMENT_TYPE_INT32(1); CHECK_ARGUMENT_TYPE_ARRAY(2); - CHECK_ARGUMENT_ARRAY_LENGTH(8); + CHECK_ARGUMENT_ARRAY_LENGTH(2, 8); int fd = GET_ARGUMENT_AS_INT32(0); int index = GET_ARGUMENT_AS_INT32(1); v8::Local data = v8::Local::Cast(args[2]); - unsigned int ar[8]; + unsigned char ar[8]; for (int i = 0; i < 8; i++) { - ar[i] = data->Get(i)->Uint32Value(); + ar[i] = data->Get(i)->Uint32Value() & 0xFF; } ::lcdCharDef(fd, index, ar); diff --git a/src/devlib/lcd128x64.cc b/src/devlib/lcd128x64.cc index 9f9717c..2e4c2bb 100644 --- a/src/devlib/lcd128x64.cc +++ b/src/devlib/lcd128x64.cc @@ -21,7 +21,7 @@ IMPLEMENT(lcd128x64setOrigin) { SCOPE_OPEN(); SET_ARGUMENT_NAME(0, x); - SET_ARGUMENT_NAME(0, y); + SET_ARGUMENT_NAME(1, y); CHECK_ARGUMENTS_LENGTH_EQUAL(2); @@ -61,8 +61,8 @@ IMPLEMENT(lcd128x64orientCoordinates) { ::lcd128x64orientCoordinates(&x, &y); v8::Local res = v8::Array::New(2); - res->Set(i, v8::Int32::New(x)); - res->Set(i, v8::Int32::New(y)); + res->Set(0, v8::Int32::New(x)); + res->Set(1, v8::Int32::New(y)); SCOPE_CLOSE(res); } @@ -73,11 +73,11 @@ IMPLEMENT(lcd128x64getScreenSize) { CHECK_ARGUMENTS_LENGTH_EQUAL(0); int x, y; - ::lcd128x64screenSize(&x, &y); + ::lcd128x64getScreenSize(&x, &y); v8::Local res = v8::Array::New(2); - res->Set(i, v8::Int32::New(x)); - res->Set(i, v8::Int32::New(y)); + res->Set(0, v8::Int32::New(x)); + res->Set(1, v8::Int32::New(y)); SCOPE_CLOSE(res); } @@ -291,11 +291,11 @@ IMPLEMENT(lcd128x64puts) { int x = GET_ARGUMENT_AS_INT32(0); int y = GET_ARGUMENT_AS_INT32(1); - v8::String::AsciiValue(GET_ARGUMENT_AS_STRING(2)) + v8::String::AsciiValue string(GET_ARGUMENT_AS_STRING(2)); int bgColor = GET_ARGUMENT_AS_INT32(3); int fgColor = GET_ARGUMENT_AS_INT32(4); - ::lcd128x64puts(x, y, c, bgColor, fgColor); + ::lcd128x64puts(x, y, *string, bgColor, fgColor); SCOPE_CLOSE(UNDEFINED()); } diff --git a/src/devlib/maxdetect.cc b/src/devlib/maxdetect.cc index 3163dc3..75b674c 100644 --- a/src/devlib/maxdetect.cc +++ b/src/devlib/maxdetect.cc @@ -39,9 +39,9 @@ IMPLEMENT(readRHT03) { CHECK_ARGUMENT_TYPE_INT32(0); - int pin = GET_ARGUMENT_AS_INT32; + int pin = GET_ARGUMENT_AS_INT32(0); - int temp, int rh; + int temp, rh; int res = ::readRHT03(pin, &temp, &rh); v8::Local ret = v8::Array::New(3); diff --git a/src/devlib/piGlow.cc b/src/devlib/piGlow.cc index ea66211..ef89e11 100644 --- a/src/devlib/piGlow.cc +++ b/src/devlib/piGlow.cc @@ -7,7 +7,7 @@ DECLARE(piGlowRing); DECLARE(piGlowSetup); IMPLEMENT(piGlow1) { - OPEN_SCOPE(); + SCOPE_OPEN(); SET_ARGUMENT_NAME(0, leg); SET_ARGUMENT_NAME(1, ring); @@ -29,7 +29,7 @@ IMPLEMENT(piGlow1) { } IMPLEMENT(piGlowLeg) { - OPEN_SCOPE(); + SCOPE_OPEN(); SET_ARGUMENT_NAME(0, leg); SET_ARGUMENT_NAME(1, intensity); @@ -48,7 +48,7 @@ IMPLEMENT(piGlowLeg) { } IMPLEMENT(piGlowRing) { - OPEN_SCOPE(); + SCOPE_OPEN(); SET_ARGUMENT_NAME(0, ring); SET_ARGUMENT_NAME(1, intensity);