programming dmp with i2c library

By boubouboy , 28 October 2015

hi everybody,

I have buy a mcu6050, and i would like to programm the dmp.
To do it I have download the last pakage with the source folder with the files : inv_mpu_dmp_motion_driver etc...
It is say that we can replace the i2c_write method by another.
As my application is on raspberry pi, i would use wiringPi lib.

source code inv_mpu.c:
int mpu_write_mem(unsigned short mem_addr, unsigned short length,
unsigned char *data)
{
unsigned char tmp[2];

if (!data)
return -1;
if (!st.chip_cfg.sensors)
return -1;

tmp[0] = (unsigned char)(mem_addr >> 8);
tmp[1] = (unsigned char)(mem_addr & 0xFF);

/* Check bank boundaries. */
if (tmp[1] + length > st.hw->bank_size)
return -1;

if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
return -1;
if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
return -1;
return 0;
}

if I 'm right st.reg->mem_r_w is a const, so my question is:
am i supposed to write length time, the same data in the same address?

As exemple if my length is equal to 16, am i suppposed 16 time the data, in the same place (st.reg->mem_r_w)?

is it possible that someone explain it to me?

thanks

phpbb Topic ID
30510