“I looked at all the available rotary encoder sketches and none of them met my needs, so I have written my own, and here it is”.
encoder.tick(); // just call tick() to check the state.