Documentation
¶
Overview ¶
Package smbus provides go bindings for the SMBus (System Management Bus) kernel interface SMBus is a subset of i2c suitable for a large number of devices Original domentation : https://www.kernel.org/doc/Documentation/i2c/smbus-protocol
Index ¶
- type SMBus
- func (smb SMBus) Block_process_call(cmd byte, buf []byte) ([]byte, error)
- func (smb *SMBus) Bus_close() error
- func (smb *SMBus) Bus_open(bus uint) error
- func (smb SMBus) Process_call(cmd byte, value uint16) (uint16, error)
- func (smb SMBus) Read_block_data(cmd byte, buf []byte) (int, error)
- func (smb SMBus) Read_byte() (byte, error)
- func (smb SMBus) Read_byte_data(cmd byte) (byte, error)
- func (smb SMBus) Read_i2c_block_data(cmd byte, buf []byte) (int, error)
- func (smb *SMBus) Read_word_data(cmd byte) (uint16, error)
- func (smb *SMBus) Set_addr(addr byte) error
- func (smb SMBus) Write_block_data(cmd byte, buf []byte) (int, error)
- func (smb SMBus) Write_byte(value byte) error
- func (smb SMBus) Write_byte_data(cmd, value byte) error
- func (smb SMBus) Write_i2c_block_data(cmd byte, buf []byte) (int, error)
- func (smb SMBus) Write_quick(value byte) error
- func (smb SMBus) Write_word_data(cmd byte, value uint16) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SMBus ¶
type SMBus struct {
// contains filtered or unexported fields
}
Base type. Wraps a bus device and an address
func (SMBus) Block_process_call ¶
This command selects a device register (through the cmd byte), sends 1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return.
func (*SMBus) Bus_open ¶
Opens a new bus file with a given index. Will return an error if a bus is already open
func (SMBus) Process_call ¶
This command selects a device register (through the cmd byte), sends 16 bits of data to it, and reads 16 bits of data in return.
func (SMBus) Read_block_data ¶
This command reads a block of up to 32 bytes from a device, from a designated register that is specified through the cmd byte. The amount of data in byte is specified by the length of the buf slice. To read 4 bytes of data, pass a slice created like this: make([]byte, 4)
func (SMBus) Read_byte ¶
Reads a single byte from a device, without specifying a device register. Some devices are so simple that this interface is enough; for others, it is a shorthand if you want to read the same register as in the previous SMBus command.
func (SMBus) Read_byte_data ¶
Reads a single byte from a device, from a designated register. The register is specified through the cmd byte
func (SMBus) Read_i2c_block_data ¶
Block read method for devices without SMBus support. Uses plain i2c interface
func (*SMBus) Read_word_data ¶
This operation is very like Read Byte; again, data is read from a device, from a designated register that is specified through the cmd byte. But this time, the data is a complete word (16 bits).
func (SMBus) Write_block_data ¶
The opposite of the Block Read command, this writes up to 32 bytes to a device, to a designated register that is specified through the cmd byte. The amount of data is specified by the lengts of buf.
func (SMBus) Write_byte ¶
This operation is the reverse of Receive Byte: it sends a single byte to a device. See Receive Byte for more information.
func (SMBus) Write_byte_data ¶
Writes a single byte to a device, to a designated register. The register is specified through the cmd byte. This is the opposite of the Read Byte operation.
func (SMBus) Write_i2c_block_data ¶
Block write method for devices without SMBus support. Uses plain i2c interface
func (SMBus) Write_quick ¶
Sends a single bit to the device, at the place of the Rd/Wr bit.