i2c: add missing methods so the GrovePi fully implements the Adaptor interface

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans 2018-08-15 00:12:48 +02:00
parent e041a93021
commit 1e9ebd1cc6
2 changed files with 13 additions and 0 deletions

View File

@ -80,6 +80,16 @@ func (d *GrovePiDriver) Start() (err error) {
// Halt returns true if devices is halted successfully // Halt returns true if devices is halted successfully
func (d *GrovePiDriver) Halt() (err error) { return } 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. // AnalogRead returns value from analog pin implementing the AnalogReader interface.
func (d *GrovePiDriver) AnalogRead(pin string) (value int, err error) { func (d *GrovePiDriver) AnalogRead(pin string) (value int, err error) {
pin = getPin(pin) pin = getPin(pin)

View File

@ -21,6 +21,9 @@ var _ gpio.DigitalWriter = (*GrovePiDriver)(nil)
// must implement the AnalogReader interface // must implement the AnalogReader interface
var _ aio.AnalogReader = (*GrovePiDriver)(nil) var _ aio.AnalogReader = (*GrovePiDriver)(nil)
// must implement the Adaptor interface
var _ gobot.Adaptor = (*GrovePiDriver)(nil)
func initTestGrovePiDriver() (driver *GrovePiDriver) { func initTestGrovePiDriver() (driver *GrovePiDriver) {
driver, _ = initGrovePiDriverWithStubbedAdaptor() driver, _ = initGrovePiDriverWithStubbedAdaptor()
return return