Gpio and I2c interfaces

This pull request refactors the gpio and i2c interfaces.