hybridgroup.gobot/platforms/i2c/i2c.go

41 lines
689 B
Go
Raw Normal View History

2014-04-28 09:54:41 +08:00
package i2c
2014-11-30 04:10:23 +08:00
import (
"errors"
"github.com/hybridgroup/gobot"
)
var (
2015-07-11 02:39:31 +08:00
ErrEncryptedBytes = errors.New("Encrypted bytes")
ErrNotEnoughBytes = errors.New("Not enough bytes read")
ErrNotReady = errors.New("Device is not ready")
ErrInvalidPosition = errors.New("Invalid position value")
2014-11-30 04:10:23 +08:00
)
const (
Error = "error"
Joystick = "joystick"
C = "c"
Z = "z"
)
type I2cStarter interface {
I2cStart(address int) (err error)
}
type I2cReader interface {
I2cRead(address int, len int) (data []byte, err error)
}
type I2cWriter interface {
I2cWrite(address int, buf []byte) (err error)
}
2014-11-30 04:10:23 +08:00
type I2c interface {
gobot.Adaptor
I2cStarter
I2cReader
I2cWriter
}