IMU LSM9DS1 Library
Fork of LSM9DS1_Library by
Revision 4:e1404cbaf2a9, committed 2016-07-20
- Comitter:
- afmiee
- Date:
- Wed Jul 20 21:38:08 2016 +0000
- Parent:
- 3:585984c4a4b1
- Child:
- 5:58710c38076c
- Commit message:
- Have been fixing little issues with the definitions
Changed in this revision
| LSM9DS1.cpp | Show annotated file Show diff for this revision Revisions of this file |
| LSM9DS1_Types.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/LSM9DS1.cpp Tue Jul 19 20:53:34 2016 +0000
+++ b/LSM9DS1.cpp Wed Jul 20 21:38:08 2016 +0000
@@ -63,7 +63,7 @@
// 1 = 14.9 4 = 238
// 2 = 59.5 5 = 476
// 3 = 119 6 = 952
- settings.gyro.sampleRate = 6;
+ settings.gyro.sampleRate = 1;
// gyro cutoff frequency: value between 0-3
// Actual value of cutoff frequency depends
// on sample rate.
@@ -90,7 +90,7 @@
// 1 = 10 Hz 4 = 238 Hz
// 2 = 50 Hz 5 = 476 Hz
// 3 = 119 Hz 6 = 952 Hz
- settings.accel.sampleRate = 6;
+ settings.accel.sampleRate = 1;
// Accel cutoff freqeuncy can be any value between -1 - 3.
// -1 = bandwidth determined by sample rate
// 0 = 408 Hz 2 = 105 Hz
@@ -111,7 +111,7 @@
// 1 = 1.25 Hz 5 = 20 Hz
// 2 = 2.5 Hz 6 = 40 Hz
// 3 = 5 Hz 7 = 80 Hz
- settings.mag.sampleRate = 7;
+ settings.mag.sampleRate = 4;
settings.mag.tempCompensationEnable = false;
// magPerformance can be any value between 0-3
// 0 = Low power mode 2 = high performance
@@ -1121,30 +1121,13 @@
uint8_t LSM9DS1::I2CreadByte(uint8_t address, uint8_t subAddress)
{
- /*
- int timeout = LSM9DS1_COMMUNICATION_TIMEOUT;
- uint8_t data; // `data` will store the register data
-
- Wire.beginTransmission(address); // Initialize the Tx buffer
- Wire.write(subAddress); // Put slave register address in Tx buffer
- Wire.endTransmission(true); // Send the Tx buffer, but send a restart to keep connection alive
- Wire.requestFrom(address, (uint8_t) 1); // Read one byte from slave register address
- while ((Wire.available() < 1) && (timeout-- > 0))
- delay(1);
+ char data;
+ char temp = subAddress;
- if (timeout <= 0)
- return 255; //! Bad! 255 will be misinterpreted as a good value.
-
- data = Wire.read(); // Fill Rx buffer with result
- return data; // Return data read from slave register
- */
- char data;
- char temp[1] = {subAddress};
-
- i2c.write(address, temp, 1);
+ //i2c.write(address, temp, 1);
//i2c.write(address & 0xFE);
- temp[1] = 0x00;
- i2c.write(address, temp, 1);
+ //temp[1] = 0x00;
+ i2c.write(address, &temp, 1);
//i2c.write( address | 0x01);
int a = i2c.read(address, &data, 1);
return data;
--- a/LSM9DS1_Types.h Tue Jul 19 20:53:34 2016 +0000
+++ b/LSM9DS1_Types.h Wed Jul 20 21:38:08 2016 +0000
@@ -113,8 +113,8 @@
enum interrupt_generators
{
- INT2_DRDY_XL = (1<<0), // Accelerometer data ready (INT1 & INT2)
- INT2_DRDY_G = (1<<1), // Gyroscope data ready (INT1 & INT2)
+ INT_DRDY_XL = (1<<0), // Accelerometer data ready (INT1 & INT2)
+ INT_DRDY_G = (1<<1), // Gyroscope data ready (INT1 & INT2)
INT1_BOOT = (1<<2), // Boot status (INT1)
INT2_DRDY_TEMP = (1<<2),// Temp data ready (INT2)
INT_FTH = (1<<3), // FIFO threshold interrupt (INT1 & INT2)
