gpio: create types for the pin factory methods
gpio: implement pin caching

this allows for the short version of the API to work as expected as
consecutive calls to the same pin would now be internally working on the
pin instance (all the 3 currently supported types). closing a pin busts
the cache