machine

package
v0.0.0-...-5a60c51 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectPinDriver

type DirectPinDriver struct {
	*gpio.DirectPinDriver
}

func (*DirectPinDriver) Flash

func (d *DirectPinDriver) Flash() (err error)

Flash set's the LED's pins to their various states

type Driver

type Driver interface {
	// Turn on
	On() (err error)

	// Turn off
	Off() (err error)

	// Flash
	Flash() (err error)
}

Interface Driver which exposes common actions. Extend desired drivers to implement methods exposed in Driver.

type LedDriver

type LedDriver struct {
	*gpio.LedDriver
}

func (*LedDriver) Flash

func (d *LedDriver) Flash() (err error)

Flash set's the LED's pins to their various states

type Machine

type Machine interface {

	// Start machine
	Start() []error

	// Stop machine
	Stop() []error

	// Reset everything
	Reset()

	// Add work
	Work(func())

	// Execute default action
	DefaultAction(identifier string)
}

Machine interface

type MachineFactory

type MachineFactory struct {
	Gobot *gobot.Gobot
}

MachineFactory struct, implements Machine

func NewMachineFromConfig

func NewMachineFromConfig(config map[string]interface{}) *MachineFactory

NewMachineFromConfig will return an instance of Machine from the usual configurations. For more control, safety, drivers and so on, please create your own implementation.

func (*MachineFactory) AddDeviceFromConfig

func (m *MachineFactory) AddDeviceFromConfig(name string, config map[string]string)

Add device from configuration

func (*MachineFactory) AddDevicesFromConfig

func (m *MachineFactory) AddDevicesFromConfig(devices map[string]interface{})

Add devices from configuration

func (*MachineFactory) Close

func (m *MachineFactory) Close() error

func (*MachineFactory) DefaultAction

func (m *MachineFactory) DefaultAction(identifier string)

Execute default action. This will turn a matching device On then Off.

func (*MachineFactory) Reset

func (m *MachineFactory) Reset()

Reset

func (*MachineFactory) Start

func (m *MachineFactory) Start() []error

Start

func (*MachineFactory) Stop

func (m *MachineFactory) Stop() []error

Stop

func (*MachineFactory) Work

func (m *MachineFactory) Work(work func())

Add work

type RgbLedDriver

type RgbLedDriver struct {
	*gpio.RgbLedDriver
}

func (*RgbLedDriver) Flash

func (l *RgbLedDriver) Flash() (err error)

Flash set's the LED's pins to their various states

Jump to

Keyboard shortcuts

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