Add a couple helper functions, set input/output bit correctly in setup_pin()