From b6706df9a8525e587eb72be1a833cc59c512611b Mon Sep 17 00:00:00 2001 From: Thorsten von Eicken Date: Tue, 6 Sep 2016 21:07:08 -0700 Subject: [PATCH] make fork ready for merge-back --- README.md | 39 +-------------------------------------- host/chip/README.md | 34 ++++++++++++++++++++++++++++++++++ host/chip/chip.go | 2 +- radio/rfm69/registers.go | 2 +- radio/rfm69/rfm69.go | 2 +- 5 files changed, 38 insertions(+), 41 deletions(-) create mode 100644 host/chip/README.md diff --git a/README.md b/README.md index 94a954a..a7396b8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ -# embd [![Build Status](https://travis-ci.org/tve/embd.svg?branch=master)](https://travis-ci.org/tve/embd) [![GoDoc](http://godoc.org/github.com/tve/embd?status.png)](http://godoc.org/github.com/tve/embd) +# embd [![Build Status](https://travis-ci.org/kidoman/embd.svg?branch=master)](https://travis-ci.org/kidoman/embd) [![GoDoc](http://godoc.org/github.com/kidoman/embd?status.png)](http://godoc.org/github.com/kidoman/embd) **embd** is a hardware abstraction layer (HAL) for embedded systems. -**The github.com/tve/embd fork** attempts to continue the work started by -@kidoman and adds support for NextThing's C.H.I.P. - It allows you to start your hardware hack on easily available hobby boards (like the Raspberry Pi, BeagleBone Black, C.H.I.P., etc.) by giving you staight forward access to the board's capabilities as well as a plethora of @@ -216,40 +213,6 @@ heading, err := mag.Heading() The above two examples depend on **I2C** and therefore will work without change on almost all platforms. -## 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` - ## Protocols Supported * **Digital GPIO** [Documentation](http://godoc.org/github.com/kidoman/embd#DigitalPin) diff --git a/host/chip/README.md b/host/chip/README.md new file mode 100644 index 0000000..51fd49e --- /dev/null +++ b/host/chip/README.md @@ -0,0 +1,34 @@ +# 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` + diff --git a/host/chip/chip.go b/host/chip/chip.go index 277b72f..d849df4 100644 --- a/host/chip/chip.go +++ b/host/chip/chip.go @@ -1,4 +1,4 @@ -// Copyright 2016 by Thorsten von Eicken +// Copyright 2016 by Thorsten von Eicken, see LICENSE file // Package chip provides NextThing C.H.I.P. support. // References: diff --git a/radio/rfm69/registers.go b/radio/rfm69/registers.go index 0e2b2e3..94e2a73 100644 --- a/radio/rfm69/registers.go +++ b/radio/rfm69/registers.go @@ -1,4 +1,4 @@ -// Copyright 2016 by Thorsten von Eicken +// Copyright 2016 by Thorsten von Eicken, see LICENSE file package rfm69 diff --git a/radio/rfm69/rfm69.go b/radio/rfm69/rfm69.go index ec2d638..15029b6 100644 --- a/radio/rfm69/rfm69.go +++ b/radio/rfm69/rfm69.go @@ -1,4 +1,4 @@ -// Copyright 2016 by Thorsten von Eicken +// Copyright 2016 by Thorsten von Eicken, see LICENSE file // The RFM69 package interfaces with a HopeRF RFM69 radio connected to an SPI bus. In addition, // an interrupt capable GPIO pin may be used to avoid having to poll the radio.