From aac66be40a9d1cb7b35b1ec809fb35ef1391be94 Mon Sep 17 00:00:00 2001 From: Marian Craciunescu Date: Thu, 18 Jan 2018 23:45:59 +0200 Subject: [PATCH] add doc to exported functions.Exposed also the spi driver. --- gpio.go | 1 + i2c.go | 3 ++- spi.go | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gpio.go b/gpio.go index de83fb0..e124cce 100644 --- a/gpio.go +++ b/gpio.go @@ -152,6 +152,7 @@ var gpioDriverInitialized bool var gpioDriverInstance GPIODriver // SetGpioDriver should be used only for testing purpose.It makes possible to unit test embd gpio functionality +// it overrides the gpioDriverInstance func SetGpioDriver(drv GPIODriver, initialized bool) { gpioDriverInstance = drv gpioDriverInitialized = initialized diff --git a/i2c.go b/i2c.go index d09fcbf..9f39296 100644 --- a/i2c.go +++ b/i2c.go @@ -43,7 +43,8 @@ type I2CDriver interface { var i2cDriverInitialized bool var i2cDriverInstance I2CDriver -// SetI2cDriver should be used only for testing purpose.It makes possible to unit test embd i2c functionality +// SetI2cDriver should be used only for testing purpose.It makes possible to unit test embd i2c functionality. +// it overrides the i2cDriverInstance func SetI2cDriver(drv I2CDriver, initialized bool) { i2cDriverInstance = drv i2cDriverInitialized = initialized diff --git a/spi.go b/spi.go index db5b029..365b3b1 100644 --- a/spi.go +++ b/spi.go @@ -56,6 +56,13 @@ type SPIDriver interface { var spiDriverInitialized bool var spiDriverInstance SPIDriver +// SetSPIDriver should be used only for testing purpose.It makes possible to unit test embd spi functionality. +// it overrides spiDriverInstance +func SetSPIDriver(drv SPIDriver, initialized bool) { + spiDriverInstance = drv + spiDriverInitialized = initialized +} + // InitSPI initializes the SPI driver. func InitSPI() error { if spiDriverInitialized {