Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: payload_sensor payload_sensor
Revision 2:1d1cd08b674d, committed 2021-07-30
- Comitter:
 - sbk
 - Date:
 - Fri Jul 30 11:11:34 2021 +0000
 - Parent:
 - 1:8461f7fe0a7f
 - Commit message:
 - d
 
Changed in this revision
| FXAS21002.cpp | Show annotated file Show diff for this revision Revisions of this file | 
--- a/FXAS21002.cpp	Fri Jul 29 08:22:44 2016 +0000
+++ b/FXAS21002.cpp	Fri Jul 30 11:11:34 2021 +0000
@@ -28,6 +28,8 @@
 
 FXAS21002::FXAS21002(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr<<1) {
     // activate the peripheral
+    FXAS21002::activate(1);
+    FXAS21002::ready(1);
 }
 
 FXAS21002::~FXAS21002() { }
@@ -46,6 +48,7 @@
     readRegs(REG_OUT_X_MSB, &data[0], 1) ;
     readRegs(REG_OUT_X_LSB, &data[1], 1) ;
     value = (data[0] << 8) | data[1] ;
+//    printf("X: %d,%d, %d\t", data[0], data[1], value);
     return(value) ;
 }
 
@@ -56,6 +59,7 @@
     readRegs(REG_OUT_Y_MSB, &data[0], 1) ;
     readRegs(REG_OUT_Y_LSB, &data[1], 1) ;
     value = (data[0] << 8) | data[1] ;
+//    printf("Y: %d,%d, %d\t", data[0], data[1], value);
     return(value) ;
 }
 
@@ -66,6 +70,7 @@
     readRegs(REG_OUT_Z_MSB, &data[0], 1) ;
     readRegs(REG_OUT_Z_LSB, &data[1], 1) ;
     value = (data[0] << 8) | data[1] ;
+//    printf("Z: %d,%d, %d\t", data[0], data[1], value);
     return(value) ;
 }