Documentation ¶
Index ¶
- Constants
- Variables
- type BaudRateController
- type Bus
- type ByteReaderFrom
- type ByteWriterTo
- type Controller
- type Device
- type DeviceID
- type I2C
- func (i2c *I2C) DeviceID(addr byte) (DeviceID, error)
- func (i2c *I2C) Ping(addr byte) error
- func (i2c *I2C) PingW(addr byte) error
- func (i2c *I2C) Read(p []byte) (n int, err error)
- func (i2c *I2C) ReadByte() (byte, error)
- func (i2c *I2C) ReadByteFrom(addr uint16) (byte, error)
- func (i2c *I2C) ReadFrom(p []byte, addr uint16) (int, error)
- func (i2c *I2C) ReadRegister(addr, reg byte, p []byte) error
- func (i2c *I2C) SetBaudrate(baudrate uint32) error
- func (i2c *I2C) Tx(addr uint16, w, r []byte) (err error)
- func (i2c *I2C) TxN(addr uint16, w, r []byte) (wn, rn int, err error)
- func (i2c *I2C) Write(p []byte) (int, error)
- func (i2c *I2C) WriteByte(b byte) (err error)
- func (i2c *I2C) WriteByteTo(p byte, addr uint16) error
- func (i2c *I2C) WriteRegister(addr, reg byte, p []byte) error
- func (i2c *I2C) WriteTo(p []byte, addr uint16) (int, error)
- type ReaderFrom
- type WriterTo
Constants ¶
View Source
const ( Min7BitAddr = 0x08 Max7BitAddr = 0x77 Min10BitAddr = 0x7800 Max10BitAddr = 0x7bff )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BaudRateController ¶
type ByteReaderFrom ¶
type ByteWriterTo ¶
type Controller ¶
type Controller interface { Start() error Stop() error WriteBit(bool) error ReadBit() (bool, error) }
func NewSoftController ¶
func NewSoftController(sda, scl driver.Pin) Controller
NewSoftController will create a generic I2C controller. Pins should be configured as inputs with pull-up and output should be logic-low.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
type I2C ¶
type I2C struct {
Controller
}
func New ¶
func New(c Controller) *I2C
func (*I2C) Read ¶
Read will read directly from the bus, without any address or start/stop condition.
func (*I2C) ReadByte ¶
ReadByte reads a single byte directly from the bus, without any address or start/stop condition.
func (*I2C) SetBaudrate ¶
func (*I2C) Write ¶
Write will write directly to the bus, without any address or start/stop condition.
Click to show internal directories.
Click to hide internal directories.