Documentation ¶
Index ¶
- type Bus
- func (b *Bus) Add(p ...Peripheral)
- func (b *Bus) Close() error
- func (b *Bus) ReadRegister(address uint8, register uint8, data []byte) error
- func (b *Bus) SetSpeed(f physic.Frequency) error
- func (b *Bus) String() (str string)
- func (b *Bus) Tx(addr uint16, w, r []byte) error
- func (b *Bus) WriteRegister(address uint8, register uint8, data []byte) error
- type Peripheral
- type Registered
- type SPIBus
- func (b *SPIBus) Add(p ...Peripheral)
- func (b *SPIBus) Close() error
- func (b *SPIBus) Connect(f physic.Frequency, mode spi.Mode, bits int) (spi.Conn, error)
- func (b *SPIBus) Duplex() conn.Duplex
- func (b *SPIBus) LimitSpeed(f physic.Frequency) error
- func (b *SPIBus) SetSpeed(f physic.Frequency) error
- func (b *SPIBus) String() (str string)
- func (s *SPIBus) Tx(w, r []byte) error
- func (b *SPIBus) TxPackets(packets []spi.Packet) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct { // NoLock set to true disables // locking bus transaction. NoLock bool // contains filtered or unexported fields }
func (*Bus) Add ¶
func (b *Bus) Add(p ...Peripheral)
func (*Bus) ReadRegister ¶
ReadRegister transmits the register, restarts the connection as a read operation, and reads the response.
Many I2C-compatible devices are organized in terms of registers. This method is a shortcut to easily read such registers. Also, it only works for devices with 7-bit addresses, which is the vast majority.
func (*Bus) WriteRegister ¶
WriteRegister transmits first the register and then the data to the peripheral device.
Many I2C-compatible devices are organized in terms of registers. This method is a shortcut to easily write to such registers. Also, it only works for devices with 7-bit addresses, which is the vast majority.
type Peripheral ¶
type Registered ¶
type Registered struct {
// contains filtered or unexported fields
}
func NewRegistered ¶
func NewRegistered(addr uint16, regData []byte) Registered
func (Registered) Tx ¶
func (rg Registered) Tx(addr uint16, w, r []byte)
Click to show internal directories.
Click to hide internal directories.