Go to file
Karan Misra 5b852d9f42 gpio: provide an api to allow performance timing of pulses
the us020 driver is the first consumer of this functionality
2014-04-05 04:06:40 +05:30
controller unified servo and analog output support for pwms 2014-04-02 17:25:28 +05:30
interface/keypad/matrix4x3 bring the matrix4x3 library up to date 2014-03-03 00:55:20 +05:30
motion/servo unified servo and analog output support for pwms 2014-04-02 17:25:28 +05:30
samples samples: enable flag parsing 2014-04-05 01:43:16 +05:30
sensor gpio: provide an api to allow performance timing of pulses 2014-04-05 04:06:40 +05:30
util add test for Map 2014-03-02 14:53:09 +05:30
.gitignore bring in the idea of a hardware abstraction layer 2014-02-27 04:24:53 +05:30
.travis.yml - add a benchmark test for pinMap lookup 2014-03-23 05:23:25 +05:30
AUTHORS added support for us020 ultra sonic range finder 2013-12-13 05:51:22 +05:30
LICENSE initial commit 2013-12-08 17:39:41 +05:30
README.md doc: fixes 2014-03-29 09:47:22 +05:30
bbb.go bbb: initialise at the start of SetMicroseconds 2014-04-05 01:44:02 +05:30
descriptor.go - use a Register() method to register describers, instead of directly 2014-03-24 03:01:58 +05:30
detect.go Host type is now a string 2014-03-24 03:04:58 +05:30
detect_test.go simplify package structure 2014-03-03 00:51:23 +05:30
digitalpin.go gpio: provide an api to allow performance timing of pulses 2014-04-05 04:06:40 +05:30
doc.go doc: remove markdown from .go doc 2014-03-29 09:46:45 +05:30
gpio.go gpio: provide an api to allow performance timing of pulses 2014-04-05 04:06:40 +05:30
gpiodriver.go gpio: pwm support for bbb 2014-03-28 08:32:22 +05:30
gpiodriver_test.go gpio: pwm support for bbb 2014-03-28 08:32:22 +05:30
i2c.go add documentation 2014-03-23 14:09:31 +05:30
i2cdriver.go add documentation 2014-03-23 14:09:31 +05:30
led.go add documentation 2014-03-23 14:09:31 +05:30
leddriver.go add documentation 2014-03-23 14:09:31 +05:30
pin.go gpio: CapNormal -> CapAnalog 2014-03-23 14:11:09 +05:30
pin_test.go gpio: CapNormal -> CapAnalog 2014-03-23 14:11:09 +05:30
rpi.go move the Register calls to the bottom 2014-03-30 04:14:33 +05:30
utils.go gpio: make analog pin support more versatile on the bbb 2014-03-23 05:37:28 +05:30

README.md

embd Build Status GoDoc

A superheroic hardware abstraction layer for doing embedded programming on supported platforms like the Raspberry Pi and BeagleBone Black.

Development sponsored by ThoughtWorks

Platforms supported

How to use

Package embd provides a superheroic hardware abstraction layer for doing embedded programming on supported platforms like the Raspberry Pi and BeagleBone Black. Most of the examples below will work without change (i.e. the same binary) on all supported platforms. How cool is that?

Although samples are all present in the samples folder, we will show a few choice examples here.

Use the LED driver to toggle LEDs on the BBB:

import "github.com/kidoman/embd"
...
embd.InitLED()
defer embd.CloseLED()
...
led, err := embd.NewLED("USR3")
...
led.Toggle()

Even shorter while prototyping:

import "github.com/kidoman/embd"
...
embd.InitLED()
defer embd.CloseLED()
...
embd.ToggleLED(3)

NB: 3 == USR3 for all intents and purposes. The driver is smart enough to figure all this out.

BBB + PWM:

import "github.com/kidoman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
...
pwm, _ := embd.NewPWMPin("P9_14")
defer pwm.Close()
...
pwm.SetDuty(1000)

Control GPIO pins on the RaspberryPi / BeagleBone Black:

import "github.com/kidoman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
...
embd.SetDirection(10, embd.Out)
embd.DigitalWrite(10, embd.High)

Could also do:

import "github.com/kidoman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
...
pin, err := embd.NewDigitalPin(10)
...
pin.SetDirection(embd.Out)
pin.Write(embd.High)

Or read data from the Bosch BMP085 barometric sensor:

import "github.com/kidoman/embd"
import "github.com/kidoman/embd/sensor/bmp085"
...
bus := embd.NewI2CBus(1)
...
baro := bmp085.New(bus)
...
temp, err := baro.Temperature()
altitude, err := baro.Altitude()

Even find out the heading from the LSM303 magnetometer:

import "github.com/kidoman/embd"
import "github.com/kidoman/embd/sensor/lsm303"
...
bus := embd.NewI2CBus(1)
...
mag := lsm303.New(bus)
...
heading, err := mag.Heading()

The above two examples depend on I2C and therefore will work without change on almost all platforms.

Protocols supported

Sensors supported

Interfaces

Controllers