/**
 * Start the device through address with offset's informed
 * @param address
 * @param xGyroOffset
 * @param yGyroOffset
 * @param zGyroOffset
 * @return boolean
 */
bool MPU6050::dmpStartDevice(uint8_t address, int xGyroOffset, int yGyroOffset, int zGyroOffset) {

    setAddress(address);

    initialize();

    setXGyroOffset(xGyroOffset);
    setYGyroOffset(yGyroOffset);
    setZGyroOffset(zGyroOffset);

    if (testConnection())
    {
        // load and configure the DMP
        if (dmpInitialize() == 0)
        {
            // turn on the DMP, now that it's ready
            setDMPEnabled(true);

            dmpStatus = getIntStatus();

            // set our DMP Ready flag so the main loop() function knows it's okay to use it
            dmpReady = true;

            // get expected DMP packet size for later comparison
            dmpPacketSize = dmpGetFIFOPacketSize();

            timeReset();
            resetFIFO();

            return true;
        }
    }

    return false;
}
Example #2
0
void CurieIMUClass::setGyroOffset(int axis, int offset)
{
    if (axis == X_AXIS) {
        setXGyroOffset(axis);
    } else if (axis == Y_AXIS) {
        setYGyroOffset(axis);
    } else if (axis == Z_AXIS) {
        setZGyroOffset(axis);
    }
}
Example #3
0
void CurieIMUClass::setGyroOffset(int axis, float offset)
{
    int bmiOffset = offset / 0.061;

    if (bmiOffset < -512) {
        bmiOffset = -512;
    } else if (bmiOffset > 511) {
        bmiOffset = 511;
    }

    if (axis == X_AXIS) {
        setXGyroOffset(bmiOffset);
    } else if (axis == Y_AXIS) {
        setYGyroOffset(bmiOffset);
    } else if (axis == Z_AXIS) {
        setZGyroOffset(bmiOffset);
    }

    setGyroOffsetEnabled(true);
}