Documentation
¶
Index ¶
- Constants
- type I2C
- func (v *I2C) Close() error
- func (v *I2C) GetAddr() uint8
- func (v *I2C) GetBus() int
- func (v *I2C) ReadBytes(buf []byte) (int, error)
- func (v *I2C) ReadRegBytes(reg byte, n int) ([]byte, int, error)
- func (v *I2C) ReadRegS16BE(reg byte) (int16, error)
- func (v *I2C) ReadRegS16LE(reg byte) (int16, error)
- func (v *I2C) ReadRegU16BE(reg byte) (uint16, error)
- func (v *I2C) ReadRegU16LE(reg byte) (uint16, error)
- func (v *I2C) ReadRegU8(reg byte) (byte, error)
- func (v *I2C) WriteBytes(buf []byte) (int, error)
- func (v *I2C) WriteRegS16BE(reg byte, value int16) error
- func (v *I2C) WriteRegS16LE(reg byte, value int16) error
- func (v *I2C) WriteRegU16BE(reg byte, value uint16) error
- func (v *I2C) WriteRegU16LE(reg byte, value uint16) error
- func (v *I2C) WriteRegU8(reg byte, value byte) error
- type Options
Constants ¶
const ( I2C_SLAVE = C.I2C_SLAVE I2C_SLAVE_FORCE = C.I2C_SLAVE_FORCE )
Get I2C_SLAVE constant value from Linux OS I2C declaration file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type I2C ¶
type I2C struct {
// contains filtered or unexported fields
}
I2C represents a connection to I2C-device.
func NewI2C ¶
NewI2C opens a connection for I2C-device. SMBus (System Management Bus) protocol over I2C supported as well: you should preliminary specify register address to read from, either write register together with the data in case of write operations.
func NewI2CWithOptions ¶
NewI2CWithOptions same as NewI2C, but with provided options. If opts are nil will use defaults
func (*I2C) ReadBytes ¶
ReadBytes read bytes from I2C-device. Number of bytes read correspond to buf parameter length.
func (*I2C) ReadRegBytes ¶
ReadRegBytes read count of n byte's sequence from I2C-device starting from reg address. SMBus (System Management Bus) protocol over I2C.
func (*I2C) ReadRegS16BE ¶
ReadRegS16BE reads signed big endian word (16 bits) from I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) ReadRegS16LE ¶
ReadRegS16LE reads signed little endian word (16 bits) from I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) ReadRegU16BE ¶
ReadRegU16BE reads unsigned big endian word (16 bits) from I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) ReadRegU16LE ¶
ReadRegU16LE reads unsigned little endian word (16 bits) from I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) ReadRegU8 ¶
ReadRegU8 reads byte from I2C-device register specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) WriteBytes ¶
WriteBytes send bytes to the remote I2C-device. The interpretation of the message is implementation-dependent.
func (*I2C) WriteRegS16BE ¶
WriteRegS16BE writes signed big endian word (16 bits) value to I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) WriteRegS16LE ¶
WriteRegS16LE writes signed little endian word (16 bits) value to I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) WriteRegU16BE ¶
WriteRegU16BE writes unsigned big endian word (16 bits) value to I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.
func (*I2C) WriteRegU16LE ¶
WriteRegU16LE writes unsigned little endian word (16 bits) value to I2C-device starting from address specified in reg. SMBus (System Management Bus) protocol over I2C.