Accelerometer test

Dependents:   AccelerometerTest

Fork of BMA180 by John Ermitanio

Files at this revision

API Documentation at this revision

Comitter:
tedparrott6
Date:
Thu Nov 16 14:55:43 2017 +0000
Parent:
0:ff755cb08068
Commit message:
NA

Changed in this revision

BMA180.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ff755cb08068 -r 76ba09761dbe BMA180.cpp
--- a/BMA180.cpp	Wed Aug 01 20:27:16 2012 +0000
+++ b/BMA180.cpp	Thu Nov 16 14:55:43 2017 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "BMA180.h"
 
-Serial pc(USBTX, USBRX); // tx, rx
+//Serial pc(USBTX, USBRX); // tx, rx
 
 BMA180::BMA180(PinName sdi, PinName sdo, PinName sck, PinName csb, PinName interrupt) : _csb(csb), _interrupt(interrupt), spi(sdi, sdo, sck){
              // mosi, miso, sclk
@@ -18,7 +18,7 @@
     if(readID == 3) {
         value = 1;
     } else {
-        pc.printf("Lost Connection");
+        //pc.printf("Lost Connection");
         value = -1;
     }
     return value;
@@ -32,8 +32,8 @@
     readVersion = readReg(VERSION);
     
     if(readID == 3) {
-        pc.printf("Connected to BMA180\n\r");
-        pc.printf("BMA180 Version: %d\n\r", readVersion);
+        //pc.printf("Connected to BMA180\n\r");
+        //pc.printf("BMA180 Version: %d\n\r", readVersion);
         
         reset();                                           
     
@@ -63,23 +63,23 @@
         byte |= 0x80;                                           // Set bit6 to 1 to enable slope alert
         writeReg(CTRL_REG3, byte);
         //pc.printf("After: %0.3X", byte);
-        pc.printf("Interrupt is enabled.");
+        //pc.printf("Interrupt is enabled.");
     
         byte = readReg(CTRL_REG0);
         byte &= 0xEF;                                           // Set bit4 to 0 to disable self test and lock image writing
         writeReg(CTRL_REG0, byte);
         
-        pc.printf("\n\rBMA initialization complete.\n\r");
+        //pc.printf("\n\rBMA initialization complete.\n\r");
         
     } else {
-        pc.printf("Not connected to BMA180! ReadVersion:  %d ReadID:  %d\n\r", readVersion, readID);
+        //pc.printf("Not connected to BMA180! ReadVersion:  %d ReadID:  %d\n\r", readVersion, readID);
     }      
 }
 
 void BMA180::reset(void) {
     writeReg(RESET, 0xB6);
     wait_ms(10);
-    pc.printf("Soft Reset, EEPROM Copied\n\r");
+    //pc.printf("Soft Reset, EEPROM Copied\n\r");
 }
 
 void BMA180::readAxis(void) {
@@ -104,10 +104,10 @@
     z_msb = readReg(ACCZMSB);                              // Read Z MSB register
     az = (z_msb << 8) | z_lsb;                             // Concatinate Z MSB and LSB
     az = az >> 2;                                          // Remove unused first 2 LSB
-    afz = (float)az*3/16384;
-                             
+    afz = (float)az*3/16384;                        
     
-    pc.printf("\n\rX: %05f Y: %05f Z: %05f", afx, afy, afz);
+    
+    //pc.printf("\n\rX: %05f Y: %05f Z: %05f", afx, afy, afz);
 }
 
 void BMA180::writeReg(uint8_t address, char data) {