IMU LSM9DS1 Library
Dependents: IMU 4180Lab2Part1 segway-selfBalancingRobot test
Diff: LSM9DS1.cpp
- Revision:
- 1:87d535bf8c53
- Parent:
- 0:e8167f37725c
--- a/LSM9DS1.cpp Mon Oct 26 14:55:43 2015 +0000 +++ b/LSM9DS1.cpp Mon Oct 26 16:14:04 2015 +0000 @@ -43,7 +43,7 @@ { init(IMU_MODE_I2C, xgAddr, mAddr); // dont know about 0xD6 or 0x3B } -/* cw +/* LSM9DS1::LSM9DS1() { init(IMU_MODE_I2C, LSM9DS1_AG_ADDR(1), LSM9DS1_M_ADDR(1)); @@ -1044,7 +1044,7 @@ void LSM9DS1::initSPI() { - /* cw + /* pinMode(_xgAddress, OUTPUT); digitalWrite(_xgAddress, HIGH); pinMode(_mAddress, OUTPUT); @@ -1063,7 +1063,7 @@ void LSM9DS1::SPIwriteByte(uint8_t csPin, uint8_t subAddress, uint8_t data) { - /*cw + /* digitalWrite(csPin, LOW); // Initiate communication // If write, bit 0 (MSB) should be 0 @@ -1094,7 +1094,7 @@ if ((csPin == _mAddress) && count > 1) rAddress |= 0x40; - /* cw + /* digitalWrite(csPin, LOW); // Initiate communication SPI.transfer(rAddress); for (int i=0; i<count; i++) @@ -1107,7 +1107,7 @@ void LSM9DS1::initI2C() { - /* cw + /* Wire.begin(); // Initialize I2C library */ @@ -1117,7 +1117,7 @@ // Wire.h read and write protocols void LSM9DS1::I2CwriteByte(uint8_t address, uint8_t subAddress, uint8_t data) { - /* cw + /* Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.write(data); // Put data in Tx buffer @@ -1129,7 +1129,7 @@ uint8_t LSM9DS1::I2CreadByte(uint8_t address, uint8_t subAddress) { - /* cw + /* int timeout = LSM9DS1_COMMUNICATION_TIMEOUT; uint8_t data; // `data` will store the register data @@ -1160,7 +1160,7 @@ uint8_t LSM9DS1::I2CreadBytes(uint8_t address, uint8_t subAddress, uint8_t * dest, uint8_t count) { - /* cw + /* int timeout = LSM9DS1_COMMUNICATION_TIMEOUT; Wire.beginTransmission(address); // Initialize the Tx buffer // Next send the register to be read. OR with 0x80 to indicate multi-read.