Adafruit driver converted to Mbed OS 6.x.
Dependents: Adafruit-BNO055-test
Revision 3:7db662f5d402, committed 2021-03-16
- Comitter:
- MACRUM
- Date:
- Tue Mar 16 05:41:43 2021 +0000
- Parent:
- 2:8092160b6a59
- Commit message:
- Initial commit
Changed in this revision
Adafruit_BNO055.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8092160b6a59 -r 7db662f5d402 Adafruit_BNO055.cpp --- a/Adafruit_BNO055.cpp Wed Sep 16 22:32:29 2015 +0000 +++ b/Adafruit_BNO055.cpp Tue Mar 16 05:41:43 2021 +0000 @@ -57,7 +57,7 @@ uint8_t id = read8(BNO055_CHIP_ID_ADDR); if(id != BNO055_ID) { - wait_ms(1000); // hold on for boot + thread_sleep_for(1000); // hold on for boot id = read8(BNO055_CHIP_ID_ADDR); if(id != BNO055_ID) { return false; // still not? ok bail @@ -71,13 +71,13 @@ write8(BNO055_SYS_TRIGGER_ADDR, 0x20); while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID) { - wait_ms(10); + thread_sleep_for(10); } - wait_ms(50); + thread_sleep_for(50); /* Set to normal power mode */ write8(BNO055_PWR_MODE_ADDR, POWER_MODE_NORMAL); - wait_ms(10); + thread_sleep_for(10); write8(BNO055_PAGE_ID_ADDR, 0); @@ -92,10 +92,10 @@ */ write8(BNO055_SYS_TRIGGER_ADDR, 0x0); - wait_ms(10); + thread_sleep_for(10); /* Set the requested operating mode (see section 3.3) */ setMode(mode); - wait_ms(20); + thread_sleep_for(20); return true; } @@ -109,7 +109,7 @@ { _mode = mode; write8(BNO055_OPR_MODE_ADDR, _mode); - wait_ms(30); + thread_sleep_for(30); } /**************************************************************************/ @@ -123,17 +123,17 @@ /* Switch to config mode (just in case since this is the default) */ setMode(OPERATION_MODE_CONFIG); - wait_ms(25); + thread_sleep_for(25); write8(BNO055_PAGE_ID_ADDR, 0); if (usextal) { write8(BNO055_SYS_TRIGGER_ADDR, 0x80); } else { write8(BNO055_SYS_TRIGGER_ADDR, 0x00); } - wait_ms(10); + thread_sleep_for(10); /* Set the requested operating mode (see section 3.3) */ setMode(modeback); - wait_ms(20); + thread_sleep_for(20); } @@ -190,7 +190,7 @@ if (system_error != 0) *system_error = read8(BNO055_SYS_ERR_ADDR); - wait_ms(200); + thread_sleep_for(200); } /**************************************************************************/ @@ -399,9 +399,9 @@ { char reg_to_write = (char)(reg); i2c->write(_address<<1, ®_to_write, 1, true); - wait(0.001); + thread_sleep_for(1); i2c->write(_address<<1, &value, 1, false); - wait(0.001); + thread_sleep_for(1); /* ToDo: Check for error! */ return true; @@ -418,9 +418,9 @@ char to_write = (char)reg; i2c->write(_address<<1, &to_write, 1, false); - wait(0.001); + thread_sleep_for(1); i2c->read(_address<<1, &to_read, 1, false); - wait(0.001); + thread_sleep_for(1); printf(" I2C Read : %d from addr: %d\r\n", to_read, to_write); return to_read; @@ -436,9 +436,9 @@ char reg_to_write = (char)(reg); i2c->write(_address<<1, ®_to_write, 1, false); - wait(0.001); + thread_sleep_for(1); i2c->read(_address<<1, buffer, len, false); - wait(0.001); + thread_sleep_for(1); printf("I2C: Read %d bytes from address %d\r\n", len, reg_to_write);