mraajs.i: add %include carrays.i to fix generation with SWIG 3.0.4
Fixes #97 Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -2,19 +2,18 @@
|
|||||||
|
|
||||||
%feature("autodoc", "3");
|
%feature("autodoc", "3");
|
||||||
|
|
||||||
|
%include carrays.i
|
||||||
%array_class(uint8_t, uint8Array);
|
%array_class(uint8_t, uint8Array);
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
#include <node_buffer.h>
|
#include <node_buffer.h>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// i2c write()
|
|
||||||
%typemap(in) (const uint8_t *data, int length) {
|
%typemap(in) (const uint8_t *data, int length) {
|
||||||
$1 = (uint8_t*) node::Buffer::Data($input);
|
$1 = (uint8_t*) node::Buffer::Data($input);
|
||||||
$2 = node::Buffer::Length($input);
|
$2 = node::Buffer::Length($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spi write()
|
|
||||||
%typemap(in) (uint8_t *txBuf, int length) {
|
%typemap(in) (uint8_t *txBuf, int length) {
|
||||||
$1 = (uint8_t*) node::Buffer::Data($input);
|
$1 = (uint8_t*) node::Buffer::Data($input);
|
||||||
$2 = node::Buffer::Length($input);
|
$2 = node::Buffer::Length($input);
|
||||||
@@ -24,7 +23,6 @@ namespace mraa {
|
|||||||
class Spi;
|
class Spi;
|
||||||
%typemap(out) uint8_t*
|
%typemap(out) uint8_t*
|
||||||
{
|
{
|
||||||
// need to loop over length
|
|
||||||
$result = node::Buffer::New((char*) $1, arg3)->handle_;
|
$result = node::Buffer::New((char*) $1, arg3)->handle_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,8 +50,6 @@ class Spi;
|
|||||||
SWIG_exception_fail(SWIG_ERROR, "I2c write failed");
|
SWIG_exception_fail(SWIG_ERROR, "I2c write failed");
|
||||||
SWIGV8_RETURN(v8::Undefined());
|
SWIGV8_RETURN(v8::Undefined());
|
||||||
}
|
}
|
||||||
// Append output value $1 to $result
|
|
||||||
// return the v8::handle of the node_buffer
|
|
||||||
$result = node::Buffer::New((char*) $1, result)->handle_;
|
$result = node::Buffer::New((char*) $1, result)->handle_;
|
||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user