@@ -135,6 +135,13 @@ void BNO080::parseInputReport(void)
135135 rawAccelY = data2;
136136 rawAccelZ = data3;
137137 }
138+ else if (shtpData[5 ] == SENSOR_REPORTID_LINEAR_ACCELERATION)
139+ {
140+ accelLinAccuracy = status;
141+ rawLinAccelX = data1;
142+ rawLinAccelY = data2;
143+ rawLinAccelZ = data3;
144+ }
138145 else if (shtpData[5 ] == SENSOR_REPORTID_GYROSCOPE)
139146 {
140147 gyroAccuracy = status;
@@ -221,7 +228,7 @@ float BNO080::getQuatRadianAccuracy()
221228// Return the acceleration component
222229uint8_t BNO080::getQuatAccuracy ()
223230{
224- return (accelAccuracy );
231+ return (quatAccuracy );
225232}
226233
227234// Return the acceleration component
@@ -251,6 +258,35 @@ uint8_t BNO080::getAccelAccuracy()
251258 return (accelAccuracy);
252259}
253260
261+ // linear acceleration, i.e. minus gravity
262+
263+ // Return the acceleration component
264+ float BNO080::getLinAccelX ()
265+ {
266+ float accel = qToFloat (rawLinAccelX, linear_accelerometer_Q1);
267+ return (accel);
268+ }
269+
270+ // Return the acceleration component
271+ float BNO080::getLinAccelY ()
272+ {
273+ float accel = qToFloat (rawLinAccelY, linear_accelerometer_Q1);
274+ return (accel);
275+ }
276+
277+ // Return the acceleration component
278+ float BNO080::getLinAccelZ ()
279+ {
280+ float accel = qToFloat (rawLinAccelZ, linear_accelerometer_Q1);
281+ return (accel);
282+ }
283+
284+ // Return the acceleration component
285+ uint8_t BNO080::getLinAccelAccuracy ()
286+ {
287+ return (accelLinAccuracy);
288+ }
289+
254290// Return the gyro component
255291float BNO080::getGyroX ()
256292{
@@ -536,6 +572,12 @@ void BNO080::enableAccelerometer(uint16_t timeBetweenReports)
536572 setFeatureCommand (SENSOR_REPORTID_ACCELEROMETER, timeBetweenReports);
537573}
538574
575+ // Sends the packet to enable the accelerometer
576+ void BNO080::enableLinearAccelerometer (uint16_t timeBetweenReports)
577+ {
578+ setFeatureCommand (SENSOR_REPORTID_LINEAR_ACCELERATION, timeBetweenReports);
579+ }
580+
539581// Sends the packet to enable the gyro
540582void BNO080::enableGyro (uint16_t timeBetweenReports)
541583{
@@ -883,4 +925,4 @@ void BNO080::printPacket(void)
883925 _debugPort->println ();
884926 }
885927
886- }
928+ }
0 commit comments