This is a simplified version that doesn't use direct register addressing for boards that do not yet have the proper initialization routines.
Encoder counts pulses from quadrature encoded signals, which are commonly available from rotary knobs, motor or shaft sensors and other position sensors.
http://www.pjrc.com/teensy/td_libs_Encoder.html