mirror of https://github.com/kidoman/embd
Merge aac66be40a
into d3d8c0c5c6
This commit is contained in:
commit
a8c67034bf
7
gpio.go
7
gpio.go
|
@ -151,6 +151,13 @@ type GPIODriver interface {
|
||||||
var gpioDriverInitialized bool
|
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
|
||||||
|
// it overrides the gpioDriverInstance
|
||||||
|
func SetGpioDriver(drv GPIODriver, initialized bool) {
|
||||||
|
gpioDriverInstance = drv
|
||||||
|
gpioDriverInitialized = initialized
|
||||||
|
}
|
||||||
|
|
||||||
// InitGPIO initializes the GPIO driver.
|
// InitGPIO initializes the GPIO driver.
|
||||||
func InitGPIO() error {
|
func InitGPIO() error {
|
||||||
if gpioDriverInitialized {
|
if gpioDriverInitialized {
|
||||||
|
|
7
i2c.go
7
i2c.go
|
@ -43,6 +43,13 @@ 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.
|
||||||
|
// it overrides the i2cDriverInstance
|
||||||
|
func SetI2cDriver(drv I2CDriver, initialized bool) {
|
||||||
|
i2cDriverInstance = drv
|
||||||
|
i2cDriverInitialized = initialized
|
||||||
|
}
|
||||||
|
|
||||||
// InitI2C initializes the I2C driver.
|
// InitI2C initializes the I2C driver.
|
||||||
func InitI2C() error {
|
func InitI2C() error {
|
||||||
if i2cDriverInitialized {
|
if i2cDriverInitialized {
|
||||||
|
|
7
spi.go
7
spi.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue