Documentation ¶
Overview ¶
Package bitbang implements conn by banging on the bits (GPIO pins).
This is not efficient but works around broken or missing drivers.
Index ¶
- Constants
- type I2C
- type SPI
- func (s *SPI) CLK() gpio.PinOut
- func (s *SPI) CS() gpio.PinOut
- func (s *SPI) Close() error
- func (s *SPI) Connect(maxHz int64, mode spi.Mode, bits int) error
- func (s *SPI) Duplex() conn.Duplex
- func (s *SPI) LimitSpeed(maxHz int64) error
- func (s *SPI) MISO() gpio.PinIn
- func (s *SPI) MOSI() gpio.PinOut
- func (s *SPI) String() string
- func (s *SPI) Tx(w, r []byte) error
- func (s *SPI) TxPackets(p []spi.Packet) error
- func (s *SPI) Write(d []byte) (int, error)
- Bugs
Constants ¶
const SkipAddr uint16 = 0xFFFF
SkipAddr can be used to skip the address from being sent.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type I2C ¶
type I2C struct {
// contains filtered or unexported fields
}
I2C represents an I²C master implemented as bit-banging on 2 GPIO pins.
type SPI ¶
type SPI struct {
// contains filtered or unexported fields
}
SPI represents a SPI master implemented as bit-banging on 3 or 4 GPIO pins.
func NewSPI ¶
NewSPI returns an object that communicates SPI over 3 or 4 pins.
BUG(maruel): Completely untested.
cs can be nil.
func (*SPI) LimitSpeed ¶
LimitSpeed implements spi.ConnCloser.
func (*SPI) Tx ¶
Tx implements spi.Conn.
BUG(maruel): Implement mode. BUG(maruel): Implement bits. BUG(maruel): Test if read works.
Notes ¶
Bugs ¶
It is close to working but not yet, the signal is incorrect during ACK.
It has two special features:
- Special address SkipAddr can be used to skip the address from being communicated
- An arbitrary speed can be used
Implement mode.
Implement bits.
Test if read works.
Completely untested.
cs can be nil.