driverskeleton

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

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
// FIXME: Make sure to expose a simple use case.
if _, err := host.Init(); err != nil {
	log.Fatalf("failed to initialize periph: %v", err)
}
bus, err := i2creg.Open("")
if err != nil {
	log.Fatalf("failed to open I²C: %v", err)
}
defer bus.Close()
dev, err := New(bus)
if err != nil {
	log.Fatalf("failed to initialize: %v", err)
}
fmt.Printf("%s\n", dev.Read())
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dev

type Dev struct {
	// contains filtered or unexported fields
}

Dev is a handle to the device. FIXME.

func New

func New(i i2c.Bus) (*Dev, error)

New opens a handle to the device. FIXME.

func (*Dev) Read

func (d *Dev) Read() string

Read is a method on your device. FIXME.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL