Change pinMode to SET_INPUT or SET_OUTPUT

Original code is using WRITE from fastio, but original used pinMode to
set pin direction and did not use the fastio SET_INPUT or SET_OUTPUT.
This caused an issue with the rotary encoder interface to  boards based
on teensyduino, since for teensyduino pin numbers for fastio and the
usual Arduino IO are different.