Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 675 Bytes

README.md

File metadata and controls

33 lines (26 loc) · 675 Bytes

smbus

GoDoc

smbus provides access to the System Management bus, over I2C.

Example

func TestOpen(t *testing.T) {
	usr, err := user.Current()
	if err != nil {
		t.Fatalf("os/user: %v\n", err)
	}

	if usr.Name != "root" {
		t.Skip("need root access")
	}

	c, err := smbus.Open(0, 0x69)
	if err != nil {
		t.Fatalf("open error: %v\n", err)
	}
	defer c.Close()

	v, err := c.ReadReg(0x69, 0x1)
	if err != nil {
		t.Fatalf("read-reg error: %v\n", err)
	}
	t.Logf("v=%v\n", v)
}