chip

package
v0.0.0-...-d3d8c0c Latest Latest
Warning

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

Go to latest
Published: May 8, 2017 License: MIT Imports: 2 Imported by: 2

README

Using embd on CHIP

The CHIP drivers support gpio, I2C, SPI, and pin interrupts. Not supported are PWM or LED. The names of the pins on chip have multiple aliases. The official CHIP pin names are supported, for example XIO-P1 or LCD-D2 and the pin number are also supported, such as U14-14 (same as XIO-P1) or U13-17. Some of the alternate function names are also supported, like "SPI2_MOSI", and the linux 4.4 kernel gpio pin numbers as well, e.g., 1017 for XIO-P1. Finally, the official GPIO pins (XIO-P0 thru XIO-P7) can be addressed as gpio0-gpio7.

A simple demo to blink an LED connected with a small resistor between XIO-P6 and 3.3V is

package main
import (
	"time"
	"github.com/kidoman/embd"
	_ "github.com/kidoman/embd/host/chip"
)

func main() {
	embd.InitGPIO()
	defer embd.CloseGPIO()

	embd.SetDirection("gpio6", embd.Out)
	on := 0
	for {
		embd.DigitalWrite("gpio6", on)
		on = 1 - on
		time.Sleep(250 * time.Millisecond)
	}
}

Run it as root: sudo ./blinky

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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