A regular rotary encoder has three pins: A, B and ground. When the encoder is rotating, each pin produces a "pulse train" but 90° out of phase with the other. In other words, when it is rotating you get a sequence like: A followed by A+B followed by B followed by no signal - and in the other direction the sequence would be in reverse.
Arduino uses the same microcontroller as the Teensy, and there is a whole lot of simple Arduino code out there for reading rotary encoders. A lot of code is triggering an interrupt when a pin goes low, but I think that would be overkill - that kind of code is intended for controlling motors.
For an input device, the encoder is not going to rotate
that fast so it would be more than sufficient to just poll the two pins fairly often. A lot of keyboard firmware is based on a main loop or interrupt that is triggered every ms - put the polling there!
Edit: The code described above is the 2-bit version of
Gray code. There
are rotary encoders that produce gray codes with three or more bits but they are not as common.