Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Gyroscope.cpp@4:e759b8c756da, 2015-01-23 (annotated)
- Committer:
- pvaibhav
- Date:
- Fri Jan 23 13:00:46 2015 +0000
- Revision:
- 4:e759b8c756da
- Child:
- 5:b9f2f62a8f90
Added stub drivers for magneto and gyro
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pvaibhav | 4:e759b8c756da | 1 | #include "Gyroscope.h" |
pvaibhav | 4:e759b8c756da | 2 | #define DEBUG "BMX055-Gyr" |
pvaibhav | 4:e759b8c756da | 3 | #include "Logger.h" |
pvaibhav | 4:e759b8c756da | 4 | |
pvaibhav | 4:e759b8c756da | 5 | Gyroscope::Gyroscope(I2C &i2c) : I2CPeripheral(i2c, 0x69 << 1 /* address */) { |
pvaibhav | 4:e759b8c756da | 6 | write_reg(0x14, 0xB6); // reset |
pvaibhav | 4:e759b8c756da | 7 | wait_ms(30); // page 14 |
pvaibhav | 4:e759b8c756da | 8 | |
pvaibhav | 4:e759b8c756da | 9 | const uint8_t chip_id = read_reg(0x00); |
pvaibhav | 4:e759b8c756da | 10 | if (chip_id == 0x0f) { |
pvaibhav | 4:e759b8c756da | 11 | INFO("Bosch Sensortec BMX055-Gyro ready"); |
pvaibhav | 4:e759b8c756da | 12 | } else { |
pvaibhav | 4:e759b8c756da | 13 | WARN("Bosch Sensortec BMX055-Gyro not found (chip ID=0x%02x, expected=0x0f)", chip_id); |
pvaibhav | 4:e759b8c756da | 14 | } |
pvaibhav | 4:e759b8c756da | 15 | } |
pvaibhav | 4:e759b8c756da | 16 |