/* Returns 3-element vector of accelerometer data in body frame with gravity removed.  */
inv_error_t inv_get_linear_accel(long *data)
/* Returns 3-element vector of accelerometer data in body frame with gravity removed.  */
inv_error_t inv_get_linear_accel(long *data)
{
    long gravity[3];
    if (data != NULL)
    {
        inv_get_accel_set(data, NULL, NULL);
        inv_get_gravity(gravity);
        data[0] -= gravity[0] >> 14;
        data[1] -= gravity[1] >> 14;
        data[2] -= gravity[2] >> 14;
        return INV_SUCCESS;
    }
    else {
        return INV_ERROR_INVALID_PARAMETER;
    }
}