update gpio code (work in progress!)