spi

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

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

Go to latest
Published: Jun 25, 2018 License: MIT Imports: 3 Imported by: 0

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) (*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() (int, error)

Mode returns the mode of the SPI device.

func (*Device) Read

func (dev *Device) Read(buf []byte) error

Read reads from dev into buf, blocking if necessary until exactly len(buf) bytes have been read.

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(m int) error

SetMode sets the mode of the SPI device.

func (*Device) Transfer

func (dev *Device) Transfer(tx, rx []byte) error

Transfer uses buf for an SPI transfer operation (send and receive). The received data overwrites buf.

func (*Device) Write

func (dev *Device) Write(buf []byte) error

Write writes len(buf) bytes from buf to dev.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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