add toggle function to GPIO

don't know if main will work or even compile