device

package
v0.0.0-...-24050ff Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const F1ProductName = "Traktor Kontrol F1"
View Source
const Off = 0
View Source
const On = 64

Variables

View Source
var NumberSegmentMapping = map[int8]Segments{
	0: {Off, On, On, On, On, On, On},
	1: {Off, On, On, Off, Off, Off, Off},
	2: {On, Off, On, On, Off, On, On},
	3: {On, On, On, On, Off, Off, On},
	4: {On, On, On, Off, On, Off, Off},
	5: {On, On, Off, On, On, Off, On},
	6: {On, On, Off, On, On, On, On},
	7: {Off, On, On, On, Off, Off, Off},
	8: {On, On, On, On, On, On, On},
	9: {On, On, On, On, On, Off, Off},
}

Functions

func SetLogger

func SetLogger(newlogger logger.Logger)

Types

type ButtonState

type ButtonState struct {
	LEDIntensity
	button2.PushState
}

type Device

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

func Open

func Open() (*Device, error)

func (*Device) AddCallback

func (d *Device) AddCallback(filter event2.Filter, cb EventCallBack)

func (*Device) Close

func (d *Device) Close()

func (*Device) EnableDebugLogger

func (d *Device) EnableDebugLogger()

func (*Device) Name

func (d *Device) Name() string

func (*Device) SetBrightness

func (d *Device) SetBrightness(btn button.Button, val uint8) error

func (*Device) SetDial

func (d *Device) SetDial(val int8) error

func (*Device) SetPadColor

func (d *Device) SetPadColor(btn button.Button, col color.Color) error

func (*Device) SetPadColorAll

func (d *Device) SetPadColorAll(col color.Color) error

func (*Device) SetPadColorMany

func (d *Device) SetPadColorMany(btns []button.Button, col color.Color) error

func (*Device) SetPadColors

func (d *Device) SetPadColors(mapp button.ColorMap) error

func (*Device) State

func (d *Device) State() State

thread safe state retrieval

func (*Device) String

func (d *Device) String() string

func (*Device) Subscribe

func (d *Device) Subscribe(channel chan<- event.Event)

type EventCallBack

type EventCallBack func(event2.Event)

type InState

type InState struct {
	Version        byte
	PressedButtons map[button2.Button]button2.PushState
	Dial           uint8
	Filters        [4]uint16
	Volumes        [4]uint16
}

func NewInState

func NewInState() *InState

func (*InState) UnpackPacket

func (packet *InState) UnpackPacket(rdr io.Reader) error

The state of all input controls is communicated via a single input report of 22 Bytes The first byte is the version number, currently 0x01

type LEDIntensity

type LEDIntensity uint8

func (LEDIntensity) Value

func (l LEDIntensity) Value() uint8

type OutState

type OutState struct {
	SevenSegment int8 // [-99,99] sign means dot is turned on
	Functions    map[button2.Button]LEDIntensity
	Pads         [16]color.Color
	Mute         [4]LEDIntensity
}

func NewOutState

func NewOutState() OutState

func (OutState) Write

func (o OutState) Write(device *hid.Device) error

type PadState

type PadState struct {
	color.Color
	button2.PushState
}

type RangeState

type RangeState uint16

type Segments

type Segments [7]byte

Segments Order: G, C, B, A, F, E, D

type State

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

func (*State) Copy

func (s *State) Copy() State

func (*State) Functions

func (s *State) Functions() (states [16]ButtonState)

func (*State) Knobs

func (s *State) Knobs() (states [4]RangeState)

func (*State) Pads

func (s *State) Pads() (states [16]PadState)

func (*State) Volumes

func (s *State) Volumes() (states [4]RangeState)

Jump to

Keyboard shortcuts

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