usbdmx

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

README

USBDMX

USBDMX, a versatile USB DMX library written in Go for programatic show control and special effects.

Supported Controllers

Planned for support:

  • Enttec DMX USB Pro Mk2

If you don't see your controller here, but would like it to be added, create an issue with the name of the device and a link to any more information.

Quick Start

This will create a mock controller, set channels 1,2 and 3 to 255 and render the output to stdout once. If you have a real world controller that is supported you can create a controller in the same way.

config := usbdmx.NewConfig(vid, pid, outputInterfaceID, debugLevel)
config.GetUSBContext()

controller := mock.NewDMXController(config)
if err := controller.Connect(); err != nil {
    log.Fatal(err)
}

// set a fixture to bright white
controller.SetChannel(1, 255)
controller.SetChannel(2, 255)
controller.SetChannel(3, 255)

if err := controller.Render(); err != nil {
    log.Fatal(err)
}

Contribute

Documentation is a big part of any project, but writing it is very time consuming. Any documentation is greatly appreciated, please adhere to the Go standards for writing documentation. Translations of existing documentation to other languages will also be required.

Contributing code should have tests associated with it and all tests should pass. Code will not be merged into the master branch until it has been proven to work and has passing tests.

Contributors

Oliver Read (Twitter: @oli_read)

Support

If you would like to donate hardware please contact me either via Twitter. Alternatively you can email me, my email can be found in my profile.

License

This project is released under a GNU GPLv3 license, more information can be found at: GNU GPLv3 Website

To summarise: You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions. If you wish to discuss any of these you can email me, which can be found in my profile.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDMXChannel

func ValidateDMXChannel(channel int) (err error)

ValidateDMXChannel helper function for ensuring channel is within range

Types

type Controller

type Controller interface {
	Connect() (err error)
	GetSerial() (info string, err error)
	GetProduct() (info string, err error)
	SetChannel(channel int16, value byte) error
	GetChannel(channel int16) (byte, error)
	Render() error
}

Controller Generic interface for all USB DMX controllers

type ControllerConfig

type ControllerConfig struct {
	VID               uint16 `toml:"vid"`
	PID               uint16 `toml:"pid"`
	OutputInterfaceID int    `toml:"output_interface_id"`
	InputInterfaceID  int    `toml:"input_interface_id"`
	DebugLevel        int    `toml:"debug_level"`

	Context *gousb.Context
}

ControllerConfig configuration for controlling device

func NewConfig

func NewConfig(vid, pid uint16, outputInterfaceID, inputInterfaceID, debugLevel int) ControllerConfig

NewConfig helper function for creating a new ControllerConfig

func ReadConfigFile

func ReadConfigFile(path string) (ControllerConfig, error)

ReadConfigFile reads device configuration information from file

func (*ControllerConfig) GetUSBContext

func (c *ControllerConfig) GetUSBContext()

GetUSBContext gets a gousb/context for a given configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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