lsm303: add quick accel data functions

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll 2014-09-18 16:31:58 +01:00
parent d0999cf778
commit e7a32b9882
2 changed files with 26 additions and 2 deletions

View File

@ -109,6 +109,24 @@ LSM303::getRawCoorData()
return &coor[0];
}
uint8_t
LSM303::getAccelY()
{
return accel[2];
}
uint8_t
LSM303::getAccelZ()
{
return accel[0];
}
uint8_t
LSM303::getAccelX()
{
return accel[1];
}
mraa_result_t
LSM303::getCoordinates()
{

View File

@ -79,7 +79,7 @@ class LSM303 {
*
* @param i2c bus
* @param addr magometer
* @param addr accelerometer
* @param addr accelerometer
*/
LSM303 (int bus, int addrMag=LSM303_MAG, int addrAcc=LSM303_ACC);
@ -110,6 +110,12 @@ class LSM303 {
*/
uint8_t* getRawCoorData();
uint8_t getAccelY();
uint8_t getAccelZ();
uint8_t getAccelX();
/**
* Get the raw accelerometer data, this will get updated when getAcceleration() is called
*/
@ -120,7 +126,7 @@ class LSM303 {
mraa_i2c_context m_i2c;
int m_addrMag;
int m_addrAcc;
int m_addrAcc;
uint8_t buf[6];
uint8_t coor[3];
uint8_t accel[3];