Finished acceleration calculation based on Freescale electronics demo