iface

package
v0.0.0-...-be9965c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 0 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

TODO: Use an io.writer instead?

type Protocol

type Protocol interface {
	Ping(ident int) error

	ReadData(ident int, address int, length int) ([]byte, error)

	// WriteData writes a slice of bytes to the control table of the given servo
	// ID.
	WriteData(ident int, address int, data []byte, expectResponse bool) error

	// RegWrite writes a slice of bytes to the control table of the given servo
	// ID, like WriteData, but the resulting instruction (e.g. set goal, torque)
	// is not executed until the Action method is called.
	RegWrite(ident int, address int, data []byte, expectResponse bool) error

	// Action causes writes buffered by the RegWrite method to be executed. This
	// is useful to update the state of many servos simultaneously.
	Action() error
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL