diff --git a/experimental/devices/ds248x/dev.go b/experimental/devices/ds248x/dev.go index fa44ef5..e48cf77 100644 --- a/experimental/devices/ds248x/dev.go +++ b/experimental/devices/ds248x/dev.go @@ -37,6 +37,13 @@ func (d *Dev) String() string { return fmt.Sprintf("ds248x") } +// Close drops the I²C bus handle and sets a persistent error. +func (d *Dev) Close() error { + d.i2c = nil + d.err = fmt.Errorf("ds248x: invalid operation on closed bus") + return nil +} + // Tx performs a bus transaction, sending and receiving bytes, and // ending by pulling the bus high either weakly or strongly depending // on the value of power. diff --git a/experimental/devices/ds248x/ds248x.go b/experimental/devices/ds248x/ds248x.go index b072edc..0b71f4b 100644 --- a/experimental/devices/ds248x/ds248x.go +++ b/experimental/devices/ds248x/ds248x.go @@ -42,7 +42,11 @@ type Opts struct { PullupRes PupOhm // passive pull-up resistance, true: 500Ω, false: 1kΩ } -// New returns an device object that communicates over I²C to the DS2482/DS2483 controller. +// New returns a device object that communicates over I²C to the DS2482/DS2483 +// controller. +// +// This device object implements onewire.Bus and can be used to +// access devices on the bus. func New(i i2c.Bus, opts *Opts) (*Dev, error) { addr := uint16(0x18) if opts != nil {