make fork ready for merge-back

This commit is contained in:
Thorsten von Eicken 2016-09-06 21:07:08 -07:00
parent 49e6cc504d
commit b6706df9a8
5 changed files with 38 additions and 41 deletions

View File

@ -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. **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 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 (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 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 The above two examples depend on **I2C** and therefore will work without change on almost all
platforms. 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 ## Protocols Supported
* **Digital GPIO** [Documentation](http://godoc.org/github.com/kidoman/embd#DigitalPin) * **Digital GPIO** [Documentation](http://godoc.org/github.com/kidoman/embd#DigitalPin)

34
host/chip/README.md Normal file
View File

@ -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`

View File

@ -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. // Package chip provides NextThing C.H.I.P. support.
// References: // References:

View File

@ -1,4 +1,4 @@
// Copyright 2016 by Thorsten von Eicken // Copyright 2016 by Thorsten von Eicken, see LICENSE file
package rfm69 package rfm69

View File

@ -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, // 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. // an interrupt capable GPIO pin may be used to avoid having to poll the radio.