Unit responds with packet that contains the following: shtpHeader[0:3]: First, a 4 byte header shtpData[0]: The Report ID shtpData[1]: Sequence number (See 6.5.18.2) shtpData[2]: Command shtpData[3]: Command Sequence Number shtpData[4]: Response Sequence Number shtpData[5 + 0]: R0 shtpData[5 + 1]: R1 shtpData[5 + 2]: R2 shtpData[5 + 3]: R3 shtpData[5 + 4]: R4 shtpData[5 + 5]: R5 shtpData[5 + 6]: R
| 246 | //shtpData[5 + 7]: R7 |
| 247 | //shtpData[5 + 8]: R8 |
| 248 | uint16_t BNO080::parseCommandReport(void) |
| 249 | { |
| 250 | if (shtpData[0] == SHTP_REPORT_COMMAND_RESPONSE) |
| 251 | { |
| 252 | //The BNO080 responds with this report to command requests. It's up to use to remember which command we issued. |
| 253 | uint8_t command = shtpData[2]; //This is the Command byte of the response |
| 254 | |
| 255 | if (command == COMMAND_ME_CALIBRATE) |
| 256 | { |
| 257 | calibrationStatus = shtpData[5 + 0]; //R0 - Status (0 = success, non-zero = fail) |
| 258 | _calibrationResponseStatus = shtpData[5 + 0]; |
| 259 | _accelCalEnabled = shtpData[6 + 0]; |
| 260 | _gyroCalEnabled = shtpData[7 + 0]; |
| 261 | _magCalEnabled = shtpData[8 + 0]; |
| 262 | _planarAccelCalEnabled = shtpData[9 + 0]; |
| 263 | _onTableCalEnabled = shtpData[10 + 0]; |
| 264 | _hasNewCalibrationStatus = true; |
| 265 | } |
| 266 | return shtpData[0]; |
| 267 | } |
| 268 | else |
| 269 | { |
| 270 | //This sensor report ID is unhandled. |
| 271 | //See reference manual to add additional feature reports as needed |
| 272 | } |
| 273 | |
| 274 | //TODO additional feature reports may be strung together. Parse them all. |
| 275 | return 0; |
| 276 | } |
| 277 | |
| 278 | //This function pulls the data from the input report |
| 279 | //The input reports vary in length so this function stores the various 16-bit values as globals |
nothing calls this directly
no outgoing calls
no test coverage detected