diff options
Diffstat (limited to 'iface/iface.go')
-rw-r--r-- | iface/iface.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/iface/iface.go b/iface/iface.go new file mode 100644 index 0000000..5c73252 --- /dev/null +++ b/iface/iface.go @@ -0,0 +1,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 +} |