merged with roys branch, now has additional required gpio functions.