summaryrefslogtreecommitdiff
path: root/iface/iface.go
blob: 5c7325206ee60e8300318899c13cff6148768c44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package iface

// TODO: Use an io.writer instead?
type Logger interface {
	Printf(format string, v ...interface{})
}

// Protocol provides an abstract interface to command servos. This exists so
// that our abstract Servo type can communicate with actual servos regardless
// which protocol version they speak.
//
// The interface must be the union of all protocol versions, but (so far) they
// all have roughly the same instructions, so this isn't a big deal.
type Protocol interface {
	ReadData(ident int, instruction byte) ([]byte, error)
	// WriteData writes a slice of bytes to the control table of the given servo
	// ID.
	WriteData(ident int, instruction byte, data []byte) error
}