core: update Digispark platform to simply return error

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2016-11-07 19:10:22 +01:00
parent 84e2757776
commit 0926a985e1
2 changed files with 6 additions and 8 deletions

View File

@ -38,15 +38,13 @@ func (d *Adaptor) Name() string { return d.name }
func (d *Adaptor) SetName(n string) { d.name = n }
// Connect starts a connection to the digispark
func (d *Adaptor) Connect() (errs []error) {
if err := d.connect(d); err != nil {
return []error{err}
}
func (d *Adaptor) Connect() (err error) {
err = d.connect(d)
return
}
// Finalize implements the Adaptor interface
func (d *Adaptor) Finalize() (errs []error) { return }
func (d *Adaptor) Finalize() (err error) { return }
// DigitalWrite writes a value to the pin. Acceptable values are 1 or 0.
func (d *Adaptor) DigitalWrite(pin string, level byte) (err error) {

View File

@ -72,15 +72,15 @@ func initTestAdaptor() *Adaptor {
func TestAdaptorConnect(t *testing.T) {
a := NewAdaptor()
gobottest.Assert(t, a.Connect()[0], ErrConnection)
gobottest.Assert(t, a.Connect(), ErrConnection)
a = initTestAdaptor()
gobottest.Assert(t, len(a.Connect()), 0)
gobottest.Assert(t, a.Connect(), nil)
}
func TestAdaptorFinalize(t *testing.T) {
a := initTestAdaptor()
gobottest.Assert(t, len(a.Finalize()), 0)
gobottest.Assert(t, a.Finalize(), nil)
}
func TestAdaptorDigitalWrite(t *testing.T) {