mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 09:21:12 +03:00
lsm303: rename to lsm303dlh
There are a variety of LSM303 devices out there with various incompatibilities and differing capabilities. The current lsm303 driver in UPM only supports the LSM303DLH variant, so it has been renamed to lsm303dlh to avoid confusion and to make it clear which variant is actually supported. All examples and source files have been renamed, including header files. In addition, the class name, LSM303, has been renamed to LSM303DLH. No other functionality or behavior has been changed. Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@ -25,19 +25,19 @@
|
||||
#include <iostream>
|
||||
|
||||
//! [Interesting]
|
||||
#include "lsm303.hpp"
|
||||
#include "lsm303dlh.hpp"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Instantiate LSM303 compass on I2C
|
||||
upm::LSM303 *sensor = new upm::LSM303(0);
|
||||
// Instantiate LSM303DLH compass on I2C
|
||||
upm::LSM303DLH *sensor = new upm::LSM303DLH(0);
|
||||
|
||||
// Get the coordinate data
|
||||
sensor->getCoordinates();
|
||||
int16_t* coor = sensor->getRawCoorData(); // in XYZ order.
|
||||
int16_t* coor = sensor->getRawCoorData(); // in XYZ order.
|
||||
// The sensor returns XZY, but the driver compensates and makes it XYZ
|
||||
|
||||
|
||||
// Print out the X, Y, and Z coordinate data using two different methods
|
||||
std::cout << "coor: rX " << (int)coor[0]
|
||||
<< " - rY " << (int)coor[1]
|
@ -86,7 +86,7 @@ add_example(Itg3200Sample itg3200)
|
||||
add_example(Joystick12Sample joystick12)
|
||||
add_example(LDT0028Sample ldt0028)
|
||||
add_example(LoLSample lol)
|
||||
add_example(LSM303Sample lsm303)
|
||||
add_example(LSM303DLHSample lsm303dlh)
|
||||
add_example(M24LR64ESample m24lr64e)
|
||||
add_example(MAX44000Sample max44000)
|
||||
add_example(MHZ16Sample mhz16)
|
||||
|
@ -23,12 +23,12 @@
|
||||
*/
|
||||
|
||||
//NOT TESTED!!!
|
||||
public class LSM303Sample {
|
||||
public class LSM303DLHSample {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// ! [Interesting]
|
||||
// Instantiate LSM303 compass on I2C
|
||||
upm_lsm303.LSM303 sensor = new upm_lsm303.LSM303(0);
|
||||
// Instantiate LSM303DLH compass on I2C
|
||||
upm_lsm303dlh.LSM303DLH sensor = new upm_lsm303dlh.LSM303DLH(0);
|
||||
|
||||
// Get the coordinate data
|
||||
sensor.getCoordinates();
|
||||
@ -56,4 +56,4 @@ public class LSM303Sample {
|
||||
// ! [Interesting]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -22,15 +22,15 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
var accelrCompassSensor = require('jsupm_lsm303');
|
||||
var accelrCompassSensor = require('jsupm_lsm303dlh');
|
||||
|
||||
// Instantiate LSM303 compass on I2C
|
||||
var myAccelrCompass = new accelrCompassSensor.LSM303(0);
|
||||
// Instantiate LSM303DLH compass on I2C
|
||||
var myAccelrCompass = new accelrCompassSensor.LSM303DLH(0);
|
||||
|
||||
var successFail, coords, outputStr, accel;
|
||||
var myInterval = setInterval(function()
|
||||
{
|
||||
// Load coordinates into LSM303 object
|
||||
// Load coordinates into LSM303DLH object
|
||||
successFail = myAccelrCompass.getCoordinates();
|
||||
// in XYZ order. The sensor returns XZY,
|
||||
// but the driver compensates and makes it XYZ
|
@ -25,11 +25,11 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import time, sys, signal, atexit
|
||||
from upm import pyupm_lsm303 as lsm303
|
||||
from upm import pyupm_lsm303dlh as lsm303dlh
|
||||
|
||||
def main():
|
||||
# Instantiate LSM303 compass on I2C
|
||||
myAccelrCompass = lsm303.LSM303(0)
|
||||
# Instantiate LSM303DLH compass on I2C
|
||||
myAccelrCompass = lsm303dlh.LSM303DLH(0)
|
||||
|
||||
## Exit handlers ##
|
||||
# This stops python from printing a stacktrace when you hit control-C
|
||||
@ -47,7 +47,7 @@ def main():
|
||||
signal.signal(signal.SIGINT, SIGINTHandler)
|
||||
|
||||
while(1):
|
||||
# Load coordinates into LSM303 object
|
||||
# Load coordinates into LSM303DLH object
|
||||
successFail = myAccelrCompass.getCoordinates()
|
||||
# in XYZ order. The sensor returns XZY,
|
||||
# but the driver compensates and makes it XYZ
|
Reference in New Issue
Block a user