Hi all,
I'm a really newbie in this forum and in MPU6050 with Arduino, firstly thank for your awesome drivers works perfect and the code is pretty readable.
My small task is include the pedometer (step count,time walk) information in your driver, for that, i'm trying to include that functions from the original driver to your.
/**
* @brief Get current step count.
* @param[out] count Number of steps detected.
* @return 0 if successful.
*/
int dmp_get_pedometer_step_count(unsigned long *count)
{
unsigned char tmp[4];
if (!count)
return -1;
if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
return -1;
count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
((unsigned long)tmp[2] << 8) | tmp[3];
return 0;
}
that's original function, so they used that function of mpu_read_mem to access to DMP memory ( ig I guess FIFO) with mem_Address= D_PEDSTD_STEPCTR size 4bytes so it's a uint32t (cause it's a unsiged long), and output in tmp.
They use: #define D_PEDSTD_STEPCTR (768 + 0x60)
So studing the code I realize that to access to FIFO register in your Driver is with readmemory block??is good?
So in this case i modify with the next:
int MPU6050::dmp_get_pedometer_step_count(unsigned long *count)
{
unsigned char tmp[4];
if (!count)
return -1;
if (readMemoryBlock(&tmp,4,MPU6050_RA_MEM_R_W,D_PEDSTD_STEPCTR))
return -1;
count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
((unsigned long)tmp[2] << 8) | tmp[3];
return 0;
}
But sadly is not working at all i have problems with type data but also i don't know if it's correct or not. i'm not expert in this software sorry.
And if someone know some other way to solve could be nice to help me.
Thanks
pd.sorry my english