Fix pullup/pulldown enum values (1=pulldown, 2=pullup), add error checking in setup_pin() since it's not perf-critical