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:
committed by
Brendan Le Foll
parent
5c7bab1c79
commit
c9c6ac785a
@@ -35,5 +35,23 @@
|
|||||||
$2 = JCALL1(GetArrayLength, jenv, $input);
|
$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;
|
%feature("director") IsrCallback;
|
||||||
%include ../mraa.i
|
%include ../mraa.i
|
||||||
|
|||||||
Reference in New Issue
Block a user