move enabling GPIO operation out of function