curie: WIP on adding support for Intel Curie IMU
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
6a36f28fc8
commit
2aea7685d2
|
@ -0,0 +1,19 @@
|
|||
# Curie
|
||||
|
||||
The Intel Curie is a microcontroller for the Internet of Things. It is the platform used by the Intel Arduino/Genuino 101 and the Intel TinyTILE.
|
||||
|
||||
For more info about the Curie platform go to: [http://www.intel.com/content/www/us/en/do-it-yourself/edison.html](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html).
|
||||
|
||||
## How to Install
|
||||
|
||||
You would normally install Go and Gobot on your workstation. When you execute the program code, it will communicate with the connected microcontroller using the Firmata protocol.
|
||||
|
||||
```
|
||||
go get -d -u gobot.io/x/gobot/...
|
||||
```
|
||||
|
||||
## How To Use
|
||||
|
||||
```go
|
||||
// code here...
|
||||
```
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
Package curie contains the Gobot driver for the Intel Curie IMU.
|
||||
|
||||
For further information refer to intel-iot README:
|
||||
https://github.com/hybridgroup/gobot/blob/master/platforms/intel-iot/curie/README.md
|
||||
*/
|
||||
package curie // import "gobot.io/x/gobot/platforms/intel-iot/curie"
|
|
@ -0,0 +1,43 @@
|
|||
package curie
|
||||
|
||||
import (
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/platforms/firmata"
|
||||
)
|
||||
|
||||
// IMUDriver represents the IMU that is built-in to the Curie
|
||||
type IMUDriver struct {
|
||||
name string
|
||||
connection *firmata.Adaptor
|
||||
gobot.Eventer
|
||||
}
|
||||
|
||||
// NewIMUDriver returns a new IMUDriver
|
||||
func NewIMUDriver(a *firmata.Adaptor) *IMUDriver {
|
||||
imu := &IMUDriver{
|
||||
name: gobot.DefaultName("CurieIMU"),
|
||||
connection: a,
|
||||
Eventer: gobot.NewEventer(),
|
||||
}
|
||||
|
||||
return imu
|
||||
}
|
||||
|
||||
// Start starts up the IMUDriver
|
||||
func (imu *IMUDriver) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Halt stops the IMUDriver
|
||||
func (imu *IMUDriver) Halt() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Name returns the IMUDriver's name
|
||||
func (imu *IMUDriver) Name() string { return imu.name }
|
||||
|
||||
// SetName sets the IMUDriver'ss name
|
||||
func (imu *IMUDriver) SetName(n string) { imu.name = n }
|
||||
|
||||
// Connection returns the IMUDriver's Connection
|
||||
func (imu *IMUDriver) Connection() gobot.Connection { return imu.connection }
|
|
@ -0,0 +1,21 @@
|
|||
package curie
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/gobottest"
|
||||
|
||||
"gobot.io/x/gobot/platforms/firmata"
|
||||
)
|
||||
|
||||
var _ gobot.Driver = (*IMUDriver)(nil)
|
||||
|
||||
func initTestIMUDriver() *IMUDriver {
|
||||
return NewIMUDriver(firmata.NewAdaptor("/dev/null"))
|
||||
}
|
||||
|
||||
func TestIMUDriverHalt(t *testing.T) {
|
||||
d := initTestIMUDriver()
|
||||
gobottest.Assert(t, d.Halt(), nil)
|
||||
}
|
Loading…
Reference in New Issue