upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
API for the LSM303DLH Accelerometer & Compass. More...
This module defines the LSM303DLHDLH 3-axis magnetometer/3-axis accelerometer. This module was tested with the Seeed Studio* Grove 6-Axis Accelerometer & Compass module used over I2C. The magnetometer and acceleromter are accessed at two seperate I2C addresses.
Public Types | |
enum | LSM303DLH_SLAVE_T { LSM303DLH_MAG_T = 0, LSM303DLH_ACC_T } |
Public Member Functions | |
LSM303DLH (int bus, int addrMag=LSM303DLH_MAG, int addrAcc=LSM303DLH_ACC, int accScale=8) | |
float | getHeading () |
mraa::Result | getCoordinates () |
mraa::Result | getAcceleration () |
int16_t * | getRawCoorData () |
int16_t | getCoorX () |
int16_t | getCoorY () |
int16_t | getCoorZ () |
int16_t * | getRawAccelData () |
int16_t | getAccelX () |
int16_t | getAccelY () |
int16_t | getAccelZ () |
LSM303DLH | ( | int | bus, |
int | addrMag = LSM303DLH_MAG , |
||
int | addrAcc = LSM303DLH_ACC , |
||
int | accScale = 8 |
||
) |
Instantiates an LSM303DLH object
bus | I2C bus to use |
addrMag | I2C address of the Magnetometer (default 0x1E) |
addrAcc | I2C address of the Accelerometer (default 0x19) |
accScale | Accelerometer scale, can be 2, 4 or 8 (default 8) |
float getHeading | ( | ) |
LSM303DLH object destructor where is no more need for this here - I2c connection will be stopped automatically when m_i2c variable will go out of scope ~LSM303DLH (); Gets the current heading; headings <0 indicate an error has occurred
mraa::Result getCoordinates | ( | ) |
Gets the coordinates in the XYZ order
mraa::Result getAcceleration | ( | ) |
Gets accelerometer values Should be called before other "get" functions for acceleration
int16_t * getRawCoorData | ( | ) |
Gets raw coordinate data; it is updated when getCoordinates() is called
int16_t getCoorX | ( | ) |
Gets the X component of the coordinates data
int16_t getCoorY | ( | ) |
Gets the Y component of the coordinates data
int16_t getCoorZ | ( | ) |
Gets the Z component of the coordinates data
int16_t * getRawAccelData | ( | ) |
Gets raw accelerometer data; it is updated when getAcceleration() is called
int16_t getAccelX | ( | ) |
Gets the X component of the acceleration data
int16_t getAccelY | ( | ) |
Gets the Y component of the acceleration data
int16_t getAccelZ | ( | ) |
Gets the Z component of the acceleration data