Modifying APM code to read rpm data


I would like to modify the APM firmware(Arduplane) to read rpm data from external hall effect sensor.
I wrote an Arduino script which works on a basic Arduino board, but I want to include the code in the APM firmware. But I am lost trying to figure out where to modify it.

Could someone guide me how to modify the code to read data.