2014-04-28 09:54:41 +08:00
|
|
|
package i2c
|
2014-04-26 18:11:51 +08:00
|
|
|
|
2014-11-30 04:10:23 +08:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
2014-11-30 04:10:23 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2015-07-04 09:57:29 +08:00
|
|
|
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
|
2015-07-04 09:57:29 +08:00
|
|
|
I2cStarter
|
|
|
|
I2cReader
|
|
|
|
I2cWriter
|
2014-04-26 18:11:51 +08:00
|
|
|
}
|