code cleanup
magnetometer is now stucture based to keep main application code tidier
heading function also uses magnetometer structure and scaled accelerometer input