mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 09:21:12 +03:00
SWIGJAVA: Remove the last JAVA ifdefs from src
Removed all references to #ifdef SWIGJAVA and JAVACALLBACK from the library source. All java-specific source code has been moved to the corresponding library's .i file for java. * Update library source * Update examples where necessary * The function pointer methodology has been remove from libraries which provided callbacks as both a class and a function pointer implementation. Examples were updated to use the class version of callbacks. * Updated documentation for SWIGJAVA Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -23,12 +23,14 @@
|
||||
*/
|
||||
|
||||
//NOT TESTED!!!
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.lang.Float;
|
||||
|
||||
public class H3LIS331DLSample {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
//! [Interesting]
|
||||
int[] val;
|
||||
float[] accel;
|
||||
|
||||
// Instantiate an H3LIS331DL on I2C bus 0
|
||||
upm_h3lis331dl.H3LIS331DL sensor = new upm_h3lis331dl.H3LIS331DL(0);
|
||||
@ -39,14 +41,14 @@ public class H3LIS331DLSample {
|
||||
while(true){
|
||||
sensor.update();
|
||||
|
||||
val = sensor.getRawXYZ();
|
||||
System.out.println( "Raw: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2] );
|
||||
upm_h3lis331dl.IntVector val = sensor.getRawXYZ();
|
||||
System.out.println( "Raw: X: " + val.get(0) + " Y: " + val.get(1) + " Z: " + val.get(2) );
|
||||
|
||||
accel = sensor.getAcceleration();
|
||||
System.out.println( "Acceleration: X: " + accel[0] + " Y: " + accel[1] + " Z: " + accel[2] );
|
||||
upm_h3lis331dl.FloatVector accel = sensor.getAcceleration();
|
||||
System.out.println( "Acceleration: X: " + accel.get(0) + " Y: " + accel.get(1) + " Z: " + accel.get(2) );
|
||||
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
//! [Interesting]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,15 +28,14 @@ public class MMA7455Sample {
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// ! [Interesting]
|
||||
upm_mma7455.MMA7455 sensor = new upm_mma7455.MMA7455(0);
|
||||
short[] val;
|
||||
|
||||
while (true) {
|
||||
val = sensor.readData();
|
||||
System.out.println("Accelerometer X: " + val[0] + ", Y: " + val[1] + ", Z: " + val[2]);
|
||||
upm_mma7455.ShortVector val = sensor.readData();
|
||||
System.out.println("Accelerometer X: " + val.get(0) + ", Y: " + val.get(1) + ", Z: " + val.get(2));
|
||||
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
// ! [Interesting]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ public class MMA7660Sample
|
||||
|
||||
while (true)
|
||||
{
|
||||
float acceleration[] = accel.getAcceleration();
|
||||
upm_mma7660.FloatVector acceleration = accel.getAcceleration();
|
||||
System.out.println("Acceleration: x = "
|
||||
+ acceleration[0]
|
||||
+ acceleration.get(0)
|
||||
+ " y = "
|
||||
+ acceleration[1]
|
||||
+ acceleration.get(1)
|
||||
+ " x = "
|
||||
+ acceleration[2]);
|
||||
+ acceleration.get(2));
|
||||
|
||||
System.out.println();
|
||||
|
||||
|
@ -43,9 +43,8 @@ public class MPU9150Sample {
|
||||
// System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
|
||||
// + gyro[2]);
|
||||
|
||||
float[] magn = sensor.getMagnetometer();
|
||||
System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
|
||||
+ magn[2]);
|
||||
upm_mpu9150.FloatVector magn = sensor.getMagnetometer();
|
||||
System.out.println("Magnetometer: " + "MX: " + magn.get(0) + " MY: " + magn.get(1) + " MZ: " + magn.get(2));
|
||||
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user