During the weekend we dedicated some time to integrate the MPU-9150 with Arduino Mega board to access the compass data.
We needed to update the firmware wrt the one provided by Sparkfun. However after solving some problem we finally got the magnetometers measurements.
We ended up using the code from Pansenti (just take note not to ask for too high output rates from the magnetometer, 50Hz is a good value).
If you want you can use the code made available at Sparkfun, you will have to make some corrections. Unlike all the other sensors and respective registers, the magnetometer writes to its data registers in little-endian! To correct the code, just swap the byte order at the function that reads the magnetometer. In the file MPU6050.cpp, in function getMotion9, change the lines 1729-1731 to:
*mx = (((int16_t)buffer) << 8) | buffer;
*my = (((int16_t)buffer) << 8) | buffer;
*mz = (((int16_t)buffer) << 8) | buffer;
Here below you can find a simple video with the main steps we followed.