bmpx8x: rewrite in C; FTI; C++ wraps C

This driver has been rewritten from scratch.

See docs/apichanges.md for a list of API compatibility changes
compared to the original driver.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson
2017-04-04 17:48:41 -06:00
parent 8d43c431f2
commit c57a0d2c30
17 changed files with 1346 additions and 424 deletions

View File

@ -1,6 +1,7 @@
/*
* Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
* Copyright (c) 2015 Intel Corporation.
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015-2017 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -22,27 +23,33 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//NOT TESTED!!!
public class BMPX8XSample {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]
// Instantiate a BMPX8X sensor on I2C
upm_bmpx8x.BMPX8X sensor = new upm_bmpx8x.BMPX8X(0);
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]
// Print the pressure, altitude, sea level, and
// temperature values every second
while (true) {
System.out.println("Pressure: " + sensor.getPressure());
System.out.println("Altitude: " + sensor.getAltitude());
System.out.println("Sealevel pressure: "
+ sensor.getSealevelPressure());
System.out.println("Temperature: " + sensor.getTemperature());
System.out.println();
// Instantiate a BMPX8X sensor on I2C using defaults.
upm_bmpx8x.BMPX8X sensor = new upm_bmpx8x.BMPX8X();
Thread.sleep(1000);
}
// ! [Interesting]
}
// Print the pressure, altitude, sea level, and
// temperature values every .5 seconds
while (true)
{
sensor.update();
}
System.out.println("Pressure: "
+ sensor.getPressure()
+ " Pa, Temperature: "
+ sensor.getTemperature()
+ " C, Altitude: "
+ sensor.getAltitude()
+ " m, Sea level: "
+ sensor.getSealevelPressure()
+ " Pa");
Thread.sleep(500);
}
// ! [Interesting]
}
}