This commit is contained in:
Clinton Freeman 2017-05-22 04:47:23 +00:00 committed by GitHub
commit de78476aca
96 changed files with 1837 additions and 253 deletions

View File

@ -1,4 +0,0 @@
Karan Misra <kidoman@gmail.com>
Kunal Powar <kunalpowar1203@gmail.com>
Nikesh Vora <nikesh.voratp@gmail.com>
Akhil Sahdev <akhilsahdev@thoughtworks.com>

View File

@ -3,7 +3,7 @@
This actually is really simple. A few simple guidelines and we can break for dinner:
* EMBD is designed with a lot of affection, with utmost importance given to the dev experience (read: the API feel and style.) So always think from that angle when creating the pull request
* [Documentation](https://godoc.org/github.com/kidoman/embd) helps drive adoption. No exceptions
* [Documentation](https://godoc.org/github.com/cfreeman/embd) helps drive adoption. No exceptions
When it comes to the code:
@ -23,7 +23,7 @@ When it comes to the code:
this is inspired by Dave Cheney's gpio library and his work on EPOLL
```
* Individual lines must be wrapped at the 70-char limit. Yeah, old school
* Individual lines must be wrapped at the 70-char limit. Yeah, old school
* No trailing '.'
And:

View File

@ -1,17 +0,0 @@
adeschamps <anthony.j.deschamps@gmail.com>
alsm <asm@rndm.io>
Al S-M <asm@rndm.io>
Ben Delarre <ben@delarre.net>
Ben Schwartz <benschw@gmail.com>
Gavin Cabbage <gavincabbage@gmail.com>
gotang <gotang@foxmail.com>
Kashyap Kopparam <kashyapkopparam@gmail.com>
Kunal Powar <kunalpowar1203@gmail.com>
Marco P. Monteiro <marco_monteiro@sv.comcast.com>
Matthew Dale <matthew@matthewrdale.com>
Nikesh Vora <nikesh.voratp@gmail.com>
SjB <steve@sagacity.ca>
Steve Beaulac <steve@beaulac.me>
Thorsten von Eicken <tve@rightscale.com>
wiless <wiless.bytes@gmail.com>
Wu Jiang <wu@morediff.info>

153
README.md
View File

@ -1,4 +1,4 @@
# 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 [![GoDoc](http://godoc.org/github.com/cfreeman/embd?status.png)](http://godoc.org/github.com/cfreeman/embd)
**embd** is a hardware abstraction layer (HAL) for embedded systems.
@ -18,11 +18,6 @@ What embd then adds is first a Golang library interface on top of the various Li
devices and then another layer of user-level drivers for specific sensors and controllers
that are connected to gpio pins or one of the buses.
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)
[Blog post introducing EMBD](http://kidoman.io/framework/embd.html)
## Getting Started
@ -37,8 +32,8 @@ package main
import (
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi" // This loads the RPi driver
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/rpi" // This loads the RPi driver
)
func main() {
@ -51,7 +46,7 @@ func main() {
Then install the EMBD package:
$ go get github.com/kidoman/embd
$ go get github.com/cfreeman/embd
Build the binary for linux/ARM:
@ -74,22 +69,57 @@ Then on the rPi run the program with ```sudo```*:
* 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
* 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)
see the [full version](https://github.com/cfreeman/embd/blob/master/samples/fullblinker.go)
## Getting Help
## Supported Platforms
Join the [slack channel](https://gophers.slack.com/archives/embd)
## Platforms Supported
* [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/)
* [NextThing C.H.I.P](https://www.nextthing.co/pages/chip)
* [BeagleBone Black](http://beagleboard.org/Products/BeagleBone%20Black)
* [Intel Edison](https://software.intel.com/en-us/iot/hardware/edison)
* [NextThing C.H.I.P](https://www.nextthing.co/pages/chip)
* [RaspberryPi 1 A+](http://www.raspberrypi.org/products/model-a-plus/)
* [RaspberryPi 1 B+](https://www.raspberrypi.org/products/model-b-plus/)
* [RaspberryPi 2](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/)
* [RaspberryPi 3](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/)
## Supported Protocols
* **Digital GPIO** [Documentation](http://godoc.org/github.com/cfreeman/embd#DigitalPin)
* **Analog GPIO** [Documentation](http://godoc.org/github.com/cfreeman/embd#AnalogPin)
* **PWM** [Documentation](http://godoc.org/github.com/cfreeman/embd#PWMPin)
* **I2C** [Documentation](http://godoc.org/github.com/cfreeman/embd#I2CBus)
* **LED** [Documentation](http://godoc.org/github.com/cfreeman/embd#LED)
* **SPI** [Documentation](http://godoc.org/github.com/cfreeman/embd#SPIBus)
## Supported Sensors
* **BH1750FVI** Luminosity sensor [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/bh1750fvi), [Datasheet](http://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf)
* **BME280** Pressure, Temperature and Humidity Sensor [Documentation](https://godoc.org/github.com/cfreeman/embd/sensor/bme280), [Datasheet](https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf)
* **BMP085** Barometric pressure sensor [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/bmp085), [Datasheet](https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf)
* **BMP180** Barometric pressure sensor [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/bmp180), [Datasheet](http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf)
* **L3GD20** Gyroscope [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/l3gd20), [Datasheet](http://www.adafruit.com/datasheets/L3GD20.pdf)
* **LSM303** Accelerometer and magnetometer [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/lsm303), [Datasheet](https://www.sparkfun.com/datasheets/Sensors/Magneto/LSM303%20Datasheet.pdf)
* **TMP006** Thermopile sensor [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/tmp006), [Datasheet](http://www.adafruit.com/datasheets/tmp006.pdf)
* **US020** Ultrasonic proximity sensor [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/us020), [Product Page](http://www.digibay.in/sensor/object-detection-and-proximity?product_id=239)
* **Watersensor** Based on LM393 (currently only provides digital support) [Documentation](http://godoc.org/github.com/cfreeman/embd/sensor/watersensor)[Datasheet](http://www.ti.com/lit/ds/symlink/lm393-n.pdf)
## Interfaces
* **Keypad(4x3)** [Product Page](http://www.adafruit.com/products/419#Learn)
## Controllers
* **PCA9685** 16-channel, 12-bit PWM Controller with I2C protocol [Documentation](http://godoc.org/github.com/cfreeman/embd/controller/pca9685), [Datasheet](http://www.adafruit.com/datasheets/PCA9685.pdf), [Product Page](http://www.adafruit.com/products/815)
* **MCP4725** 12-bit DAC [Documentation](http://godoc.org/github.com/cfreeman/embd/controller/mcp4725), [Datasheet](http://www.adafruit.com/datasheets/mcp4725.pdf), [Product Page](http://www.adafruit.com/products/935)
* **ServoBlaster** RPi PWM/PCM based PWM controller [Documentation](http://godoc.org/github.com/cfreeman/embd/controller/servoblaster), [Product Page](https://github.com/richardghirst/PiBits/tree/master/ServoBlaster)
## Convertors
* **MCP3008** 8-channel, 10-bit ADC with SPI protocol, [Datasheet](https://www.adafruit.com/datasheets/MCP3008.pdf)
## The command line tool
go get github.com/kidoman/embd/embd
go get github.com/cfreeman/embd/embd
will install a command line utility ```embd``` which will allow you to quickly get started with prototyping. The binary should be available in your ```$GOPATH/bin```. However, to be able to run this on a ARM based device, you will need to build it with ```GOOS=linux``` and ```GOARCH=arm``` environment variables set.
@ -107,14 +137,14 @@ Package **embd** provides a hardware abstraction layer for doing embedded progra
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](https://github.com/kidoman/embd/tree/master/samples) folder,
Although samples are all present in the [samples](https://github.com/cfreeman/embd/tree/master/samples) folder,
we will show a few choice examples here.
Use the **LED** driver to toggle LEDs on the BBB:
```go
import "github.com/kidoman/embd"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import _ "github.com/cfreeman/embd/host/all"
...
embd.InitLED()
defer embd.CloseLED()
@ -127,8 +157,8 @@ led.Toggle()
Even shorter when quickly trying things out:
```go
import "github.com/kidoman/embd"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import _ "github.com/cfreeman/embd/host/all"
...
embd.InitLED()
defer embd.CloseLED()
@ -141,8 +171,8 @@ embd.ToggleLED(3)
BBB + **PWM**:
```go
import "github.com/kidoman/embd"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import _ "github.com/cfreeman/embd/host/all"
...
embd.InitGPIO()
defer embd.CloseGPIO()
@ -156,8 +186,8 @@ pwm.SetDuty(1000)
Control **GPIO** pins on the RaspberryPi / BeagleBone Black:
```go
import "github.com/kidoman/embd"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import _ "github.com/cfreeman/embd/host/all"
...
embd.InitGPIO()
defer embd.CloseGPIO()
@ -169,8 +199,8 @@ embd.DigitalWrite(10, embd.High)
Could also do:
```go
import "github.com/kidoman/embd"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import _ "github.com/cfreeman/embd/host/all"
...
embd.InitGPIO()
defer embd.CloseGPIO()
@ -184,9 +214,9 @@ pin.Write(embd.High)
Or read data from the **Bosch BMP085** barometric sensor:
```go
import "github.com/kidoman/embd"
import "github.com/kidoman/embd/sensor/bmp085"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import "github.com/cfreeman/embd/sensor/bmp085"
import _ "github.com/cfreeman/embd/host/all"
...
bus := embd.NewI2CBus(1)
...
@ -199,9 +229,9 @@ altitude, err := baro.Altitude()
Even find out the heading from the **LSM303** magnetometer:
```go
import "github.com/kidoman/embd"
import "github.com/kidoman/embd/sensor/lsm303"
import _ "github.com/kidoman/embd/host/all"
import "github.com/cfreeman/embd"
import "github.com/cfreeman/embd/sensor/lsm303"
import _ "github.com/cfreeman/embd/host/all"
...
bus := embd.NewI2CBus(1)
...
@ -213,47 +243,22 @@ heading, err := mag.Heading()
The above two examples depend on **I2C** and therefore will work without change on almost all
platforms.
## Protocols Supported
* **Digital GPIO** [Documentation](http://godoc.org/github.com/kidoman/embd#DigitalPin)
* **Analog GPIO** [Documentation](http://godoc.org/github.com/kidoman/embd#AnalogPin)
* **PWM** [Documentation](http://godoc.org/github.com/kidoman/embd#PWMPin)
* **I2C** [Documentation](http://godoc.org/github.com/kidoman/embd#I2CBus)
* **LED** [Documentation](http://godoc.org/github.com/kidoman/embd#LED)
* **SPI** [Documentation](http://godoc.org/github.com/kidoman/embd#SPIBus)
## Sensors Supported
* **TMP006** Thermopile sensor [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/tmp006), [Datasheet](http://www.adafruit.com/datasheets/tmp006.pdf), [Userguide](http://www.adafruit.com/datasheets/tmp006ug.pdf)
* **BMP085** Barometric pressure sensor [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/bmp085), [Datasheet](https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf)
* **BMP180** Barometric pressure sensor [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/bmp180), [Datasheet](http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf)
* **LSM303** Accelerometer and magnetometer [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/lsm303), [Datasheet](https://www.sparkfun.com/datasheets/Sensors/Magneto/LSM303%20Datasheet.pdf)
* **L3GD20** Gyroscope [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/l3gd20), [Datasheet](http://www.adafruit.com/datasheets/L3GD20.pdf)
* **US020** Ultrasonic proximity sensor [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/us020), [Product Page](http://www.digibay.in/sensor/object-detection-and-proximity?product_id=239)
* **BH1750FVI** Luminosity sensor [Documentation](http://godoc.org/github.com/kidoman/embd/sensor/bh1750fvi), [Datasheet](http://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf)
## Interfaces
* **Keypad(4x3)** [Product Page](http://www.adafruit.com/products/419#Learn)
## Controllers
* **PCA9685** 16-channel, 12-bit PWM Controller with I2C protocol [Documentation](http://godoc.org/github.com/kidoman/embd/controller/pca9685), [Datasheet](http://www.adafruit.com/datasheets/PCA9685.pdf), [Product Page](http://www.adafruit.com/products/815)
* **MCP4725** 12-bit DAC [Documentation](http://godoc.org/github.com/kidoman/embd/controller/mcp4725), [Datasheet](http://www.adafruit.com/datasheets/mcp4725.pdf), [Product Page](http://www.adafruit.com/products/935)
* **ServoBlaster** RPi PWM/PCM based PWM controller [Documentation](http://godoc.org/github.com/kidoman/embd/controller/servoblaster), [Product Page](https://github.com/richardghirst/PiBits/tree/master/ServoBlaster)
## Convertors
* **MCP3008** 8-channel, 10-bit ADC with SPI protocol, [Datasheet](https://www.adafruit.com/datasheets/MCP3008.pdf)
## Contributing
[Pull requests](https://github.com/kidoman/embd/pulls) that follow the
[guidelines](https://github.com/kidoman/embd/blob/master/CONTRIBUTING.md) are very appreciated.
[Pull requests](https://github.com/cfreeman/embd/pulls) that follow the
[guidelines](https://github.com/cfreeman/embd/blob/master/CONTRIBUTING.md) are very appreciated.
If you find a problem but are not up to coding a fix please file an
[issue](https://github.com/kidoman/embd/issues).
[issue](https://github.com/cfreeman/embd/issues).
Thank you!
## About
## ROADMAP
EMBD is affectionately designed/developed by Karan Misra ([kidoman](https://github.com/kidoman)), Kunal Powar ([kunalpowar](https://github.com/kunalpowar)) and [FRIENDS](https://github.com/kidoman/embd/blob/master/AUTHORS). We also have a list of [CONTRIBUTORS](https://github.com/kidoman/embd/blob/master/CONTRIBUTORS).
* Continue to tidy up the README and other documentation.
* move utils.go into util package
* Make sure there are samples for all supported hardware. Better organise samples move into godoc?
* Rummage through the old, largely abandoned parent repo and pull in as many of the requests as possible.
* A fully featured cli tool (**embd**)
* Continue to add support for additional sensors/controllers/convertors.
* Continue to add support for additional hosts (Cubietruck, Radxa, etc).
* Supporting something other than Linux

View File

@ -1,14 +0,0 @@
# embd roadmap
The following features are planned (in no particular order):
* A fully featured cli tool (**embd**)
* Support for UART, SPI
* Support for a whole range of sensors/controllers
* Support for Intel Galileo (will require a few changes to Golang, but not unsurmountable)
* Support for a lot of other ARM prototyping boards (Cubietruck, Radxa, etc.)
* Awesome documentation
* A embd UI (similar to the Arduino IDE)
* Supporting something other than Linux
* Support for vision processing (OpenCV ?)
* Allow remote instrumentation of the host via network/web sockets/etc.

View File

@ -0,0 +1,85 @@
/*
* Copyright (c) Clinton Freeman 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package apa102
import (
"github.com/cfreeman/embd"
)
const (
MAX_BRIGHTNESS = 31
)
type APA102 struct {
Bus embd.SPIBus
LED []uint8
nLED int
}
func New(bus embd.SPIBus, numLEDs int) *APA102 {
res := &APA102{
Bus: bus,
LED: make([]uint8, numLEDs*4),
nLED: numLEDs,
}
// Init the intensity field for each LED which is
// 0b111 + 5 intensity bits.
for i := 0; i < (numLEDs * 4); i = i + 4 {
res.LED[i] = 224
}
return res
}
func (a *APA102) SetLED(index int, r uint8, g uint8, b uint8, i uint8) error {
intensity := i
if i > 31 {
intensity = 31
}
ind := index * 4
a.LED[ind+0] = 224 + intensity // Brightness is 0b111 + 5 intensity bits
a.LED[ind+1] = b
a.LED[ind+2] = g
a.LED[ind+3] = r
return a.Show()
}
func (a *APA102) Show() error {
// Start frame is 32 zero bits.
err := a.Bus.TransferAndReceiveData([]uint8{0, 0, 0, 0})
// LED data.
// 111+5bits(intensity) + 1byte(Red) + 1byte(Green) + 1byte(Blue)
err = a.Bus.TransferAndReceiveData(a.LED)
if err != nil {
return err
}
err = a.Bus.TransferAndReceiveData([]uint8{1, 1, 1, 1})
if err != nil {
return err
}
return nil
}

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Matthew Dale 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
Package hd44780 allows controlling an HD44780-compatible character LCD
controller. Currently the library is write-only and does not support
@ -15,8 +34,8 @@ package hd44780
import (
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
type entryMode byte

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Matthew Dale 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package hd44780
import (
@ -6,7 +25,7 @@ import (
"testing"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
const (

View File

@ -1,11 +1,30 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package mcp4725 allows interfacing with the MCP4725 DAC.
package mcp4725
import (
"sync"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Kunal Powar 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package pca9685 allows interfacing with the pca9685 16-channel, 12-bit PWM Controller through I2C protocol.
package pca9685
@ -6,9 +25,9 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/util"
"github.com/golang/glog"
"github.com/kidoman/embd"
"github.com/kidoman/embd/util"
)
const (

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) Clinton Freeman 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package pcal9535a adds support for the low volage GPIO expander as found in the Raspberry
// Pi Relay board by Seeed Studio.
package pcal9535a
import (
"github.com/cfreeman/embd"
)
// More details at - http://wiki.seeedstudio.com/wiki/Raspberry_Pi_Relay_Board_v1.0
const (
REG_MODE = 0x06
)
type PCAL9535A struct {
Bus embd.I2CBus
Addr byte
D byte
}
// New creates and connects to a PCAL9535A GPIO expander.
func New(bus embd.I2CBus, addr byte) (*PCAL9535A, error) {
return &PCAL9535A{
Bus: bus,
Addr: addr,
D: 0xff,
}, bus.WriteByteToReg(addr, REG_MODE, 0xff)
}
// Sets the nominated GPIO pin to either high (on = true) or low (on = false)
func (c *PCAL9535A) SetPin(pin uint, on bool) error {
if on {
c.D &= ^(byte(0x1) << pin)
} else {
c.D |= (byte(0x1) << pin)
}
return c.Bus.WriteByteToReg(c.Addr, REG_MODE, c.D)
}
// Gets the state of supplied pin true = high or on, while false = low or off.
func (c *PCAL9535A) GetPin(pin uint) bool {
return (((c.D >> pin) & 1) == 0)
}

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package servoblaster allows interfacing with the software servoblaster driver.
//
// More details on ServoBlaster at: https://github.com/richardghirst/PiBits/tree/master/ServoBlaster

View File

@ -1,9 +1,28 @@
/*
* Copyright (c) Kunal Powar 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package mcp3008 allows interfacing with the mcp3008 8-channel, 10-bit ADC through SPI protocol.
package mcp3008
import (
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
// MCP3008 represents a mcp3008 8bit DAC.

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Host descriptor data structures.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Host detection.
package embd
@ -26,6 +45,9 @@ const (
// HostGalileo represents the Intel Galileo board.
HostGalileo = "Intel Galileo"
// HostEdison represents teh Intel Edison board.
HostEdison = "Intel Edison"
// HostCubieTruck represents the Cubie Truck.
HostCubieTruck = "CubieTruck"
@ -126,6 +148,8 @@ func DetectHost() (host Host, rev int, err error) {
return HostBBB, rev, nil
case strings.Contains(hardware, "BCM2708") || strings.Contains(hardware, "BCM2709") || strings.Contains(hardware, "BCM2835"):
return HostRPi, rev, nil
case strings.Contains(model, "Genuine Intel(R) CPU 4000 @ 500MHz"):
return HostEdison, rev, nil
case hardware == "Allwinner sun4i/sun5i Families":
if major < 4 || (major == 4 && minor < 4) {
return HostNull, 0, fmt.Errorf(
@ -134,6 +158,6 @@ func DetectHost() (host Host, rev int, err error) {
}
return HostCHIP, rev, nil
default:
return HostNull, 0, fmt.Errorf(`embd: your host "%v:%v" is not supported at this moment. request support at https://github.com/kidoman/embd/issues`, host, model)
return HostNull, 0, fmt.Errorf(`embd: your host "%v:%v" is not supported at this moment. request support at https://github.com/cfreeman/embd/issues`, host, model)
}
}

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package embd
import "testing"

20
doc.go
View File

@ -22,7 +22,7 @@ called as 1-liners instead of first instantiating a DigitalPin and then writing
To get started a host driver needs to be registered with the top-level embd package. This is
most easily accomplished by doing an "underscore import" on of the sub-packages of embd/host,
e.g., `import _ "github.com/kidoman/embd/host/chip"`. An `Init()` function in the host driver
e.g., `import _ "github.com/cfreeman/embd/host/chip"`. An `Init()` function in the host driver
registers all the individual drivers with embd.
After getting the host driver the next step might be to instantiate a GPIO pin using
@ -38,7 +38,7 @@ This section shows a few choice samples, more are available in the samples folde
Use the LED driver to toggle LEDs on the BBB:
import "github.com/kidoman/embd"
import "github.com/cfreeman/embd"
...
embd.InitLED()
defer embd.CloseLED()
@ -49,7 +49,7 @@ Use the LED driver to toggle LEDs on the BBB:
Even shorter while prototyping:
import "github.com/kidoman/embd"
import "github.com/cfreeman/embd"
...
embd.InitLED()
defer embd.CloseLED()
@ -58,7 +58,7 @@ Even shorter while prototyping:
BBB + PWM:
import "github.com/kidoman/embd"
import "github.com/cfreeman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
@ -70,7 +70,7 @@ BBB + PWM:
Control GPIO pins on the RaspberryPi / BeagleBone Black:
import "github.com/kidoman/embd"
import "github.com/cfreeman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
@ -80,7 +80,7 @@ Control GPIO pins on the RaspberryPi / BeagleBone Black:
Could also do:
import "github.com/kidoman/embd"
import "github.com/cfreeman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
@ -92,8 +92,8 @@ Could also do:
Or read data from the Bosch BMP085 barometric sensor:
import "github.com/kidoman/embd"
import "github.com/kidoman/embd/sensor/bmp085"
import "github.com/cfreeman/embd"
import "github.com/cfreeman/embd/sensor/bmp085"
...
bus := embd.NewI2CBus(1)
...
@ -104,8 +104,8 @@ Or read data from the Bosch BMP085 barometric sensor:
Even find out the heading from the LSM303 magnetometer:
import "github.com/kidoman/embd"
import "github.com/kidoman/embd/sensor/lsm303"
import "github.com/cfreeman/embd"
import "github.com/cfreeman/embd/sensor/lsm303"
...
bus := embd.NewI2CBus(1)
...

View File

@ -1,11 +1,30 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package main
import (
"fmt"
"os"
"github.com/cfreeman/embd"
"github.com/codegangsta/cli"
"github.com/kidoman/embd"
)
func detect(c *cli.Context) {

View File

@ -1,10 +1,29 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package main
import (
"os"
_ "github.com/cfreeman/embd/host/all"
"github.com/codegangsta/cli"
_ "github.com/kidoman/embd/host/all"
)
var version = "0.1.0"

19
gpio.go
View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// GPIO support.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Generic GPIO driver.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package embd
import (

View File

@ -1,7 +1,27 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package all conviniently loads all the inbuilt/supported host drivers.
package all
import (
_ "github.com/kidoman/embd/host/bbb"
_ "github.com/kidoman/embd/host/rpi"
_ "github.com/cfreeman/embd/host/bbb"
_ "github.com/cfreeman/embd/host/edison"
_ "github.com/cfreeman/embd/host/rpi"
)

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Analog I/O support on the BBB.
package bbb
@ -9,7 +28,7 @@ import (
"strconv"
"strings"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
type analogPin struct {

View File

@ -1,9 +1,28 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package bbb
import (
"testing"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
func TestAnalogPinClose(t *testing.T) {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
Package bbb provides BeagleBone Black support.
The following features are supported on Linux kernel 3.8+
@ -15,9 +34,9 @@ import (
"os"
"strings"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/host/generic"
"github.com/golang/glog"
"github.com/kidoman/embd"
"github.com/kidoman/embd/host/generic"
)
var pins = embd.PinMap{

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// PWM support on the BBB.
package bbb
@ -10,9 +29,9 @@ import (
"strconv"
"time"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/util"
"github.com/golang/glog"
"github.com/kidoman/embd"
"github.com/kidoman/embd/util"
)
const (

View File

@ -1,9 +1,28 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package bbb
import (
"testing"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
func TestPWMPinClose(t *testing.T) {

View File

@ -1,7 +1,7 @@
# 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,
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
@ -13,8 +13,8 @@ A simple demo to blink an LED connected with a small resistor between XIO-P6 and
package main
import (
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/chip"
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/chip"
)
func main() {

View File

@ -1,4 +1,21 @@
// Copyright 2016 by Thorsten von Eicken, see LICENSE file
/*
* Copyright (c) Thorsten von Eicken 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package chip provides NextThing C.H.I.P. support.
// References:
@ -14,8 +31,8 @@
package chip
import (
"github.com/kidoman/embd"
"github.com/kidoman/embd/host/generic"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/host/generic"
)
var spiDeviceMinor = 32766

68
host/edison/edison.go Normal file
View File

@ -0,0 +1,68 @@
/*
* Copyright (c) Clinton Freeman 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package edison Provides Intel Edison support.
package edison
import (
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/host/generic"
)
var pins = embd.PinMap{
&embd.PinDesc{ID: "P1_12", Aliases: []string{"12", "GPIO_12"}, Caps: embd.CapDigital, DigitalLogical: 12}, // PWM?
&embd.PinDesc{ID: "P1_13", Aliases: []string{"13", "GPIO_13"}, Caps: embd.CapDigital, DigitalLogical: 13}, // PWM?
&embd.PinDesc{ID: "P1_14", Aliases: []string{"14", "GPIO_14"}, Caps: embd.CapDigital, DigitalLogical: 14},
&embd.PinDesc{ID: "P1_15", Aliases: []string{"15", "GPIO_15"}, Caps: embd.CapDigital, DigitalLogical: 15},
&embd.PinDesc{ID: "P1_44", Aliases: []string{"44", "GPIO_44"}, Caps: embd.CapDigital, DigitalLogical: 44},
&embd.PinDesc{ID: "P1_45", Aliases: []string{"45", "GPIO_45"}, Caps: embd.CapDigital, DigitalLogical: 45},
&embd.PinDesc{ID: "P1_46", Aliases: []string{"46", "GPIO_46"}, Caps: embd.CapDigital, DigitalLogical: 46},
&embd.PinDesc{ID: "P1_47", Aliases: []string{"47", "GPIO_47"}, Caps: embd.CapDigital, DigitalLogical: 47},
&embd.PinDesc{ID: "P1_48", Aliases: []string{"48", "GPIO_48"}, Caps: embd.CapDigital, DigitalLogical: 48},
&embd.PinDesc{ID: "P1_49", Aliases: []string{"49", "GPIO_49"}, Caps: embd.CapDigital, DigitalLogical: 49},
&embd.PinDesc{ID: "P1_128", Aliases: []string{"128", "GPIO_128"}, Caps: embd.CapDigital, DigitalLogical: 128}, //CTS?
&embd.PinDesc{ID: "P1_129", Aliases: []string{"129", "GPIO_129"}, Caps: embd.CapDigital, DigitalLogical: 129}, //RTS?
&embd.PinDesc{ID: "P1_130", Aliases: []string{"130", "GPIO_130", "RXD", "UART0_RXD"}, Caps: embd.CapDigital | embd.CapUART, DigitalLogical: 130},
&embd.PinDesc{ID: "P1_131", Aliases: []string{"131", "GPIO_131", "TXD", "UART0_TXD"}, Caps: embd.CapDigital | embd.CapUART, DigitalLogical: 131},
&embd.PinDesc{ID: "P1_182", Aliases: []string{"182", "GPIO_182"}, Caps: embd.CapDigital, DigitalLogical: 182}, // PWM?
&embd.PinDesc{ID: "P1_183", Aliases: []string{"183", "GPIO_183"}, Caps: embd.CapDigital, DigitalLogical: 183}, // PWM?
}
var ledMap = embd.LEDMap{}
var spiDeviceMinor = 0 // Check??
func init() {
embd.Register(embd.HostEdison, func(rev int) *embd.Descriptor {
return &embd.Descriptor{
GPIODriver: func() embd.GPIODriver {
return embd.NewGPIODriver(pins, generic.NewDigitalPin, nil, nil)
},
I2CDriver: func() embd.I2CDriver {
return embd.NewI2CDriver(generic.NewI2CBus)
},
LEDDriver: func() embd.LEDDriver {
return embd.NewLEDDriver(ledMap, generic.NewLED)
},
SPIDriver: func() embd.SPIDriver {
return embd.NewSPIDriver(spiDeviceMinor, generic.NewSPIBus, nil)
},
}
})
}

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Digital IO support.
// This driver requires kernel version 3.8+ and should work uniformly
// across all supported devices.
@ -13,7 +32,7 @@ import (
"syscall"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
type digitalPin struct {

View File

@ -1,9 +1,28 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package generic
import (
"testing"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
func TestDigitalPinClose(t *testing.T) {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// I²C support.
package generic
@ -11,8 +30,8 @@ import (
"time"
"unsafe"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Generic Interrupt Pins.
package generic
@ -8,7 +27,7 @@ import (
"sync"
"syscall"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// LED control support.
package generic
@ -8,7 +27,7 @@ import (
"os"
"strings"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
type led struct {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package generic
import (
@ -7,8 +26,8 @@ import (
"syscall"
"unsafe"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
Package rpi provides Raspberry Pi (including A+/B+) support.
The following features are supported on Linux kernel 3.8+
@ -9,8 +28,8 @@
package rpi
import (
"github.com/kidoman/embd"
"github.com/kidoman/embd/host/generic"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/host/generic"
)
var spiDeviceMinor = 0

19
i2c.go
View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// I2C support.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Generic I²C driver.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Matthew Dale 2015
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
Package characterdisplay provides an ease-of-use layer on top of a character
display controller.

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Matthew Dale 2015
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package characterdisplay
import (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Kunal Powar 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package matrix4x3 allows interfacing 4x3 keypad with Raspberry pi.
package matrix4x3
@ -6,7 +25,7 @@ import (
"sync"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
type Key int

19
led.go
View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// LED support.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Generic LED driver.
package embd

View File

@ -1,9 +1,28 @@
/*
* Copyright (c) Kunal Powar 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package servo allows control of servos using a PWM controller.
package servo
import (
"github.com/cfreeman/embd/util"
"github.com/golang/glog"
"github.com/kidoman/embd/util"
)
const (

19
pin.go
View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Pin mapping support.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package embd
import "testing"

View File

@ -18,8 +18,8 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi"
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/rpi"
)
func main() {

View File

@ -9,9 +9,9 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,9 +6,9 @@ import (
"flag"
"fmt"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

45
samples/apa102.go Normal file
View File

@ -0,0 +1,45 @@
/*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// +build ignore
package main
import (
"fmt"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/controller/apa102"
_ "github.com/cfreeman/embd/host/all"
)
func main() {
if err := embd.InitSPI(); err != nil {
panic(err)
}
defer embd.CloseSPI()
spiBus := embd.NewSPIBus(embd.SPIMode0, 0, 8000000, 8, 0)
defer spiBus.Close()
strip := apa102.New(spiBus, 5)
err := strip.SetLED(0, 255, 0, 0, 31)
if err != nil {
fmt.Printf("ERROR Unable to set LED.")
fmt.Printf("%s", err)
}
}

View File

@ -7,10 +7,10 @@ import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/bh1750fvi"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/bh1750fvi"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -7,10 +7,10 @@ import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/bmp085"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/bmp085"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -7,10 +7,10 @@ import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/bmp180"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/bmp180"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,11 +6,11 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/controller/hd44780"
"github.com/kidoman/embd/interface/display/characterdisplay"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/controller/hd44780"
"github.com/cfreeman/embd/interface/display/characterdisplay"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -11,8 +11,8 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi"
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/rpi"
)
func main() {

View File

@ -6,9 +6,9 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,9 +6,9 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,9 +6,9 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,9 +6,9 @@ import (
"flag"
"fmt"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -5,9 +5,9 @@ package main
import (
"flag"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,10 +6,10 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/controller/hd44780"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/controller/hd44780"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -5,8 +5,8 @@ package main
import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/interface/keypad/matrix4x3"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/interface/keypad/matrix4x3"
)
func main() {

View File

@ -9,10 +9,10 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/l3gd20"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/l3gd20"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -11,9 +11,9 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/bbb"
_ "github.com/cfreeman/embd/host/bbb"
)
func main() {

View File

@ -8,9 +8,9 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
_ "github.com/kidoman/embd/host/bbb"
_ "github.com/cfreeman/embd/host/bbb"
)
func main() {

View File

@ -7,10 +7,10 @@ import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/lsm303"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/lsm303"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,9 +8,9 @@ import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/convertors/mcp3008"
_ "github.com/kidoman/embd/host/all"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/convertors/mcp3008"
_ "github.com/cfreeman/embd/host/all"
)
const (

View File

@ -9,10 +9,10 @@ import (
"os"
"os/signal"
"github.com/kidoman/embd"
"github.com/kidoman/embd/controller/mcp4725"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/controller/mcp4725"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,10 +8,10 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/controller/pca9685"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/controller/pca9685"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,10 +8,10 @@ import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/host/bbb"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/host/bbb"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,11 +8,11 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/controller/pca9685"
"github.com/kidoman/embd/motion/servo"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/controller/pca9685"
"github.com/cfreeman/embd/motion/servo"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,10 +8,10 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/motion/servo"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/motion/servo"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,10 +8,10 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd/controller/servoblaster"
"github.com/kidoman/embd/motion/servo"
"github.com/cfreeman/embd/controller/servoblaster"
"github.com/cfreeman/embd/motion/servo"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -8,8 +8,8 @@ package main
import (
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi" // This loads the RPi driver
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/rpi" // This loads the RPi driver
)
func main() {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// +build ignore
package main
@ -5,8 +24,8 @@ package main
import (
"fmt"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/all"
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -7,8 +7,8 @@ import (
"fmt"
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/all"
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/all"
)
const (

View File

@ -8,10 +8,10 @@ import (
"os"
"os/signal"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/tmp006"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/tmp006"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -10,8 +10,8 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/all"
"github.com/cfreeman/embd"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -9,10 +9,10 @@ import (
"os/signal"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/us020"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/us020"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -6,11 +6,11 @@ import (
"flag"
"time"
"github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/watersensor"
"github.com/golang/glog"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/watersensor"
_ "github.com/kidoman/embd/host/all"
_ "github.com/cfreeman/embd/host/all"
)
func main() {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2013
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package BH1750FVI allows interfacing with the BH1750FVI ambient light sensor through I2C.
package bh1750fvi
@ -5,7 +24,7 @@ import (
"sync"
"time"
"github.com/kidoman/embd"
"github.com/cfreeman/embd"
)
//accuracy = sensorValue/actualValue] (min = 0.96, typ = 1.2, max = 1.44

387
sensor/bme280/bme280.go Normal file
View File

@ -0,0 +1,387 @@
/*
* Copyright (c) Clinton Freeman 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package bme280 allows interfacing with Bosch BME280 digital humidity, pressure
// and temperature sensor.
package bme280
import (
"github.com/cfreeman/embd"
)
const (
CAL_T1_LSB_REG = 0x88
CAL_T1_MSB_REG = 0x89
CAL_T2_LSB_REG = 0x8A
CAL_T2_MSB_REG = 0x8B
CAL_T3_LSB_REG = 0x8C
CAL_T3_MSB_REG = 0x8D
CAL_P1_LSB_REG = 0x8E
CAL_P1_MSB_REG = 0x8F
CAL_P2_LSB_REG = 0x90
CAL_P2_MSB_REG = 0x91
CAL_P3_LSB_REG = 0x92
CAL_P3_MSB_REG = 0x93
CAL_P4_LSB_REG = 0x94
CAL_P4_MSB_REG = 0x95
CAL_P5_LSB_REG = 0x96
CAL_P5_MSB_REG = 0x97
CAL_P6_LSB_REG = 0x98
CAL_P6_MSB_REG = 0x99
CAL_P7_LSB_REG = 0x9A
CAL_P7_MSB_REG = 0x9B
CAL_P8_LSB_REG = 0x9C
CAL_P8_MSB_REG = 0x9D
CAL_P9_LSB_REG = 0x9E
CAL_P9_MSB_REG = 0x9F
CAL_H1_REG = 0xA1
CAL_H2_LSB_REG = 0xE1
CAL_H2_MSB_REG = 0xE2
CAL_H3_REG = 0xE3
CAL_H4_MSB_REG = 0xE4
CAL_H4_LSB_REG = 0xE5
CAL_H5_MSB_REG = 0xE6
CAL_H6_REG = 0xE7
MEASUREMENT_START_REG = 0xF7
PRESSURE_MSB_IDX = 0
PRESSURE_LSB_IDX = 1
PRESSURE_XLSB_IDX = 2
TMP_MSB_IDX = 3
TMP_LSB_IDX = 4
TMP_XLSB_IDX = 5
HUMIDITY_MSB_IDX = 6
HUMIDITY_LSB_IDX = 7
CTRL_MEAS_REG = 0xF4
CONFIG_REG = 0xF5
CTRL_HUMIDITY_REG = 0xF2
RESET_REG = 0xE0
//RunMode can be:
// 0, Sleep mode
// 1 or 2, Forced mode
// 3, Normal mode
RunMode = uint8(3)
//Standby can be:
// 0, 0.5ms
// 1, 62.5ms
// 2, 125ms
// 3, 250ms
// 4, 500ms
// 5, 1000ms
// 6, 10ms
// 7, 20ms
Standby = uint8(0)
//Filter can be off or number of FIR coefficients to use:
// 0, filter off
// 1, coefficients = 2
// 2, coefficients = 4
// 3, coefficients = 8
// 4, coefficients = 16
Filter = uint8(0)
//TempOverSample can be:
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectivel
TempOverSample = uint8(1)
//PressOverSample can be:
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
PressOverSample = uint8(1)
//HumidOverSample can be:
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
HumidOverSample = uint8(1)
)
type Calibration struct {
T1 uint16
T2, T3 int16
P1, P2, P3, P4, P5, P6, P7, P8, P9 int64
H1, H2, H3, H4, H5, H6 float64
}
type BME280 struct {
Bus embd.I2CBus
Addr byte
Cal Calibration
}
func readUInt16(lsb byte, msb byte, bus embd.I2CBus, addr byte) (uint16, error) {
lsbv, err := bus.ReadByteFromReg(addr, lsb)
if err != nil {
return 0, err
}
msbv, err := bus.ReadByteFromReg(addr, msb)
if err != nil {
return 0, err
}
return (uint16(msbv) << 8) | uint16(lsbv), nil
}
func readInt16(lsb byte, msb byte, bus embd.I2CBus, addr byte) (int16, error) {
lsbv, err := bus.ReadByteFromReg(addr, lsb)
if err != nil {
return 0, err
}
msbv, err := bus.ReadByteFromReg(addr, msb)
if err != nil {
return 0, err
}
return (int16(msbv) << 8) | int16(lsbv), nil
}
// New creates and calibrates a connection to a BME280 sensor on the supplied i2c bus
// at the nominated i2c address.
func New(bus embd.I2CBus, addr byte) (*BME280, error) {
s := &BME280{
Bus: bus,
Addr: addr,
}
var err error
var msb, lsb byte
// Get calibrate information.
s.Cal.T1, err = readUInt16(CAL_T1_LSB_REG, CAL_T1_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.T2, err = readInt16(CAL_T2_LSB_REG, CAL_T2_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.T3, err = readInt16(CAL_T3_LSB_REG, CAL_T3_MSB_REG, bus, addr)
if err != nil {
return s, err
}
pu, err := readUInt16(CAL_P1_LSB_REG, CAL_P1_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P1 = int64(pu)
p, err := readInt16(CAL_P2_LSB_REG, CAL_P2_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P2 = int64(p)
p, err = readInt16(CAL_P3_LSB_REG, CAL_P3_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P3 = int64(p)
p, err = readInt16(CAL_P4_LSB_REG, CAL_P4_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P4 = int64(p)
p, err = readInt16(CAL_P5_LSB_REG, CAL_P5_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P5 = int64(p)
p, err = readInt16(CAL_P6_LSB_REG, CAL_P6_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P6 = int64(p)
p, err = readInt16(CAL_P7_LSB_REG, CAL_P7_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P7 = int64(p)
p, err = readInt16(CAL_P8_LSB_REG, CAL_P8_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P8 = int64(p)
p, err = readInt16(CAL_P9_LSB_REG, CAL_P9_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.P9 = int64(p)
msb, err = bus.ReadByteFromReg(addr, CAL_H1_REG)
if err != nil {
return s, err
}
s.Cal.H1 = float64(msb)
h2, err := readInt16(CAL_H2_LSB_REG, CAL_H2_MSB_REG, bus, addr)
if err != nil {
return s, err
}
s.Cal.H2 = float64(h2)
msb, err = bus.ReadByteFromReg(addr, CAL_H3_REG)
if err != nil {
return s, err
}
s.Cal.H3 = float64(msb)
// H4 and H5 share three registers.
msb, err = bus.ReadByteFromReg(addr, CAL_H4_MSB_REG)
if err != nil {
return s, err
}
lsb, err = bus.ReadByteFromReg(addr, CAL_H4_LSB_REG)
if err != nil {
return s, err
}
s.Cal.H4 = float64((int16(msb) << 4) | int16(lsb)&0x0F)
msb, err = bus.ReadByteFromReg(addr, CAL_H5_MSB_REG)
if err != nil {
return s, err
}
lsb, err = bus.ReadByteFromReg(addr, CAL_H4_LSB_REG)
if err != nil {
return s, err
}
s.Cal.H5 = float64((int16(msb) << 4) | (int16(lsb)>>4)&0x0F)
msb, err = bus.ReadByteFromReg(addr, CAL_H6_REG)
if err != nil {
return s, err
}
s.Cal.H6 = float64(msb)
// Put the sensor in sleep mode and configure.
err = bus.WriteByteToReg(addr, CTRL_MEAS_REG, 0x00)
if err != nil {
return s, err
}
// Set the config word.
dataToWrite := (Standby << 0x5) & 0xE0
dataToWrite = dataToWrite | ((Filter << 0x02) & 0x1C)
err = bus.WriteByteToReg(addr, CONFIG_REG, dataToWrite)
if err != nil {
return s, err
}
dataToWrite = HumidOverSample & 0x07
err = bus.WriteByteToReg(addr, CTRL_HUMIDITY_REG, dataToWrite)
if err != nil {
return s, err
}
dataToWrite = (TempOverSample << 0x5) & 0xE0
dataToWrite = dataToWrite | ((PressOverSample << 0x02) & 0x1C)
dataToWrite = dataToWrite | (RunMode & 0x03)
err = bus.WriteByteToReg(addr, CTRL_MEAS_REG, dataToWrite)
if err != nil {
return s, err
}
_, err = bus.ReadByteFromReg(s.Addr, 0xD0)
return s, err
}
func (s *BME280) fineT(d []byte) int32 {
adcT := int32((uint32(d[TMP_MSB_IDX])<<12)|(uint32(d[TMP_LSB_IDX])<<4)) | ((int32(d[TMP_XLSB_IDX]) >> 4) & 0x0F)
var1 := (((adcT >> 3) - (int32(s.Cal.T1) << 1)) * (int32(s.Cal.T2))) >> 11
var2 := (((((adcT >> 4) - (int32(s.Cal.T1))) * ((adcT >> 4) - (int32(s.Cal.T1)))) >> 12) * (int32(s.Cal.T3))) >> 14
return (var1 + var2)
}
// Reads all measurements from the sensor. Call Humidity, Pressure or Temperature to retrieve calibrated readings.
func (s *BME280) Measurements() ([]byte, error) {
buf := make([]byte, 8)
err := s.Bus.ReadFromReg(s.Addr, MEASUREMENT_START_REG, buf)
return buf, err
}
// Humdity returns the relative humidity from the supplied measurements. Output value of "46.332" represents 46.332 %rH.
func (s *BME280) Humidity(d []byte) float64 {
fineT := s.fineT(d)
adcH := (uint16(d[HUMIDITY_MSB_IDX]) << 8) | uint16(d[HUMIDITY_LSB_IDX])
varH := float64(fineT) - 76800.0
varH = (float64(adcH) - (s.Cal.H4*64.0 + s.Cal.H5/16384.0*varH)) *
(s.Cal.H2 / 65536.0 * (1.0 + s.Cal.H6/67108864.0*varH*(1.0+s.Cal.H3/67108864*varH)))
varH = varH * (1.0 - s.Cal.H1*varH/524288.0)
if varH > 100.0 {
varH = 100.0
} else if varH < 0.0 {
varH = 0.0
}
return varH
}
// Returns the pressure in Pascals from the supplied measurements. A value of "96386.2" equals 963.862 hPa.
func (s *BME280) Pressure(d []byte) float64 {
fineT := s.fineT(d)
adcP := int32((uint32(d[PRESSURE_MSB_IDX])<<12)|
(uint32(d[PRESSURE_LSB_IDX])<<4)) |
((int32(d[PRESSURE_XLSB_IDX]) >> 4) & 0x0F)
var1 := int64(fineT) - 128000
var2 := var1 * var1 * s.Cal.P6
var2 = var2 + (var1 * s.Cal.P5 << 17)
var2 = var2 + (s.Cal.P4 << 35)
var1 = (var1 * var1 * s.Cal.P3 >> 8) + (var1 * s.Cal.P2 << 12)
var1 = ((int64(1) << 47) + var1) * s.Cal.P1 >> 33
if var1 == 0 {
return 0 // avoid exception caused by division by zero
}
p_acc := 1048576 - int64(adcP)
p_acc = (((p_acc << 31) - var2) * 3125) / var1
var1 = (s.Cal.P9 * (p_acc >> 13) * (p_acc >> 13)) >> 25
var2 = (s.Cal.P8 * p_acc) >> 19
p_acc = ((p_acc + var1 + var2) >> 8) + (s.Cal.P7 << 4)
p_acc = p_acc >> 8 // /256
return float64(p_acc)
}
// Temperature returns the temperature in Degrees Celcius from the supplied measurements. Output value of "30.33" equals 30.33°C.
func (s *BME280) Temperature(d []byte) float64 {
fineT := s.fineT(d)
return (float64(fineT) / 5120.0)
}

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2013
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package bmp085 allows interfacing with Bosch BMP085 barometric pressure sensor. This sensor
// has the ability to provided compensated temperature and pressure readings.
package bmp085
@ -7,8 +26,8 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package bmp180 allows interfacing with Bosch BMP180 barometric pressure sensor. This sensor
// has the ability to provided compensated temperature and pressure readings.
package bmp180
@ -7,8 +26,8 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package l3gd20 allows interacting with L3GD20 gyroscoping sensor.
package l3gd20
@ -7,8 +26,8 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2013
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package lsm303 allows interfacing with the LSM303 magnetometer.
package lsm303
@ -6,8 +25,8 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package tmp006 allows interfacing with the TMP006 thermopile.
package tmp006
@ -8,8 +27,8 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Nikesh Vora 2013
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package us020 allows interfacing with the US020 ultrasonic range finder.
package us020
@ -5,8 +24,8 @@ import (
"sync"
"time"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
const (

View File

@ -1,11 +1,30 @@
/*
* Copyright (c) Kashyap Kopparam 2013
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Package watersensor allows interfacing with the water sensor.
package watersensor
import (
"sync"
"github.com/cfreeman/embd"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
// WaterSensor represents a water sensor.

19
spi.go
View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Kunal Powar 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// SPI support.
package embd

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Kunal Powar 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package embd
import "sync"

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
git log --all --format='%cN <%cE>' | sort -u | grep -v karan.misra@gmail.com |\
grep -v noreply@ | cat CONTRIBUTORS - | sort | uniq > CONTRIBUTORS.new
mv CONTRIBUTORS.new CONTRIBUTORS

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package util
import "testing"

View File

@ -1,3 +1,21 @@
/*
* Copyright (c) Karan Misra 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package embd
import "path/filepath"