Thank you for writing.
The tilt-compensated eCompass algorithm, from the NXP Sensor Fusion Libraries, actually calculates all three angles (pitch, roll, and yaw or compass heading) that define the PCB orientation.
So, in this case I recommend to download the libraries mentioned in order to get the source code and to review the application note below in order to get more detailed more information:
Implementing a Tilt-Compensated eCompass using Accelerometer and Magnetometer Sensors
I hope this information helps.
Please let me know if you have any further question.
I am getting the below accelerometer & magnetometer data from FXOS sensor.
I would like to calculate Pitch, Roll, Yaw or heading (compass like in mobile North heading)
And in my board sensor direction x & Y is different orientation, in software can it be tune and apply any error factor in software logic.
Please help me how to calculate the above values:
Retrieving data ...