1 %module javaupm_adxl335 2 %include "../upm.i" 3 %include "cpointer.i" 4 %include "typemaps.i" 5 6 %apply int *OUTPUT { int *xVal, int *yVal, int *zVal }; 7 %apply float *OUTPUT { float *xAccel, float *yAccel, float *zAccel }; 8 9 %{ 10 #include "adxl335.h" 11 %} 12 13 %typemap(jni) float* "jfloatArray" 14 %typemap(jstype) float* "float[]" 15 %typemap(jtype) float* "float[]" 16 17 %typemap(javaout) float* { 18 return $jnicall; 19 } 20 21 %typemap(out) float *acceleration { 22 $result = JCALL1(NewFloatArray, jenv, 3); 23 JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1); 24 } 25 26 %typemap(jni) int* "jintArray" 27 %typemap(jstype) int* "int[]" 28 %typemap(jtype) int* "int[]" 29 30 %typemap(javaout) int* { 31 return $jnicall; 32 } 33 34 %typemap(out) int *values { 35 $result = JCALL1(NewIntArray, jenv, 3); 36 JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1); 37 delete [] $1; 38 } 39 40 %ignore values(int *, int *, int *); 41 %ignore acceleration(float *, float *, float *); 42 43 %include "adxl335.h" 44