1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 20:07:40 +02:00

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

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`