Interface library for ST LSM303DLM 3-axis magnetometer/accelerometer

Dependents:   AVC_2012 m3pi_Kompass Fish_2014Fall Fish_2014Fall ... more

Files at this revision

API Documentation at this revision

Comitter:
shimniok
Date:
Mon Jan 30 20:28:47 2012 +0000
Parent:
1:fc5c9258ec45
Commit message:
Fixed initialization bug that rendered the sensor inoperable. Duh.

Changed in this revision

LSM303DLM.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r fc5c9258ec45 -r 0fcea8569714 LSM303DLM.cpp
--- a/LSM303DLM.cpp	Tue Jan 24 16:56:35 2012 +0000
+++ b/LSM303DLM.cpp	Mon Jan 30 20:28:47 2012 +0000
@@ -17,25 +17,16 @@
     // continuous conversion mode
     _data[0] = MR_REG_M;
     _data[1] = 0x00;
-#ifdef DEBUG_I2C
-    if (!_device.write(MAG_ADDRESS, _data, 2))
-        fprintf(stdout, "MR_REG_M: no ack\n");
-#endif        
+    _device.write(MAG_ADDRESS, _data, 2);
     // data rate 75hz
     _data[0] = CRA_REG_M;
     _data[1] = 0x18; // 0b00011000
-#ifdef DEBUG_I2C    
-    if (_device.write(MAG_ADDRESS, _data, 2))
-        fprintf(stdout, "CRA_REG_M: no ack\n");
-#endif    
+    _device.write(MAG_ADDRESS, _data, 2);
     // init acc
     // data rate 100hz 
     _data[0] = CTRL_REG1_A;
     _data[1] = 0x2F; // 0b00101111
-#ifdef DEBUG_I2C    
-    if (!_device.write(ACC_ADDRESS, _data, 2))
-        fprintf(stdout, "CTRL_REG1_A: no ack\n");
-#endif        
+    _device.write(ACC_ADDRESS, _data, 2);
 }
 
 void LSM303DLM::read(int a[3], int m[3])