gabbapeople/mpu6050
#pragma XOD error_raise enable volatile bool mpuInterrupt = false; void dmpDataReady() { mpuInterrupt = true; } node { int8_t devStatus; // return status after each device operation (0 = success, !0 = error) void evaluate(Context ctx) { auto mpu = getValue<input_DEV>(ctx); if (isSettingUp()) emitValue<output_DEVU0027>(ctx, mpu); if (!isInputDirty<input_DO>(ctx)) return; const uint8_t INTERRUPT_PIN = getValue<input_INT>(ctx); pinMode(INTERRUPT_PIN, INPUT); devStatus = mpu->dmpInitialize(); if (devStatus == 0) { mpu->setDMPEnabled(true); attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), dmpDataReady, RISING); mpuIntStatus = mpu->getIntStatus(); dmpReady = true; packetSize = mpu->dmpGetFIFOPacketSize(); } else { raiseError(ctx); return; } emitValue<output_DONE>(ctx, 1); } }
© 2017–2024XOD Inc
Contact us: hello@xod.io