trapController

package
v0.0.0-...-4875257 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActuatorRead

func ActuatorRead(name string, update bool) (value uint16, extended, retracted bool, err error)

func ActuatorWrite

func ActuatorWrite(name string, value uint16) error

func DigitalPinWrite

func DigitalPinWrite(pin string, val uint16) error

func GetSequenceState

func GetSequenceState() (string, error)

func ServoRead

func ServoRead(name string, update bool) (value uint16, err error)

func ServoWrite

func ServoWrite(name string, val uint16) error

func StartSequence

func StartSequence() error

func StopSequence

func StopSequence() error

Types

type Actuator

type Actuator struct {
	Name             string `yaml:"name"`
	Address          uint16 `yaml:"address"`
	ExtendedAddress  uint16 `yaml:"extended-address"`
	RetractedAddress uint16 `yaml:"retracted-address"`
	Value            uint16
	Extended         uint16
	Retracted        uint16
}

func ActuatorReadAll

func ActuatorReadAll(update bool) (res []Actuator, err error)

func (Actuator) String

func (a Actuator) String() string

type DigitalPin

type DigitalPin struct {
	Name    string `yaml:"name"`
	Address uint16 `yaml:"address"`
	Output  bool   `yaml:"output"`
	Value   uint16
}

func DigitalPinRead

func DigitalPinRead(pin string, update bool) (res DigitalPin, err error)

func DigitalPinReadAll

func DigitalPinReadAll(update bool) (res []DigitalPin, err error)

func (DigitalPin) String

func (d DigitalPin) String() string

type Servo

type Servo struct {
	Name     string `yaml:"name"`
	Address  uint16 `yaml:"address"`
	MinAngle uint16 `yaml:"min-angle"` //TODO add into code
	MaxAngle uint16 `yaml:"max-angle"` //TODO add into code
	Value    uint16
}

func ServoReadAll

func ServoReadAll(update bool) (res []Servo, err error)

func (Servo) String

func (s Servo) String() string

type Trap

type Trap struct {
	Name        string        `yaml:"name"`
	Version     uint16        `yaml:"version"`
	RS485id     byte          `yaml:"rs485-id"`
	DigitalPins []*DigitalPin `yaml:"digital-pins"`
	Servos      []*Servo      `yaml:"servos"`
	Actuators   []*Actuator   `yaml:"actuators"`
	// contains filtered or unexported fields
}

func NewTrap

func NewTrap(filename string, serialPort string, baudRate int, timeout int) (*Trap, error)

func (*Trap) GetActuator

func (t *Trap) GetActuator(name string) (*Actuator, error)

func (*Trap) GetDigitalPin

func (t *Trap) GetDigitalPin(name string) (*DigitalPin, error)

func (*Trap) GetServo

func (t *Trap) GetServo(name string) (*Servo, error)

func (*Trap) ReadActuator

func (t *Trap) ReadActuator(name string) (uint16, bool, bool, error)

func (*Trap) ReadDigitalPin

func (t *Trap) ReadDigitalPin(name string) (uint16, error)

func (*Trap) ReadServo

func (t *Trap) ReadServo(name string) (uint16, error)

func (Trap) String

func (t Trap) String() string

func (*Trap) Test

func (t *Trap) Test() error

Test will check that it can connect and that the deviceTypeID and version matches

func (*Trap) Update

func (t *Trap) Update() error

Update will read the values from the device

func (*Trap) Write

func (t *Trap) Write(address uint16, value uint16) error

func (*Trap) WriteActuator

func (t *Trap) WriteActuator(name string, value uint16) error

func (*Trap) WriteDigitalPin

func (t *Trap) WriteDigitalPin(name string, value uint16) error

func (*Trap) WriteServo

func (t *Trap) WriteServo(name string, value uint16) error

func (*Trap) WriteTry

func (t *Trap) WriteTry(address uint16, value uint16) error

Jump to

Keyboard shortcuts

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