Documentation ¶
Overview ¶
Package driverskeleton is an example that can be copy pasted to help write a new driver, either in devices/ or in host/.
You must remove all comments with FIXME. This also proves you read the instructions! :)
FIXME: Include additional information relevant to users, including configuring the device if relevant.
Datasheet ¶
FIXME: Please include a link to a datasheet as per the guideline in doc/drivers/. This helps everyone when the driver needs to be improved.
Example ¶
package main import ( "fmt" "log" "periph.io/x/periph/conn/i2c/i2creg" "periph.io/x/periph/experimental/driverskeleton" "periph.io/x/periph/host" ) func main() { // Make sure periph is initialized. if _, err := host.Init(); err != nil { log.Fatal(err) } // FIXME: Make sure to expose a simple use case. b, err := i2creg.Open("") if err != nil { log.Fatalf("failed to open I²C: %v", err) } defer b.Close() dev, err := driverskeleton.New(b) if err != nil { log.Fatalf("failed to initialize: %v", err) } fmt.Println(dev.Read()) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.