Documentation ¶
Overview ¶
Package x52 provides handling for the X52/X52Pro devices
Index ¶
- Constants
- type ClockFormat
- type ClockID
- type Context
- func (ctx *Context) Close() error
- func (ctx *Context) Connect() bool
- func (ctx *Context) Debug(level int)
- func (ctx *Context) DebugUSB(level int)
- func (ctx *Context) HasFeature(feature uint32) bool
- func (ctx *Context) Raw(index, value uint16) error
- func (ctx *Context) Reset() error
- func (ctx *Context) SetBlink(enable bool) error
- func (ctx *Context) SetClockFormat(clock ClockID, format ClockFormat) error
- func (ctx *Context) SetDateFormat(format DateFormat) error
- func (ctx *Context) SetLEDBrightness(brightness uint16) error
- func (ctx *Context) SetLed(led LED, state LedState) error
- func (ctx *Context) SetLocation(clock ClockID, loc *time.Location) error
- func (ctx *Context) SetMFDBrightness(brightness uint16) error
- func (ctx *Context) SetMFDText(line uint8, data []byte) error
- func (ctx *Context) SetShift(enable bool) error
- func (ctx *Context) SetTime(t time.Time) error
- func (ctx *Context) Update() error
- type DateFormat
- type LED
- type LedState
Constants ¶
const ( LedFire = LED(0x01) LedA = LED(0x02) LedB = LED(0x04) LedD = LED(0x06) LedE = LED(0x08) LedT1 = LED(0x0a) LedT2 = LED(0x0c) LedT3 = LED(0x0e) LedPOV = LED(0x10) LedClutch = LED(0x12) LedThrottle = LED(0x14) )
LED Identifiers
const (
FeatureLED uint32 = iota
)
Feature flags
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClockFormat ¶
type ClockFormat uint
ClockFormat describes the time format on the MFD
const ( ClockFormat12Hr ClockFormat = iota ClockFormat24Hr )
Clock Format Identifiers
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context manages all resources related to device handling
func NewContext ¶
func NewContext() *Context
NewContext returns a new Context against which to run device operations
func (*Context) Close ¶
Close closes the context, and any devices that may have been opened will also be closed
func (*Context) Connect ¶
Connect will try to connect to a supported X52/X52Pro joystick. If the joystick is plugged in and the function succeeds, it returns true, otherwise it returns false. If multiple supported devices are plugged in, then it will pick one of the supported devices in an unspecified manner.
func (*Context) Debug ¶
Debug changes the debug level. Level 0 means no debug, higher levels will print out more debugging information.
func (*Context) DebugUSB ¶
DebugUSB changes the debug level of the USB subsystem. Level 0 means no debug, higher levels will print out more debugging information.
func (*Context) HasFeature ¶
HasFeature returns true if the X52 device supports the requested feature
func (*Context) Reset ¶
Reset resets the connected device. If there is no device connected, it returns errNotConnected, otherwise it will return a corresponding USB error
func (*Context) SetClockFormat ¶
func (ctx *Context) SetClockFormat(clock ClockID, format ClockFormat) error
SetClockFormat sets the clock format of the given clock
func (*Context) SetDateFormat ¶
func (ctx *Context) SetDateFormat(format DateFormat) error
SetDateFormat sets the date format
func (*Context) SetLEDBrightness ¶
SetLEDBrightness will set the brightness of the LED.
func (*Context) SetLed ¶
SetLed sets the state of the given LED. Not all LEDs support all states, LedFire and LedThrottle only support LedOn and LedOff states, the remaining LEDs support every state except LedOn. **Limitation**: This function will not work on a non-pro X52 at this time.
func (*Context) SetLocation ¶
SetLocation updates the location of the given clock. You may not update the location of the primary clock, as it is computed when you call SetTime
func (*Context) SetMFDBrightness ¶
SetMFDBrightness will set the brightness of the MFD.
func (*Context) SetMFDText ¶
SetMFDText sets the display on the given MFD line. The data must be in the code page recognized by the MFD. This function only accepts line lengths of up to 16 bytes, with any additional data being silently discarded.
type DateFormat ¶
type DateFormat uint
DateFormat describes the date format on the MFD
const ( DateFormatDDMMYY DateFormat = iota DateFormatMMDDYY DateFormatYYMMDD )
Date Format Identifiers