basic code for hall sensor speed and position interpolation