Digital time of flight measurement for ultrasonic sensors