Documentation ¶
Index ¶
- Constants
- func Init(deviceTree string)
- type Mode
- type SPI
- func (spi *SPI) BitsPerWord() uint8
- func (spi *SPI) CSHigh() bool
- func (spi *SPI) Close() error
- func (spi *SPI) LSBFirst() bool
- func (spi *SPI) Loop() bool
- func (spi *SPI) MaxSpeedHz() uint32
- func (spi *SPI) Mode() Mode
- func (spi *SPI) Read(data []byte) (n int, err error)
- func (spi *SPI) SetBitsPerWord(bits uint8) error
- func (spi *SPI) SetCSHigh(csHigh bool) error
- func (spi *SPI) SetLSBFirst(lsbFirst bool) error
- func (spi *SPI) SetLoop(loop bool) error
- func (spi *SPI) SetMaxSpeedHz(maxSpeedHz uint32) error
- func (spi *SPI) SetMode(mode Mode) error
- func (spi *SPI) SetThreeWire(threeWire bool) error
- func (spi *SPI) ThreeWire() bool
- func (spi *SPI) Write(data []byte) (n int, err error)
- func (spi *SPI) Xfer(txBuf []byte, delay_usecs uint16) (rxBuf []byte, err error)
- func (spi *SPI) Xfer2(txBuf []byte, delay_usecs uint16) (rxBuf []byte, err error)
Constants ¶
View Source
const ( CPHA uint8 = 0x01 /* clock phase */ CPOL uint8 = 0x02 /* clock polarity */ CS_HIGH uint8 = 0x04 /* chipselect active high? */ LSB_FIRST uint8 = 0x08 /* per-word bits-on-wire */ THREE_WIRE uint8 = 0x10 /* SI/SO signals shared */ LOOP uint8 = 0x20 /* loopback mode */ )
View Source
const ( NO_CS = 0x40 /* 1 dev/bus, no chipselect */ READY = 0x80 /* slave pulls low to pause */ TX_DUAL = 0x100 /* transmit with 2 wires */ TX_QUAD = 0x200 /* transmit with 4 wires */ RX_DUAL = 0x400 /* receive with 2 wires */ RX_QUAD = 0x800 /* receive with 4 wires */ )
not used yet
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mode ¶
type Mode uint8
SPI mode as two bit pattern of Clock Polarity and Phase [CPOL|CPHA] min: 0b00 = 0 max: 0b11 = 3
type SPI ¶
type SPI struct {
// contains filtered or unexported fields
}
func NewSPI ¶
NewSPI returns a new SPI object that is connected to the specified SPI device interface.
NewSPI(X,Y) will open /dev/spidev-X.Y
SPI is an object type that allows SPI transactions on hosts running the Linux kernel. The host kernel must have SPI support and SPI device interface support. All of these can be either built-in to the kernel, or loaded from modules.
Because the SPI device interface is opened R/W, users of this module usually must have root permissions.
func (*SPI) BitsPerWord ¶
func (*SPI) MaxSpeedHz ¶
func (*SPI) SetBitsPerWord ¶
func (*SPI) SetLSBFirst ¶
func (*SPI) SetMaxSpeedHz ¶
func (*SPI) SetThreeWire ¶
Click to show internal directories.
Click to hide internal directories.