Skip to content

Commit

Permalink
Merge branch 'dev' into event-stream
Browse files Browse the repository at this point in the history
Conflicts:
	platforms/spark/spark_core_adaptor.go
  • Loading branch information
zankich committed Dec 28, 2014
2 parents 70e89ae + 1b57112 commit 541761b
Show file tree
Hide file tree
Showing 99 changed files with 3,366 additions and 6,079 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: go
go:
- 1.2
- 1.3
- 1.4
- release
- tip
before_install:
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
0.8
---
- Refactor core, gpio, and i2c interfaces
- Correctly pass errors throughout packages and remove all panics
- Numerous bug fixes and performance improvements
- api
- Update robeaux to v0.3.0
- firmata
- Add optional io.ReadWriteCloser parameter to FirmataAdaptor
- Fix `thread exhaustion` error
- cli
- generator
- Update generator for new adaptor and driver interfaces
- Add driver, adaptor and project generators
- Add optional package name parameter

0.7.1
---
- opencv
Expand Down Expand Up @@ -46,7 +62,6 @@
- Fix incorrect Event names
- sphero
- Correctly format output of GetRGB
>>>>>>> master

0.6.1
---
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ test:
done ; \

cover:
echo "mode: count" > profile.cov ; \
echo "mode: set" > profile.cov ; \
for package in $(PACKAGES) ; do \
go test -a -covermode=count -coverprofile=tmp.cov github.com/hybridgroup/$$package ; \
cat tmp.cov | grep -v "mode: count" >> profile.cov ; \
go test -a -coverprofile=tmp.cov github.com/hybridgroup/$$package ; \
cat tmp.cov | grep -v "mode: set" >> profile.cov ; \
done ; \
rm tmp.cov ; \

Expand All @@ -23,7 +23,8 @@ endif
cd robeaux-tmp ; \
rm fonts/* ; \
rm -r test/* ; \
rm Makefile package.json README.markdown robeaux.gemspec css/fonts.css ; \
rm -r less/* ; \
rm Makefile Gruntfile.js package.json README.markdown robeaux.gemspec css/fonts.css ; \
touch css/fonts.css ; \
echo "Updating robeaux to $(shell git rev-parse HEAD)" ; \
go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \
Expand Down
2 changes: 1 addition & 1 deletion api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func initTestAPI() *api {
log.SetOutput(gobot.NullReadWriteCloser{})
log.SetOutput(NullReadWriteCloser{})
g := gobot.NewGobot()
a := NewAPI(g)
a.start = func(m *api) {}
Expand Down
14 changes: 14 additions & 0 deletions api/test_helper.go → api/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ import (
"github.com/hybridgroup/gobot"
)

type NullReadWriteCloser struct{}

func (NullReadWriteCloser) Write(p []byte) (int, error) {
return len(p), nil
}

func (NullReadWriteCloser) Read(b []byte) (int, error) {
return len(b), nil
}

func (NullReadWriteCloser) Close() error {
return nil
}

type testDriver struct {
name string
pin string
Expand Down
6,371 changes: 1,088 additions & 5,283 deletions api/robeaux/robeaux.go

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions examples/spark_core_function.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"fmt"

"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/spark"
)

func main() {
gbot := gobot.NewGobot()

sparkCore := spark.NewSparkCoreAdaptor("spark", "DEVICE_ID", "ACCESS_TOKEN")

work := func() {
if result, err := sparkCore.Function("brew", "202,230"); err != nil {
fmt.Println(err)
} else {
fmt.Println("result from \"brew\":", result)
}
}

robot := gobot.NewRobot("spark",
[]gobot.Connection{sparkCore},
work,
)

gbot.AddRobot(robot)

gbot.Start()
}
34 changes: 34 additions & 0 deletions examples/spark_core_variable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"fmt"
"time"

"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/spark"
)

func main() {
gbot := gobot.NewGobot()

sparkCore := spark.NewSparkCoreAdaptor("spark", "DEVICE_ID", "ACCESS_TOKEN")

work := func() {
gobot.Every(1*time.Second, func() {
if temp, err := sparkCore.Variable("temperature"); err != nil {
fmt.Println(err)
} else {
fmt.Println("result from \"temperature\" is:", temp)
}
})
}

robot := gobot.NewRobot("spark",
[]gobot.Connection{sparkCore},
work,
)

gbot.AddRobot(robot)

gbot.Start()
}
Loading

0 comments on commit 541761b

Please sign in to comment.