flotilla

package
v0.0.0-...-ffe7524 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitOnError

func ExitOnError(err error)

func IntToBool

func IntToBool(v int) bool

func LerpFloat

func LerpFloat(a, b, t float64) float64

func LerpInt

func LerpInt(a, b int, t float64) int

func Limit

func Limit(val, min, max int) int

func LimitF

func LimitF(val, min, max float64) float64

func Map

func Map(val, fromMin, fromMax, toMin, toMax int) int

func MaxInt

func MaxInt(vals ...int) (max int)

func MinInt

func MinInt(vals ...int) (min int)

Types

type AnalogControllable

type AnalogControllable interface {
	SetValue(value int)
}

type AnalogValue

type AnalogValue interface {
	GetValue() int
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func ConnectToDock

func ConnectToDock(serialport string) (*Client, error)

func ConnectToDocks

func ConnectToDocks(serialports ...string) (*Client, error)

func ConnectToDocksRaw

func ConnectToDocksRaw(ports ...io.ReadWriteCloser) (*Client, error)

func FindDocks

func FindDocks() (*Client, error)

func (*Client) AquireModules

func (c *Client) AquireModules(moduleStructPtr interface{})

func (*Client) Close

func (c *Client) Close()

func (*Client) OnTick

func (c *Client) OnTick(tf TickFunc)

func (*Client) Run

func (c *Client) Run(tickTime time.Duration) error

type Colour

type Colour struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Colour) Construct

func (m *Colour) Construct()

func (*Colour) Type

func (m *Colour) Type() dock.ModuleType

type Constructable

type Constructable interface {
	Construct()
}

type Dial

type Dial struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Dial) Construct

func (m *Dial) Construct()

func (*Dial) GetValue

func (m *Dial) GetValue() int

func (*Dial) OnChange

func (m *Dial) OnChange(f func(value int))

func (*Dial) Type

func (m *Dial) Type() dock.ModuleType

type Direction

type Direction int
const (
	DirNone  Direction = 0
	DirUp    Direction = 1
	DirDown  Direction = 2
	DirLeft  Direction = 4
	DirRight Direction = 8
)

type Event

type Event struct {
	dock.Event
	// contains filtered or unexported fields
}

Event is a wrapper around a dock.Event that contains an additional Dock index

type Joystick

type Joystick struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Joystick) Construct

func (m *Joystick) Construct()

func (*Joystick) GetDirection

func (m *Joystick) GetDirection() (dir Direction, button bool)

func (*Joystick) GetValue

func (m *Joystick) GetValue() (x, y int, button bool)

func (*Joystick) OnChange

func (m *Joystick) OnChange(f func(valueX int, valueY int, button bool))

func (*Joystick) Type

func (m *Joystick) Type() dock.ModuleType

type Light

type Light struct {
	ModuleCommon
}

func (*Light) Type

func (m *Light) Type() dock.ModuleType

type Matrix

type Matrix struct {
	ModuleCommon
	MatrixBuffer
	// contains filtered or unexported fields
}

func (*Matrix) Construct

func (m *Matrix) Construct()

func (*Matrix) Set

func (m *Matrix) Set(d *dock.Dock) error

func (*Matrix) SetBrightness

func (m *Matrix) SetBrightness(b int)

func (*Matrix) String

func (m *Matrix) String() (s string)

func (*Matrix) Type

func (m *Matrix) Type() dock.ModuleType

type MatrixBuffer

type MatrixBuffer struct {
	// contains filtered or unexported fields
}

func (*MatrixBuffer) Clear

func (m *MatrixBuffer) Clear()

func (*MatrixBuffer) DrawBarGraph

func (m *MatrixBuffer) DrawBarGraph(values []int, min, max int)

func (*MatrixBuffer) GetCol

func (m *MatrixBuffer) GetCol(col int) byte

func (*MatrixBuffer) GetRow

func (m *MatrixBuffer) GetRow(row int) byte

func (*MatrixBuffer) Plot

func (m *MatrixBuffer) Plot(col, row, v int)

func (*MatrixBuffer) Roll

func (m *MatrixBuffer) Roll(dir Direction)

func (*MatrixBuffer) RollDown

func (m *MatrixBuffer) RollDown()

func (*MatrixBuffer) RollLeft

func (m *MatrixBuffer) RollLeft()

func (*MatrixBuffer) RollRight

func (m *MatrixBuffer) RollRight()

func (*MatrixBuffer) RollUp

func (m *MatrixBuffer) RollUp()

func (*MatrixBuffer) Scroll

func (m *MatrixBuffer) Scroll(dir Direction, fill byte)

func (*MatrixBuffer) ScrollDown

func (m *MatrixBuffer) ScrollDown(fill byte)

func (*MatrixBuffer) ScrollLeft

func (m *MatrixBuffer) ScrollLeft(fill byte)

func (*MatrixBuffer) ScrollRight

func (m *MatrixBuffer) ScrollRight(fill byte)

func (*MatrixBuffer) ScrollUp

func (m *MatrixBuffer) ScrollUp(fill byte)

func (*MatrixBuffer) SetCol

func (m *MatrixBuffer) SetCol(col int, v byte)

func (*MatrixBuffer) SetPattern

func (m *MatrixBuffer) SetPattern(values []string)

func (*MatrixBuffer) SetRow

func (m *MatrixBuffer) SetRow(row int, v byte)

type Module

type Module interface {
	Update(ev Event)
	Connected() bool
	Type() dock.ModuleType
	Init(client *Client, t dock.ModuleType)
}

type ModuleAddress

type ModuleAddress struct {
	// contains filtered or unexported fields
}

type ModuleCommon

type ModuleCommon struct {
	// contains filtered or unexported fields
}

func (*ModuleCommon) Connected

func (m *ModuleCommon) Connected() bool

func (*ModuleCommon) Init

func (m *ModuleCommon) Init(client *Client, t dock.ModuleType)

func (*ModuleCommon) OnUpdate

func (m *ModuleCommon) OnUpdate(f UpdateFunc)

func (*ModuleCommon) Update

func (m *ModuleCommon) Update(ev Event)

type Motion

type Motion struct {
	ModuleCommon
}

func (*Motion) Type

func (m *Motion) Type() dock.ModuleType

type Motor

type Motor struct {
	ModuleCommon
}

func (*Motor) Type

func (m *Motor) Type() dock.ModuleType

type Number

type Number struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Number) Set

func (m *Number) Set(d *dock.Dock) error

func (*Number) SetInteger

func (m *Number) SetInteger(i int)

func (*Number) Type

func (m *Number) Type() dock.ModuleType

type RGB

type RGB struct {
	R, G, B byte
}

func Add

func Add(rgb1, rgb2 RGB) (rgb RGB)

func Blend

func Blend(rgb1, rgb2 RGB) (rgb RGB)

func LerpRGB

func LerpRGB(rgb1, rgb2 RGB, t float64) (rgb RGB)

type Rainbow

type Rainbow struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Rainbow) Set

func (m *Rainbow) Set(d *dock.Dock) error

func (*Rainbow) SetAll

func (m *Rainbow) SetAll(rgb [5]RGB)

func (*Rainbow) SetBlend

func (m *Rainbow) SetBlend(rgb1, rgb2 RGB)

func (*Rainbow) SetBlend3

func (m *Rainbow) SetBlend3(rgb1, rgb2, rgb3 RGB)

func (*Rainbow) SetSame

func (m *Rainbow) SetSame(rgb RGB)

func (*Rainbow) SetVU

func (m *Rainbow) SetVU(value int)

func (*Rainbow) Type

func (m *Rainbow) Type() dock.ModuleType

type Setable

type Setable interface {
	Set(d *dock.Dock) error
}

type Slider

type Slider struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Slider) Construct

func (m *Slider) Construct()

func (*Slider) GetValue

func (m *Slider) GetValue() int

func (*Slider) OnChange

func (m *Slider) OnChange(f func(value int))

func (*Slider) Type

func (m *Slider) Type() dock.ModuleType

type TickFunc

type TickFunc func(t time.Time)

type Touch

type Touch struct {
	ModuleCommon
	// contains filtered or unexported fields
}

func (*Touch) Construct

func (m *Touch) Construct()

func (*Touch) GetValue

func (m *Touch) GetValue() [4]bool

func (*Touch) OnChange

func (m *Touch) OnChange(f func(button int, pressed bool))

func (*Touch) Type

func (m *Touch) Type() dock.ModuleType

type UpdateFunc

type UpdateFunc func(params []int)

type Weather

type Weather struct {
	ModuleCommon
}

func (*Weather) Type

func (m *Weather) Type() dock.ModuleType

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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