golang.org/x/exp@v0.0.0-20240506185415-9bf2ced13842/io/i2c/driver/driver.go (about) 1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package driver contains interfaces to be implemented by various I2C implementations. 6 package driver // import "golang.org/x/exp/io/i2c/driver" 7 8 // Opener opens a connection to an I2C device to communicate with 9 // the I2C address given. If the address is an 10-bit I2C address, 10 // tenbit is true. 11 type Opener interface { 12 Open(addr int, tenbit bool) (Conn, error) 13 } 14 15 // Conn represents an active connection to an I2C device. 16 type Conn interface { 17 // Tx first writes w (if not nil), then reads len(r) 18 // bytes from device into r (if not nil) in a single 19 // I2C transaction. 20 Tx(w, r []byte) error 21 22 // Close closes the connection. 23 Close() error 24 }