upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
API for the LSM303 Accelerometer & Compass. More...
This module defines the LSM303DLH 3-axis magnetometer/3-axis accelerometer. This module was tested with the Seeed Studio* Grove 6-Axis Accelerometer & Compass module used over I2C. The magnometer and acceleromter are accessed at two seperate I2C addresses.
Public Member Functions | |
LSM303 (int bus, int addrMag=LSM303_MAG, int addrAcc=LSM303_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 () |
LSM303 | ( | int | bus, |
int | addrMag = LSM303_MAG , |
||
int | addrAcc = LSM303_ACC , |
||
int | accScale = 8 |
||
) |
Instantiates an LSM303 object
i2c | bus |
addr | Magnetometer |
addr | Accelerometer |
float getHeading | ( | ) |
LSM303 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 ~LSM303 (); 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