jgauthier Posted September 12, 2020 Report Share Posted September 12, 2020 Greetings, There is a piece of code called setMemoryBank, in the MPU6050 class (MPU6050.cpp). It looks like this: void MPU6050::setMemoryBank(uint8_t bank, bool prefetchEnabled, bool userBank) { bank &= 0x1F; if (userBank) bank |= 0x20; if (prefetchEnabled) bank |= 0x40; I2Cdev::writeByte(devAddr, MPU6050_RA_BANK_SEL, bank); } This is used in dmpInitialize() (MPU6050_6Axis_MotionApps20.h). Likewise, further down in dmpInitialize() writeProgMemoryBlock() is called to write the DMP code to the IMU. However, inside writeProgMemoryBlock() there is another call to setMemoryBank, but only takes one argument. The function isn't overloaded anywhere. I'm assuming it's the same function without the two booleans set to True. But I'd like to know for sure. I can't find this code anywhere else. Likewise, writeMemoryBlock() is called with 4 parameters instead of 6. I feel like this code shouldn't be here, or it's for a different API. writeProgMemoryBlock() is all wrong as well. Quote Link to comment Share on other sites More sharing options...
Jeff Rowberg Posted September 12, 2020 Report Share Posted September 12, 2020 In C++, you can specify default argument values in the prototype declaration. So you're on the right track, but the default values in this case are actually false. https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050.h#L800 Quote Link to comment Share on other sites More sharing options...
jgauthier Posted September 13, 2020 Author Report Share Posted September 13, 2020 Thanks! I didn't catch that declaration. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.