Exemple #1
0
bool CurieImuClass::getInterruptStatus(int feature)
{
    switch (feature) {
        case CURIE_IMU_FREEFALL:
            return getIntFreefallStatus();

        case CURIE_IMU_SHOCK:
            return getIntShockStatus();

        case CURIE_IMU_STEP:
            return getIntStepStatus();

        case CURIE_IMU_MOTION:
            return getIntMotionStatus();

        case CURIE_IMU_ZERO_MOTION:
            return getIntZeroMotionStatus();

        case CURIE_IMU_TAP:
            return getIntTapStatus();

        case CURIE_IMU_DOUBLE_TAP:
            return getIntDoubleTapStatus();

        case CURIE_IMU_FIFO_FULL:
            return getIntFIFOBufferFullStatus();

        case CURIE_IMU_DATA_READY:
            return getIntDataReadyStatus();

        default:
            return false;
    }
}
void MPU9150::calibrate() {
	Vect3D<float> mag;
	if (getIntDataReadyStatus() == 1) {
		getMagnetoScaled(&mag.x, &mag.y, &mag.z);
		if (min_x >= mag.x) min_x = mag.x; if (max_x <  mag.x) max_x = mag.x;
		if (min_y >= mag.y) min_y = mag.y; if (max_y <  mag.y) max_y = mag.y;
		if (min_z >= mag.z) min_z = mag.z; if (max_z <  mag.z) max_z = mag.z;
		calculateMag();
	}
}