Documentation ¶
Overview ¶
Package i2c allows users to read from and write to a slave I2C device.
Deprecated ¶
This package is not maintained anymore. An actively supported cross-platform alternative is https://periph.io/.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Devfs ¶
type Devfs struct { // Dev is the I2C bus device, e.g. /dev/i2c-1. Required. Dev string }
Devfs is an I2C driver that works against the devfs. You need to load the "i2c-dev" kernel module to use this driver.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents an I2C device. Devices must be closed once they are no longer in use.
func Open ¶
Open opens a connection to an I2C device. All devices must be closed once they are no longer in use. For devices that use 10-bit I2C addresses, addr can be marked as a 10-bit address with TenBit.
Example ¶
package main import ( "github.com/Andyfoo/golang/x/exp/io/i2c" ) func main() { d, err := i2c.Open(&i2c.Devfs{Dev: "/dev/i2c-1"}, 0x39) if err != nil { panic(err) } // opens a 10-bit address d, err = i2c.Open(&i2c.Devfs{Dev: "/dev/i2c-1"}, i2c.TenBit(0x78)) if err != nil { panic(err) } _ = d }
Output:
Directories ¶
Path | Synopsis |
---|---|
Package driver contains interfaces to be implemented by various I2C implementations.
|
Package driver contains interfaces to be implemented by various I2C implementations. |
example
|
|
displayip
Package main contains a program that displays the IPv4 address of the machine on an a Grove-LCD RGB backlight.
|
Package main contains a program that displays the IPv4 address of the machine on an a Grove-LCD RGB backlight. |
Click to show internal directories.
Click to hide internal directories.