1 %module javaupm_adxl345
2 %include "../upm.i"
3 
4 %{
5     #include "adxl345.h"
6 %}
7 
8 %typemap(jni) float* "jfloatArray"
9 %typemap(jstype) float* "float[]"
10 %typemap(jtype) float* "float[]"
11 
12 %typemap(javaout) float* {
13     return $jnicall;
14 }
15 
16 %typemap(out) float * {
17     $result = JCALL1(NewFloatArray, jenv, 3);
18     JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
19     delete [] $1;
20 }
21 
22 
23 %typemap(jni) int16_t* "jshortArray"
24 %typemap(jstype) int16_t* "short[]"
25 %typemap(jtype) int16_t* "short[]"
26 
27 %typemap(javaout) int16_t* {
28     return $jnicall;
29 }
30 
31 %typemap(out) int16_t *getRawValues {
32     $result = JCALL1(NewShortArray, jenv, 3);
33     JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (jshort*)$1);
34     delete [] $1;
35 }
36 
37 %include "adxl345.h"
38