Nicolas Jendrowiak / BNO055

Files at this revision

API Documentation at this revision

Comitter:
spicyoasiis
Date:
Mon Apr 12 19:52:47 2021 +0000
Parent:
6:1f722ffec323
Commit message:
updated for use with mbed 6.x

Changed in this revision

BNO055.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/BNO055.cpp	Tue Sep 22 19:09:45 2015 +0000
+++ b/BNO055.cpp	Mon Apr 12 19:52:47 2021 +0000
@@ -17,14 +17,15 @@
     rx = rx | 0x20;
     writechar(BNO055_SYS_TRIGGER_ADDR,rx);
 //Wait for the system to come back up again (datasheet says 650ms)
-    wait_ms(675);
+    ThisThread::sleep_for(675ms);
 }
     
 bool BNO055::check(){
-//Check we have communication link with the chip
+    //Check we have communication link with the chip
+    rx = 0;
     readchar(BNO055_CHIP_ID_ADDR);
     if (rx != 0xA0) return false;
-//Grab the chip ID and software versions
+    //Grab the chip ID and software versions
     tx[0] = BNO055_CHIP_ID_ADDR;
     _i2c.write(address,tx,1,true);  
     _i2c.read(address+1,rawdata,7,false); 
@@ -220,23 +221,23 @@
 void BNO055::read_calibration_data(void){
     char tempmode = op_mode;
     setmode(OPERATION_MODE_CONFIG);
-    wait_ms(20);
+    ThisThread::sleep_for(20ms);
     tx[0] = ACCEL_OFFSET_X_LSB_ADDR;
     _i2c.write(address,tx,1,true);  
     _i2c.read(address,calibration,22,false); 
     setmode(tempmode);
-    wait_ms(10);
+    ThisThread::sleep_for(10ms);
 }
 
 void BNO055::write_calibration_data(void){
     char tempmode = op_mode;
     setmode(OPERATION_MODE_CONFIG);
-    wait_ms(20);
+    ThisThread::sleep_for(20ms);
     tx[0] = ACCEL_OFFSET_X_LSB_ADDR;
     _i2c.write(address,tx,1,true);  
     _i2c.write(address,calibration,22,false); 
     setmode(tempmode);
-    wait_ms(10);
+    ThisThread::sleep_for(10ms);
 }
 
 void BNO055::set_mapping(char orient){