spi

package module
v0.0.0-...-b0f4c20 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 4 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device represents an SPI device.

func Open

func Open(spiDevice string, speed int, customCS int) (*Device, error)

Open opens the given SPI device at the specified speed (in Hertz) If customCS in not zero, that pin number is used as a custom chip-select.

func (*Device) BitsPerWord

func (dev *Device) BitsPerWord() (int, error)

BitsPerWord returns the word size of the SPI device.

func (*Device) Close

func (dev *Device) Close() error

Close closes the SPI device.

func (*Device) LSBFirst

func (dev *Device) LSBFirst() (bool, error)

LSBFirst returns bit order of the SPI device.

func (*Device) MaxSpeed

func (dev *Device) MaxSpeed() (int, error)

MaxSpeed returns the maximum speed of the SPI device, in Hertz.

func (*Device) Mode

func (dev *Device) Mode() (uint8, error)

Mode returns the mode of the SPI device.

func (*Device) SetBitsPerWord

func (dev *Device) SetBitsPerWord(n int) error

SetBitsPerWord sets the word size of the SPI device.

func (*Device) SetLSBFirst

func (dev *Device) SetLSBFirst(lsb bool) error

SetLSBFirst sets the bit order of the SPI device.

func (*Device) SetMaxSpeed

func (dev *Device) SetMaxSpeed(n int) error

SetMaxSpeed sets the maximum speed of the SPI device, in Hertz.

func (*Device) SetMode

func (dev *Device) SetMode(mode uint8) error

SetMode sets the mode of the SPI device.

func (*Device) Transfer

func (dev *Device) Transfer(snd, rcv []byte) error

Transfer performs an SPI transfer operation (send and receive).

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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