EXPOSED functions for making unit testing possible.

This commit is contained in:
Marian Craciunescu 2018-01-18 15:57:26 +02:00
parent d3d8c0c5c6
commit ea3cee04d8
2 changed files with 10 additions and 0 deletions

View File

@ -151,6 +151,11 @@ type GPIODriver interface {
var gpioDriverInitialized bool
var gpioDriverInstance GPIODriver
func SetGpioDriver(drv GPIODriver, initialized bool) {
gpioDriverInstance = drv
gpioDriverInitialized = initialized
}
// InitGPIO initializes the GPIO driver.
func InitGPIO() error {
if gpioDriverInitialized {

5
i2c.go
View File

@ -43,6 +43,11 @@ type I2CDriver interface {
var i2cDriverInitialized bool
var i2cDriverInstance I2CDriver
func SetI2cDriver(drv I2CDriver, initialized bool) {
i2cDriverInstance = drv
i2cDriverInitialized = initialized
}
// InitI2C initializes the I2C driver.
func InitI2C() error {
if i2cDriverInitialized {