The library needs to be tested once we get the IMU
Diff: BNO080.cpp
- Revision:
- 2:2269b723d16a
- Parent:
- 1:aac28ffd63ed
- Child:
- 3:197ad972fb7c
diff -r aac28ffd63ed -r 2269b723d16a BNO080.cpp --- a/BNO080.cpp Sat Dec 29 03:31:00 2018 -0800 +++ b/BNO080.cpp Sat Dec 29 04:09:34 2018 -0800 @@ -69,7 +69,7 @@ /// Set to 1 to enable debug printouts. Should be very useful if the chip is giving you trouble. /// When debugging, it is recommended to use the highest possible serial baudrate so as not to interrupt the timing of operations. -#define BNO_DEBUG 1 +#define BNO_DEBUG 0 BNO080::BNO080(Serial *debugPort, PinName user_SDApin, PinName user_SCLpin, PinName user_INTPin, PinName user_RSTPin, uint8_t i2cAddress, int i2cPortSpeed) : @@ -77,8 +77,20 @@ _i2cPort(user_SDApin, user_SCLpin), _i2cAddress(i2cAddress), _int(user_INTPin), - _rst(user_RSTPin, 1) + _rst(user_RSTPin, 1), + commandSequenceNumber(0), + stability(UNKNOWN), + stepDetected(false), + stepCount(0), + significantMotionDetected(false), + shakeDetected(false), + xAxisShake(false), + yAxisShake(false), + zAxisShake(false) { + // zero sequence numbers + memset(sequenceNumber, 0, sizeof(sequenceNumber)); + //Get user settings _i2cPortSpeed = i2cPortSpeed; if(_i2cPortSpeed > 4000000) @@ -1207,49 +1219,49 @@ // data from SH-2 section 5.1 switch(report) { - case Report::TOTAL_ACCELERATION: + case TOTAL_ACCELERATION: reportMetaRecord = 0xE301; break; - case Report::LINEAR_ACCELERATION: + case LINEAR_ACCELERATION: reportMetaRecord = 0xE303; break; - case Report::GRAVITY_ACCELERATION: + case GRAVITY_ACCELERATION: reportMetaRecord = 0xE304; break; - case Report::GYROSCOPE: + case GYROSCOPE: reportMetaRecord = 0xE306; break; - case Report::MAG_FIELD: + case MAG_FIELD: reportMetaRecord = 0xE309; break; - case Report::MAG_FIELD_UNCALIBRATED: + case MAG_FIELD_UNCALIBRATED: reportMetaRecord = 0xE30A; break; - case Report::ROTATION: + case ROTATION: reportMetaRecord = 0xE30B; break; - case Report::GEOMAGNETIC_ROTATION: + case GEOMAGNETIC_ROTATION: reportMetaRecord = 0xE30D; break; - case Report::GAME_ROTATION: + case GAME_ROTATION: reportMetaRecord = 0xE30C; break; - case Report::TAP_DETECTOR: + case TAP_DETECTOR: reportMetaRecord = 0xE313; break; - case Report::STABILITY_CLASSIFIER: + case STABILITY_CLASSIFIER: reportMetaRecord = 0xE317; break; - case Report::STEP_DETECTOR: + case STEP_DETECTOR: reportMetaRecord = 0xE314; break; - case Report::STEP_COUNTER: + case STEP_COUNTER: reportMetaRecord = 0xE315; break; - case Report::SIGNIFICANT_MOTION: + case SIGNIFICANT_MOTION: reportMetaRecord = 0xE316; break; - case Report::SHAKE_DETECTOR: + case SHAKE_DETECTOR: reportMetaRecord = 0xE318; break; }