diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:36:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:36:04 +0000 |
commit | b09c6d56832eb1718c07d74abf3bc6ae3fe4e030 (patch) | |
tree | d2caec2610d4ea887803ec9e9c3cd77136c448ba /dependencies/pkg/mod/golang.org/x/exp@v0.0.0-20220613132600-b0d781184e0d/io/spi/driver/driver.go | |
parent | Initial commit. (diff) | |
download | icingadb-upstream.tar.xz icingadb-upstream.zip |
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dependencies/pkg/mod/golang.org/x/exp@v0.0.0-20220613132600-b0d781184e0d/io/spi/driver/driver.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dependencies/pkg/mod/golang.org/x/exp@v0.0.0-20220613132600-b0d781184e0d/io/spi/driver/driver.go b/dependencies/pkg/mod/golang.org/x/exp@v0.0.0-20220613132600-b0d781184e0d/io/spi/driver/driver.go new file mode 100644 index 0000000..7634440 --- /dev/null +++ b/dependencies/pkg/mod/golang.org/x/exp@v0.0.0-20220613132600-b0d781184e0d/io/spi/driver/driver.go @@ -0,0 +1,50 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package driver contains interfaces to be implemented by various SPI implementations. +package driver // import "golang.org/x/exp/io/spi/driver" + +const ( + Mode = iota + Bits + MaxSpeed + Order + Delay + CSChange +) + +// Opener is an interface to be implemented by the SPI driver to open +// a connection to an SPI device. +type Opener interface { + Open() (Conn, error) +} + +// Conn is a connection to an SPI device. +// TODO(jbd): Extend the interface to query configuration values. +type Conn interface { + // Configure configures the SPI device. + // + // Available configuration keys are: + // - Mode, the SPI mode (valid values are 0, 1, 2 and 3). + // - Bits, bits per word (default is 8-bit per word). + // - Speed, the max clock speed (in Hz). + // - Order, bit order to be used in transfers. Zero value represents + // the MSB-first, non-zero values represent LSB-first encoding. + // - Delay, the pause time between frames (in usecs). + // Some SPI devices require a minimum amount of wait time after + // each frame write. If set, Delay amount of usecs are inserted after + // each write. + // - CSChange, whether to leave the device's chipselect active after a Tx. + // + // SPI devices can override these values. + Configure(k, v int) error + + // Tx performs a SPI transaction: w is written if not nil, the result is + // put into r if not nil. len(w) must be equal to len(r), otherwise the + // driver should return an error. + Tx(w, r []byte) error + + // Close frees the underlying resources and closes the connection. + Close() error +} |