mirror of https://github.com/kidoman/embd
Merge b79c284fea
into bfcd1345fe
This commit is contained in:
commit
e0276dc501
|
@ -16,7 +16,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
type entryMode byte
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/util"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -3,7 +3,7 @@ package mcp3008
|
|||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
// MCP3008 represents a mcp3008 8bit DAC.
|
||||
|
|
|
@ -122,6 +122,6 @@ func DetectHost() (host Host, rev int, err error) {
|
|||
case strings.Contains(hardware, "BCM2708") || strings.Contains(hardware, "BCM2709"):
|
||||
return HostRPi, 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/wujiang/embd/issues`, host, model)
|
||||
}
|
||||
}
|
||||
|
|
18
doc.go
18
doc.go
|
@ -7,7 +7,7 @@
|
|||
|
||||
Use the LED driver to toggle LEDs on the BBB:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/wujiang/embd"
|
||||
...
|
||||
embd.InitLED()
|
||||
defer embd.CloseLED()
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
Even shorter while prototyping:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/wujiang/embd"
|
||||
...
|
||||
embd.InitLED()
|
||||
defer embd.CloseLED()
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
BBB + PWM:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/wujiang/embd"
|
||||
...
|
||||
embd.InitGPIO()
|
||||
defer embd.CloseGPIO()
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
Control GPIO pins on the RaspberryPi / BeagleBone Black:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/wujiang/embd"
|
||||
...
|
||||
embd.InitGPIO()
|
||||
defer embd.CloseGPIO()
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
Could also do:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/wujiang/embd"
|
||||
...
|
||||
embd.InitGPIO()
|
||||
defer embd.CloseGPIO()
|
||||
|
@ -61,8 +61,8 @@
|
|||
|
||||
Or read data from the Bosch BMP085 barometric sensor:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/kidoman/embd/sensor/bmp085"
|
||||
import "github.com/wujiang/embd"
|
||||
import "github.com/wujiang/embd/sensor/bmp085"
|
||||
...
|
||||
bus := embd.NewI2CBus(1)
|
||||
...
|
||||
|
@ -73,8 +73,8 @@
|
|||
|
||||
Even find out the heading from the LSM303 magnetometer:
|
||||
|
||||
import "github.com/kidoman/embd"
|
||||
import "github.com/kidoman/embd/sensor/lsm303"
|
||||
import "github.com/wujiang/embd"
|
||||
import "github.com/wujiang/embd/sensor/lsm303"
|
||||
...
|
||||
bus := embd.NewI2CBus(1)
|
||||
...
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
func detect(c *cli.Context) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
var version = "0.1.0"
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
package all
|
||||
|
||||
import (
|
||||
_ "github.com/kidoman/embd/host/bbb"
|
||||
_ "github.com/kidoman/embd/host/rpi"
|
||||
_ "github.com/wujiang/embd/host/bbb"
|
||||
_ "github.com/wujiang/embd/host/rpi"
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
type analogPin struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package bbb
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
func TestAnalogPinClose(t *testing.T) {
|
||||
|
|
|
@ -16,8 +16,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/host/generic"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/host/generic"
|
||||
)
|
||||
|
||||
var pins = embd.PinMap{
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/util"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -3,7 +3,7 @@ package bbb
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
func TestPWMPinClose(t *testing.T) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
type digitalPin struct {
|
||||
|
@ -236,6 +236,10 @@ func (p *digitalPin) Close() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := p.unexport(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !p.initialized {
|
||||
return nil
|
||||
}
|
||||
|
@ -249,9 +253,6 @@ func (p *digitalPin) Close() error {
|
|||
if err := p.activeLow.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.unexport(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p.initialized = false
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package generic
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
func TestDigitalPinClose(t *testing.T) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"unsafe"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
type led struct {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"unsafe"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -36,6 +36,9 @@ type spiIOCTransfer struct {
|
|||
speedHz uint32
|
||||
delayus uint16
|
||||
bitsPerWord uint8
|
||||
|
||||
csChange uint8
|
||||
pad uint32
|
||||
}
|
||||
|
||||
type spiBus struct {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
package rpi
|
||||
|
||||
import (
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/host/generic"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/host/generic"
|
||||
)
|
||||
|
||||
var spiDeviceMinor = byte(0)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
type Key int
|
||||
|
|
|
@ -3,7 +3,7 @@ package servo
|
|||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd/util"
|
||||
"github.com/wujiang/embd/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
_ "github.com/kidoman/embd/host/rpi"
|
||||
"github.com/wujiang/embd"
|
||||
_ "github.com/wujiang/embd/host/rpi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/bh1750fvi"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/bh1750fvi"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/bmp085"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/bmp085"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/bmp180"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/bmp180"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -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/wujiang/embd"
|
||||
"github.com/wujiang/embd/controller/hd44780"
|
||||
"github.com/wujiang/embd/interface/display/characterdisplay"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
_ "github.com/kidoman/embd/host/rpi"
|
||||
"github.com/wujiang/embd"
|
||||
_ "github.com/wujiang/embd/host/rpi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -5,9 +5,9 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -6,10 +6,10 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/controller/hd44780"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/controller/hd44780"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -5,8 +5,9 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/interface/keypad/matrix4x3"
|
||||
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/interface/keypad/matrix4x3"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/l3gd20"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/l3gd20"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/bbb"
|
||||
_ "github.com/wujiang/embd/host/bbb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
|
||||
_ "github.com/kidoman/embd/host/bbb"
|
||||
_ "github.com/wujiang/embd/host/bbb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/lsm303"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/lsm303"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -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/wujiang/embd"
|
||||
"github.com/wujiang/embd/convertors/mcp3008"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"os"
|
||||
"os/signal"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/controller/mcp4725"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/controller/mcp4725"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/controller/pca9685"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/controller/pca9685"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/host/bbb"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/host/bbb"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -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/wujiang/embd"
|
||||
"github.com/wujiang/embd/controller/pca9685"
|
||||
"github.com/wujiang/embd/motion/servo"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/motion/servo"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/motion/servo"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd/controller/servoblaster"
|
||||
"github.com/kidoman/embd/motion/servo"
|
||||
"github.com/wujiang/embd/controller/servoblaster"
|
||||
"github.com/wujiang/embd/motion/servo"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -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/wujiang/embd"
|
||||
_ "github.com/wujiang/embd/host/rpi" // This loads the RPi driver
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -5,8 +5,8 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
"github.com/wujiang/embd"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -24,25 +24,25 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("received data is: %v", dataBuf)
|
||||
fmt.Println("received data is:", dataBuf)
|
||||
|
||||
dataReceived, err := spiBus.ReceiveData(3)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("received data is: %v", dataReceived)
|
||||
fmt.Println("received data is:", dataReceived)
|
||||
|
||||
dataByte := byte(1)
|
||||
receivedByte, err := spiBus.TransferAndReceiveByte(dataByte)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("received byte is: %v", receivedByte)
|
||||
fmt.Println("received byte is:", receivedByte)
|
||||
|
||||
receivedByte, err = spiBus.ReceiveByte()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("received byte is: %v", receivedByte)
|
||||
fmt.Println("received byte is:", receivedByte)
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
"github.com/wujiang/embd"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"os"
|
||||
"os/signal"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/tmp006"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/tmp006"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
"github.com/wujiang/embd"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/us020"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/us020"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/sensor/watersensor"
|
||||
"github.com/wujiang/embd"
|
||||
"github.com/wujiang/embd/sensor/watersensor"
|
||||
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
_ "github.com/wujiang/embd/host/all"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
//accuracy = sensorValue/actualValue] (min = 0.96, typ = 1.2, max = 1.44
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/wujiang/embd"
|
||||
)
|
||||
|
||||
// WaterSensor represents a water sensor.
|
||||
|
|
Loading…
Reference in New Issue