monome

package module
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 5 Imported by: 1

README

go-monome

A go library and CLI tool for the original 40h.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADC

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

ADC represents a ADC input.

func (*ADC) Disable

func (a *ADC) Disable() error

Disable turns a given ADC off.

func (*ADC) Enable

func (a *ADC) Enable() error

Enable turns a given ADC on.

type ADCHandler

type ADCHandler func(*Monome, uint, uint) error

ADCHandler is a function that can be run when an ADC message is received.

type ButtonHandler

type ButtonHandler func(*Monome, uint, uint, uint) error

ButtonHandler is a function that can be run when a Button message is received.

type Column

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

Column reperesents a single column of LEDS on the monome.

func (*Column) Off

func (c *Column) Off() error

Off turns off all of the given LEDs in a column.

func (*Column) On

func (c *Column) On() error

On turns on all of the given LEDs in a column.

func (*Column) Set

func (c *Column) Set(b byte) error

Set sets all of the given LEDs in a column.

type LED

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

LED represents a single LED on the monome.

func (*LED) Off

func (l *LED) Off() error

Off turns a given LED off

func (*LED) On

func (l *LED) On() error

On turns a given LED on

func (*LED) Toggle

func (l *LED) Toggle() error

Toggle turns a given LED on if it's off and vice-versa.

type Monome

type Monome struct {
	Debug bool
	// contains filtered or unexported fields
}

Monome is the type that looks after the configuration, serial port, and LED state of a given monome 40h.

func Find added in v0.1.1

func Find(debug bool) (monomes []*Monome)

Find returns a new monome for each matching device found under /dev/*

func NewMonome

func NewMonome(portPath string, debug bool) *Monome

NewMonome returns a new Monome with the given serial port path and default serial configuration.

func NewMonomeConfig

func NewMonomeConfig(serialConfig *serial.Config, debug bool) *Monome

NewMonomeConfig returns a new Monome with a given `*serial.Config`

func (*Monome) ADC

func (m *Monome) ADC(n uint) *ADC

ADC returns a new ADC

func (*Monome) ADCChanged

func (m *Monome) ADCChanged(ah ADCHandler)

ADCChanged adds a ADC handler

func (*Monome) Brightness

func (m *Monome) Brightness(v float64) error

Brightness sets the brightness of all LEDs given by a float between 0 and 1 inclusive. 0 is off, 1.0 is full brightness.

func (*Monome) ButtonChanged

func (m *Monome) ButtonChanged(bh ButtonHandler)

ButtonChanged adds a Button handler

func (*Monome) Clear

func (m *Monome) Clear() error

Clear discards the LED state and turns off all LEDs.

func (*Monome) Close

func (m *Monome) Close()

Close attepmts to open the device.

func (*Monome) Column added in v0.1.2

func (m *Monome) Column(x uint) *Column

Column returns a given Row of LEDs on the monome.

func (*Monome) LED

func (m *Monome) LED(x, y uint) *LED

LED returns a given LED on the given Monome, clamping the values of x and y to 0-7.

func (*Monome) LEDTest

func (m *Monome) LEDTest(on bool) error

LEDTest tells the device to turn on or off all of the LEDs without updating internal state.

func (*Monome) Loop

func (m *Monome) Loop() error

Loop reads continuously from the monome, calling a handler when messages are recieved.

func (*Monome) Open

func (m *Monome) Open() error

Open attepmts to open the device.

func (*Monome) Row

func (m *Monome) Row(y uint) *Row

Row returns a given Row of LEDs on the monome.

func (*Monome) Shutdown

func (m *Monome) Shutdown() error

Shutdown turns the monome off.

func (*Monome) Write

func (m *Monome) Write(message [2]byte) error

Write writes a message to the given monome.

func (*Monome) WriteState

func (m *Monome) WriteState() error

WriteState updates all LEDs on the device to match the stored state.

type Row

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

Row reperesents a single row of LEDS on the monome.

func (*Row) Off

func (r *Row) Off() error

Off turns off all of the given LEDs in a row.

func (*Row) On

func (r *Row) On() error

On turns on all of the given LEDs in a row.

func (*Row) Set

func (r *Row) Set(b byte) error

Set sets all of the given LEDs in a row.

Directories

Path Synopsis
cmd
test-monome module

Jump to

Keyboard shortcuts

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