Revision dd57d4fa Adafruit_BNO055.cpp
| Adafruit_BNO055.cpp | ||
|---|---|---|
| 71 | 71 |
setMode(OPERATION_MODE_CONFIG); |
| 72 | 72 |
|
| 73 | 73 |
/* Reset */ |
| 74 |
write8(BNO055_SYS_TRIGGER_ADDR, 0x20); //reset the sensor |
|
| 75 |
while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID) //wait for boot |
|
| 74 |
write8(BNO055_SYS_TRIGGER_ADDR, 0x20); |
|
| 75 |
while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID) |
|
| 76 |
{
|
|
| 76 | 77 |
delay(10); |
| 77 |
|
|
| 78 |
} |
|
| 78 | 79 |
delay(50); |
| 79 | 80 |
|
| 80 | 81 |
/* Set to normal power mode */ |
| ... | ... | |
| 84 | 85 |
write8(BNO055_PAGE_ID_ADDR, 0); |
| 85 | 86 |
|
| 86 | 87 |
/* Set the output units */ |
| 87 |
uint8_t unitsel = (0 << 7) | /* Orientation = Android */ |
|
| 88 |
(0 << 4) | /* Temperature = Celsius */ |
|
| 89 |
(0 << 2) | /* Euler = Degrees */ |
|
| 90 |
(1 << 1) | /* Gyro = Rads */ |
|
| 91 |
(0 << 0); /* Accelerometer = m/s^2 */ |
|
| 88 |
/* |
|
| 89 |
uint8_t unitsel = (0 << 7) | // Orientation = Android |
|
| 90 |
(0 << 4) | // Temperature = Celsius |
|
| 91 |
(0 << 2) | // Euler = Degrees |
|
| 92 |
(1 << 1) | // Gyro = Rads |
|
| 93 |
(0 << 0); // Accelerometer = m/s^2 |
|
| 92 | 94 |
write8(BNO055_UNIT_SEL_ADDR, unitsel); |
| 95 |
*/ |
|
| 93 | 96 |
|
| 94 | 97 |
write8(BNO055_SYS_TRIGGER_ADDR, 0x0); |
| 95 | 98 |
delay(10); |
| ... | ... | |
| 256 | 259 |
|
| 257 | 260 |
/* Read vector data (6 bytes) */ |
| 258 | 261 |
readLen((adafruit_bno055_reg_t)vector_type, buffer, 6); |
| 259 |
x = (((uint16_t)buffer[1]) << 8) | ((uint16_t)buffer[0]); |
|
| 260 |
y = (((uint16_t)buffer[3]) << 8) | ((uint16_t)buffer[2]); |
|
| 261 |
z = (((uint16_t)buffer[5]) << 8) | ((uint16_t)buffer[4]); |
|
| 262 |
|
|
| 263 |
x = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8); |
|
| 264 |
y = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8); |
|
| 265 |
z = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8); |
|
| 262 | 266 |
|
| 263 | 267 |
/* Convert the value to an appropriate range (section 3.6.4) */ |
| 264 | 268 |
/* and assign the value to the Vector type */ |
Also available in: Unified diff