conn

package
v1.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type I2C

type I2C struct {
	// contains filtered or unexported fields
}

func OpenI2C

func OpenI2C(device int, addr uint8) (*I2C, error)

func (*I2C) Close

func (c *I2C) Close() error

func (*I2C) Read

func (c *I2C) Read(p []byte) (int, error)

func (*I2C) Reset

func (i *I2C) Reset() error

Reset does nothing (for now?).

func (*I2C) String

func (c *I2C) String() string

func (*I2C) Write

func (c *I2C) Write(p []byte) (int, error)

type SPI

type SPI struct {
	// contains filtered or unexported fields
}

SPI implements the spidev interface.

func OpenSPI

func OpenSPI(bus, device int) (*SPI, error)

OpenSPI opens the numbered spi bus with the numbered device. The device often corresponds to the CS pin for that bus.

func (*SPI) BitsPerWord

func (c *SPI) BitsPerWord() uint8

func (*SPI) Close

func (c *SPI) Close() error

func (*SPI) MaxSpeed

func (c *SPI) MaxSpeed() int

func (*SPI) Mode

func (c *SPI) Mode() SPIMode

func (*SPI) Read

func (c *SPI) Read(b []byte) (n int, err error)

func (*SPI) SetBitsPerWord

func (c *SPI) SetBitsPerWord(bits uint8) error

func (*SPI) SetMaxSpeed

func (c *SPI) SetMaxSpeed(v int) error

func (*SPI) SetMode

func (c *SPI) SetMode(mode SPIMode) error

func (*SPI) String

func (c *SPI) String() string

func (*SPI) Write

func (c *SPI) Write(b []byte) (n int, err error)

type SPIMode

type SPIMode uint8
const (
	SPIMode0 SPIMode = (0 | 0)             //nolint:staticcheck
	SPIMode1 SPIMode = (0 | spiCPHA)       //nolint:staticcheck
	SPIMode2 SPIMode = (spiCPOL | 0)       //nolint:staticcheck
	SPIMode3 SPIMode = (spiCPOL | spiCPHA) //nolint:staticcheck
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL