Use a simpler formula to convert usecs to ticks. Output is in microseconds instead of ticks, so that values do not depend on the timer frequency.
joy.c: joystick driver