mirror of
https://github.com/kidoman/embd
synced 2024-12-22 04:40:04 +01:00
Update README for CHIP support by TvE
This commit is contained in:
parent
e16818f0aa
commit
56cb934dbf
64
README.md
64
README.md
@ -1,10 +1,22 @@
|
|||||||
# 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 [![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** is a hardware abstraction layer (HAL) for embedded systems.
|
**embd** is a hardware abstraction layer (HAL) for embedded systems.
|
||||||
|
|
||||||
It allows you to start your hardware hack on easily available hobby boards (like the Raspberry Pi, BeagleBone Black, etc.) by giving you staight forward access to the board's capabilities as well as a plethora of **sensors** (like accelerometers, gyroscopes, thermometers, etc.) and **controllers** (PWM generators, digital-to-analog convertors) for which we have written drivers. And when things get serious, you dont have to throw away the code. You carry forward the effort onto more custom designed boards where the HAL abstraction of EMBD will save you precious time.
|
**The github.com/tve/embd fork** attempts to continue the work started by
|
||||||
|
@kidoman and adds support for NextThing's C.H.I.P.
|
||||||
|
|
||||||
Development supported and sponsored by [**SoStronk**](https://www.sostronk.com) and [**ThoughtWorks**](http://www.thoughtworks.com/)
|
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
|
||||||
|
**sensors** (like accelerometers, gyroscopes, thermometers, etc.) and
|
||||||
|
**controllers** (PWM generators, digital-to-analog convertors) for
|
||||||
|
which we have written drivers. And when things get serious, you dont
|
||||||
|
have to throw away the code. You carry forward the effort onto more
|
||||||
|
custom designed boards where the HAL abstraction of EMBD will save you
|
||||||
|
precious time.
|
||||||
|
|
||||||
|
Original development supported and sponsored by [**SoStronk**](https://www.sostronk.com) and
|
||||||
|
[**ThoughtWorks**](http://www.thoughtworks.com/).
|
||||||
|
|
||||||
Also, you might be interested in: [Why Golang?](https://github.com/kidoman/embd/wiki/Why-Go)
|
Also, you might be interested in: [Why Golang?](https://github.com/kidoman/embd/wiki/Why-Go)
|
||||||
|
|
||||||
@ -12,7 +24,8 @@ Also, you might be interested in: [Why Golang?](https://github.com/kidoman/embd/
|
|||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
After installing Go* and setting up your [GOPATH](http://golang.org/doc/code.html#GOPATH), create your first .go file. We'll call it ```simpleblinker.go```.
|
After installing Go* and setting up your [GOPATH](http://golang.org/doc/code.html#GOPATH),
|
||||||
|
create your first .go file. We'll call it ```simpleblinker.go```.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@ -32,9 +45,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Then install the EMBD package (go1.2 and greater is required):
|
Then install the EMBD package (go1.6 or greater is required):
|
||||||
|
|
||||||
$ go get github.com/kidoman/embd
|
$ go get github.com/tve/embd
|
||||||
|
|
||||||
Build the binary*:
|
Build the binary*:
|
||||||
|
|
||||||
@ -54,11 +67,11 @@ Then run the program with ```sudo```*:
|
|||||||
|
|
||||||
**<nowiki>*</nowiki> Notes**
|
**<nowiki>*</nowiki> Notes**
|
||||||
|
|
||||||
* Please install the cross compilers. Mac users: ```brew install go --cross-compile-common```. [goxc](https://github.com/laher/goxc) can be a big help as well
|
|
||||||
* We are instructing the ```go``` compiler to create a binary which will run on the RaspberryPi processor
|
* We are instructing the ```go``` compiler to create a binary which will run on the RaspberryPi processor
|
||||||
* Assuming your RaspberryPi has an IP address of ```192.168.2.2```. Substitute as necessary
|
* Assuming your RaspberryPi has an IP address of ```192.168.2.2```. Substitute as necessary
|
||||||
* ```sudo``` (root) permission is required as we are controlling the hardware by writing to special files
|
* ```sudo``` (root) permission is required as we are controlling the hardware by writing to special files
|
||||||
* This sample program is optimized for brevity and does not clean up after itself. Click here to see the [full version](https://github.com/kidoman/embd/blob/master/samples/fullblinker.go)
|
* This sample program is optimized for brevity and does not clean up after itself. Click here to
|
||||||
|
see the [full version](https://github.com/kidoman/embd/blob/master/samples/fullblinker.go)
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
@ -68,6 +81,7 @@ Join the [mailing list](https://groups.google.com/forum/#!forum/go-embd)
|
|||||||
|
|
||||||
* [RaspberryPi](http://www.raspberrypi.org/) (including [A+](http://www.raspberrypi.org/products/model-a-plus/) and [B+](http://www.raspberrypi.org/products/model-b-plus/))
|
* [RaspberryPi](http://www.raspberrypi.org/) (including [A+](http://www.raspberrypi.org/products/model-a-plus/) and [B+](http://www.raspberrypi.org/products/model-b-plus/))
|
||||||
* [RaspberryPi 2](http://www.raspberrypi.org/)
|
* [RaspberryPi 2](http://www.raspberrypi.org/)
|
||||||
|
* [NextThing C.H.I.P](https://www.nextthing.co/pages/chip)
|
||||||
* [BeagleBone Black](http://beagleboard.org/Products/BeagleBone%20Black)
|
* [BeagleBone Black](http://beagleboard.org/Products/BeagleBone%20Black)
|
||||||
* [Intel Edison](http://www.intel.com/content/www/us/en/do-it-yourself/galileo-maker-quark-board.html) **coming soon**
|
* [Intel Edison](http://www.intel.com/content/www/us/en/do-it-yourself/galileo-maker-quark-board.html) **coming soon**
|
||||||
* [Radxa](http://radxa.com/) **coming soon**
|
* [Radxa](http://radxa.com/) **coming soon**
|
||||||
@ -202,6 +216,40 @@ 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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user