Private
Public Access
2
0

mraajava.i: Return array properly for SPI write

Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Petre Eftime
2015-09-14 17:12:43 +03:00
committed by Brendan Le Foll
parent 5c7bab1c79
commit c9c6ac785a

View File

@@ -35,5 +35,23 @@
$2 = JCALL1(GetArrayLength, jenv, $input);
}
%typemap(jtype) uint8_t * "byte[]"
%typemap(jstype) uint8_t * "byte[]"
%typemap(jni) uint8_t * "jbyteArray"
%typemap(javaout) uint8_t * {
return $jnicall;
}
namespace mraa {
class Spi;
%typemap(out) uint8_t*
{
// need to loop over length
$result = JCALL1(NewByteArray, jenv, arg3);
JCALL4(SetByteArrayRegion, jenv, $result, 0, arg3, (jbyte *) $1);
free($1);
}
}
%feature("director") IsrCallback;
%include ../mraa.i