You might also find useful my baremetal example code for the MMA8451Q accelerometer and FRDM-KL25Z platform. I will try to add a few lines of code to calculate an angle of inclination using atan2 function and then I will post it here.
The FRDM-KL25ZDemo, which can be found in the KL25z sample code, contains baremetal code for angle calculation which can be found in the "angle_calculation" directory in the project folder. The KL25z sample code can be found here FRDM-KL25Z: Freescale Freedom Development Platform for Kinetis KL14/15/24/25 MCUs under Downloads >> Software Development Tools >> Lab and Test software. Hope this helps.
You can give a look to the step by step tutorial in the next link. It does not mention the angle calculation, but you can develop your own algorithm with the basics explained: