Jump to content
I2Cdevlib Forums

setMemoryBank in DMP code


Recommended Posts

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.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...