Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: BNO080_stm32_compatible
Revision 9:68e4b1932497, committed 2019-07-30
- Comitter:
- JesiMiranda
- Date:
- Tue Jul 30 17:23:04 2019 +0000
- Parent:
- 8:92d4109beb3c
- Commit message:
- Contains added code for stm32-L432KC compatibility
Changed in this revision
| BNO080.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 92d4109beb3c -r 68e4b1932497 BNO080.cpp
--- a/BNO080.cpp Tue Jul 30 16:44:07 2019 +0000
+++ b/BNO080.cpp Tue Jul 30 17:23:04 2019 +0000
@@ -513,10 +513,8 @@
} else if(shtpHeader[2] == CHANNEL_REPORTS || shtpHeader[2] == CHANNEL_WAKE_REPORTS) {
if(shtpData[0] == SHTP_REPORT_BASE_TIMESTAMP) {
- // sensor data packet
- //_debugPort->printf("\r\t\t enter pareseSensorDataPacket \r\n");
parseSensorDataPacket();
- //wait(0.002f); //added
+
}
}
}
@@ -759,7 +757,6 @@
Timer timeoutTimer;
timeoutTimer.start();
- //added the 2*
while(timeoutTimer.read() <= 2*timeout) {
if(_int.read() == 0) {
if(!receivePacket(timeout)) {
@@ -956,19 +953,7 @@
//Returns false if sensor does not ACK
bool BNO080::sendPacket(uint8_t channelNumber, uint8_t dataLength)
{
- // start the transaction and contact the IMU
- //_i2cPort.start();
-
- // to indicate an i2c read, shift the 7 bit address up 1 bit and keep bit 0 as a 0
- //int writeResult = _i2cPort.write(_i2cAddress << 1);
-
- //if(writeResult != 1) {
- // _debugPort->printf("BNO I2C write failed!\n");
- // _i2cPort.stop();
- // return false;
- //}
-
-
+
uint16_t totalLength = dataLength + 4; //Add four bytes for the header
packetLength = dataLength;
@@ -1003,18 +988,7 @@
return false;
}
- //Send the 4 byte packet header
- //_i2cPort.write(totalLength & 0xFF); //Packet length LSB
- //_i2cPort.write(totalLength >> 8); //Packet length MSB
- //_i2cPort.write(channelNumber); //Channel number
- //_i2cPort.write(sequenceNumber[channelNumber]++); //Send the sequence number, increments with each packet sent, different counter for each channel
-
- //Send the user's data packet
- //for (uint8_t i = 0 ; i < dataLength ; i++) {
- // _i2cPort.write(shtpData[i]);
- //}
-
- //_i2cPort.stop();
+
return (true);
}
@@ -1046,31 +1020,6 @@
return false;
}
- // start the transaction and contact the IMU
- //_i2cPort.start();
-
- // to indicate an i2c read, shift the 7 bit address up 1 bit and set bit 0 to a 1
- /*int writeResult = _i2cPort.write((_i2cAddress << 1) | 0x1);
-
- if(writeResult != 1) {
- _debugPort->printf("BNO I2C read failed!\n");
- return false;
- }
-
- // first read as ints
- int packetLSBInt = _i2cPort.read(true);
-
- int packetMSBInt = _i2cPort.read(true);
- int channelNumberInt = _i2cPort.read(true);
- int sequenceNumInt = _i2cPort.read(true);
-
- _debugPort->printf("Header: %d %d %d %d\n", packetLSBInt, packetMSBInt, channelNumberInt, sequenceNumInt);
-
- if(packetLSBInt < 0 || packetLSBInt < 0 || packetLSBInt < 0 || packetLSBInt < 0)
- {
- _debugPort->printf("BNO I2C header read failed!\n");
- return false;
- }*/
//Get the first four bytes, aka the packet header
uint8_t packetLSB = headerData[0];
@@ -1078,7 +1027,6 @@
uint8_t channelNumber = headerData[2];
uint8_t sequenceNum = headerData[3]; //Not sure if we need to store this or not
- //wait(.005f);
//Store the header info
shtpHeader[0] = packetLSB;
shtpHeader[1] = packetMSB;
@@ -1135,7 +1083,6 @@
_debugPort->printf("Recieved packet: ----------------\n");
printPacket(); // note: add 4 for the header length
#endif
- //_debugPort->printf("\r\t\t\t We're done!\r\n");
return (true); //We're done!
}