mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
java: fix Java return type for readData in MMA7455
Signed-off-by: Petre <petre.p.eftime@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
4f30959a43
commit
ea669ddfc6
@ -10,4 +10,20 @@
|
||||
#include "mma7455.h"
|
||||
%}
|
||||
|
||||
%typemap(jni) short* "jshortArray"
|
||||
%typemap(jstype) short* "short[]"
|
||||
%typemap(jtype) short* "short[]"
|
||||
|
||||
%typemap(javaout) short* {
|
||||
return $jnicall;
|
||||
}
|
||||
|
||||
%typemap(out) short *readData {
|
||||
$result = JCALL1(NewShortArray, jenv, 3);
|
||||
JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (const signed short*)$1);
|
||||
delete [] $1;
|
||||
}
|
||||
|
||||
%ignore readData(short *, short *, short *);
|
||||
|
||||
%include "mma7455.h"
|
||||
|
@ -137,6 +137,14 @@ MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) {
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
short *MMA7455::readData() {
|
||||
short *v = new short[3];
|
||||
readData(&v[0], &v[1], &v[2]);
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
MMA7455::ic2ReadReg (unsigned char reg, unsigned char * buf, unsigned char size) {
|
||||
if (MRAA_SUCCESS != mraa_i2c_address(m_i2ControlCtx, m_controlAddr)) {
|
||||
|
@ -206,6 +206,15 @@ class MMA7455 {
|
||||
*/
|
||||
mraa_result_t readData (short * ptrX, short * ptrY, short * ptrZ);
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
/**
|
||||
* Reads X-axis, Y-axis, and Z-axis acceleration data
|
||||
*
|
||||
* @return Array containing X, Y, Z acceleration data
|
||||
*/
|
||||
short *readData ();
|
||||
#endif
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user