summaryrefslogtreecommitdiff
path: root/iface
diff options
context:
space:
mode:
authorGravatar jet tsang zeon-git <zeon-git@jettsang.com> 2020-08-05 15:39:11 +0800
committerGravatar jet tsang zeon-git <zeon-git@jettsang.com> 2020-08-05 15:39:11 +0800
commit87f1f9828b02e3dad06fa935776296605459fcee (patch)
treecfe788f92a39833afe5655eabcbdf70ee43df201 /iface
parentInitial scaffolding (diff)
downloadlobot-87f1f9828b02e3dad06fa935776296605459fcee.tar.gz
lobot-87f1f9828b02e3dad06fa935776296605459fcee.tar.bz2
lobot-87f1f9828b02e3dad06fa935776296605459fcee.zip
implementation instructions for lx servo
Signed-off-by: jet tsang zeon-git <zeon-git@jettsang.com>
Diffstat (limited to 'iface')
-rw-r--r--iface/iface.go19
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
+}