From 1e9ebd1cc6ba88b324591c427296e49751101571 Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Wed, 15 Aug 2018 00:12:48 +0200 Subject: [PATCH] i2c: add missing methods so the GrovePi fully implements the Adaptor interface Signed-off-by: Ron Evans --- drivers/i2c/grovepi_driver.go | 10 ++++++++++ drivers/i2c/grovepi_driver_test.go | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/i2c/grovepi_driver.go b/drivers/i2c/grovepi_driver.go index 4802cb01..997f2fd2 100644 --- a/drivers/i2c/grovepi_driver.go +++ b/drivers/i2c/grovepi_driver.go @@ -80,6 +80,16 @@ func (d *GrovePiDriver) Start() (err error) { // Halt returns true if devices is halted successfully func (d *GrovePiDriver) Halt() (err error) { return } +// Connect is here to implement the Adaptor interface. +func (d *GrovePiDriver) Connect() (err error) { + return +} + +// Finalize is here to implement the Adaptor interface. +func (d *GrovePiDriver) Finalize() (err error) { + return +} + // AnalogRead returns value from analog pin implementing the AnalogReader interface. func (d *GrovePiDriver) AnalogRead(pin string) (value int, err error) { pin = getPin(pin) diff --git a/drivers/i2c/grovepi_driver_test.go b/drivers/i2c/grovepi_driver_test.go index a06b6094..a83a90c7 100644 --- a/drivers/i2c/grovepi_driver_test.go +++ b/drivers/i2c/grovepi_driver_test.go @@ -21,6 +21,9 @@ var _ gpio.DigitalWriter = (*GrovePiDriver)(nil) // must implement the AnalogReader interface var _ aio.AnalogReader = (*GrovePiDriver)(nil) +// must implement the Adaptor interface +var _ gobot.Adaptor = (*GrovePiDriver)(nil) + func initTestGrovePiDriver() (driver *GrovePiDriver) { driver, _ = initGrovePiDriverWithStubbedAdaptor() return