core: update Digispark platform to simply return error
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
84e2757776
commit
0926a985e1
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue