Unit tests for gpio and bug fixes