1
0
mirror of https://github.com/kidoman/embd synced 2024-06-01 08:38:05 +02:00

add doc to exported functions.Exposed also the spi driver.

This commit is contained in:
Marian Craciunescu 2018-01-18 23:45:59 +02:00
parent af70e0095f
commit aac66be40a
3 changed files with 10 additions and 1 deletions

View File

@ -152,6 +152,7 @@ var gpioDriverInitialized bool
var gpioDriverInstance GPIODriver var gpioDriverInstance GPIODriver
// SetGpioDriver should be used only for testing purpose.It makes possible to unit test embd gpio functionality // 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) { func SetGpioDriver(drv GPIODriver, initialized bool) {
gpioDriverInstance = drv gpioDriverInstance = drv
gpioDriverInitialized = initialized gpioDriverInitialized = initialized

3
i2c.go
View File

@ -43,7 +43,8 @@ type I2CDriver interface {
var i2cDriverInitialized bool var i2cDriverInitialized bool
var i2cDriverInstance I2CDriver 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) { func SetI2cDriver(drv I2CDriver, initialized bool) {
i2cDriverInstance = drv i2cDriverInstance = drv
i2cDriverInitialized = initialized i2cDriverInitialized = initialized

7
spi.go
View File

@ -56,6 +56,13 @@ type SPIDriver interface {
var spiDriverInitialized bool var spiDriverInitialized bool
var spiDriverInstance SPIDriver 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. // InitSPI initializes the SPI driver.
func InitSPI() error { func InitSPI() error {
if spiDriverInitialized { if spiDriverInitialized {