Add onewire smoke test (#104)

* set SPI speed and mode in spi smoketest
* add one-wire smoke test
pull/1/head
Thorsten von Eicken 10 years ago committed by M-A
parent 2d5524c4cb
commit a76f663ae2

@ -37,6 +37,13 @@ func (d *Dev) String() string {
return fmt.Sprintf("ds248x") 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 // Tx performs a bus transaction, sending and receiving bytes, and
// ending by pulling the bus high either weakly or strongly depending // ending by pulling the bus high either weakly or strongly depending
// on the value of power. // on the value of power.

@ -42,7 +42,11 @@ type Opts struct {
PullupRes PupOhm // passive pull-up resistance, true: 500Ω, false: 1kΩ 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) { func New(i i2c.Bus, opts *Opts) (*Dev, error) {
addr := uint16(0x18) addr := uint16(0x18)
if opts != nil { if opts != nil {

Loading…
Cancel
Save