bma220: Initial implementation

This driver was developed based on the DFRobot Triple Axis
accelerometer BMA220 (Tiny):

http://www.dfrobot.com/index.php?route=product/product&product_id=1085

This device can only run at 3.3v DC.  Do not connect to 5v.

Added a private function definition for the installISR function. Done because C++
wasn't able to find the function definition for the java bindings.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Jon Trulson
2015-10-15 11:39:56 -07:00
committed by Abhishek Malik
parent 53bc249b75
commit db721845db
10 changed files with 1611 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
%module(directors="1") javaupm_bma220
%include "../upm.i"
%include "cpointer.i"
%include "typemaps.i"
%include "arrays_java.i";
%include "../java_buffer.i"
%feature("director") IsrCallback;
%ignore generic_callback_isr;
%include "../IsrCallback.h"
%apply int {mraa::Edge};
%apply float *INOUT { float *x, float *y, float *z };
%typemap(jni) float* "jfloatArray"
%typemap(jstype) float* "float[]"
%typemap(jtype) float* "float[]"
%typemap(javaout) float* {
return $jnicall;
}
%typemap(out) float *getAccelerometer {
$result = JCALL1(NewFloatArray, jenv, 3);
JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
delete [] $1;
}
%ignore getAccelerometer(float *, float *, float *);
%{
#include "bma220.h"
%}
%include "bma220.h"