libx52  0.3.2
Saitek X52/X52Pro drivers for Linux/Unix
Enumerations | Functions
MFD & LED control

Enumerations

enum  libx52_led_id {
  LIBX52_LED_FIRE = 0x01 , LIBX52_LED_A = 0x02 , LIBX52_LED_B = 0x04 , LIBX52_LED_D = 0x06 ,
  LIBX52_LED_E = 0x08 , LIBX52_LED_T1 = 0x0a , LIBX52_LED_T2 = 0x0c , LIBX52_LED_T3 = 0x0e ,
  LIBX52_LED_POV = 0x10 , LIBX52_LED_CLUTCH = 0x12 , LIBX52_LED_THROTTLE = 0x14
}
 Supported LED identifiers. More...
 
enum  libx52_led_state {
  LIBX52_LED_STATE_OFF , LIBX52_LED_STATE_ON , LIBX52_LED_STATE_RED , LIBX52_LED_STATE_AMBER ,
  LIBX52_LED_STATE_GREEN
}
 Supported LED states. More...
 

Functions

int libx52_set_text (libx52_device *x52, uint8_t line, const char *text, uint8_t length)
 Set the text on an MFD line. More...
 
int libx52_set_led_state (libx52_device *x52, libx52_led_id led, libx52_led_state state)
 Set the LED state. More...
 
int libx52_set_brightness (libx52_device *x52, uint8_t mfd, uint16_t brightness)
 Set the MFD or LED brightness. More...
 
int libx52_set_shift (libx52_device *x52, uint8_t state)
 Set the state of the shift indicator. More...
 
int libx52_set_blink (libx52_device *x52, uint8_t state)
 Set the blinking state. More...
 

Detailed Description

Control the MFD text and LED states

Enumeration Type Documentation

◆ libx52_led_id

Supported LED identifiers.

Enumerator
LIBX52_LED_FIRE 

Fire indicator LED

LIBX52_LED_A 

LED on button A

LIBX52_LED_B 

LED on button B

LIBX52_LED_D 

LED on button D

LIBX52_LED_E 

LED on button E

LIBX52_LED_T1 

LED on toggle T1

LIBX52_LED_T2 

LED on toggle T2

LIBX52_LED_T3 

LED on toggle T3

LIBX52_LED_POV 

LED on POV Hat

LIBX52_LED_CLUTCH 

LED on clutch button

LIBX52_LED_THROTTLE 

Throttle LED

◆ libx52_led_state

Supported LED states.

Not all LEDs support all states

Enumerator
LIBX52_LED_STATE_OFF 

LED is off

LIBX52_LED_STATE_ON 

LED is on. This is not supported by those LEDs which can display multiple colors

LIBX52_LED_STATE_RED 

LED displays red color. This is not supported by single color LEDs

LIBX52_LED_STATE_AMBER 

LED displays amber color. This is not supported by single color LEDs

LIBX52_LED_STATE_GREEN 

LED displays green color. This is not supported by single color LEDs

Function Documentation

◆ libx52_set_blink()

int libx52_set_blink ( libx52_device x52,
uint8_t  state 
)

Set the blinking state.

The X52 Pro has a "blink" state where it blinks the clutch and hat LEDs.

Parameters
[in]x52Pointer to the device context
[in]state0 for off, 1 for on
Returns

◆ libx52_set_brightness()

int libx52_set_brightness ( libx52_device x52,
uint8_t  mfd,
uint16_t  brightness 
)

Set the MFD or LED brightness.

The brightness of the MFD display and the button LEDs can be controlled individually. brightness should be a value between 0 and 128. While the library does not fail on values higher than 128, the effect may not be what is intended.

Parameters
[in]x52Pointer to the device context
[in]mfd0 for LED brightness, 1 for MFD brightness
[in]brightnessBrightness level to set
Returns

◆ libx52_set_led_state()

int libx52_set_led_state ( libx52_device x52,
libx52_led_id  led,
libx52_led_state  state 
)

Set the LED state.

The X52 pro has several LEDs that can be individually controlled. This function allows you to set the state of each LED in the internal data structures.

Note that the LEDs referred to by LIBX52_LED_FIRE and LIBX52_LED_THROTTLE support only the states LIBX52_LED_STATE_OFF and LIBX52_LED_STATE_ON. The remaining LEDs support all the states with the exception of LIBX52_LED_STATE_ON.

Parameters
[in]x52Pointer to the device context
[in]ledLED identifier (refer libx52_led_id)
[in]stateState of the LED (refer libx52_led_state)
Returns

◆ libx52_set_shift()

int libx52_set_shift ( libx52_device x52,
uint8_t  state 
)

Set the state of the shift indicator.

The X52 Pro MFD has a single shift indicator that indicates when the "shift" button is pressed.

Parameters
[in]x52Pointer to the device context
[in]state0 for off, 1 for on
Returns

◆ libx52_set_text()

int libx52_set_text ( libx52_device x52,
uint8_t  line,
const char *  text,
uint8_t  length 
)

Set the text on an MFD line.

The Multifunction display (MFD) supports 3 lines of up to 16 characters. This function will set the text into the internal data structures.

text must be a pointer to an array of bytes, each byte represents a code point on the MFD's internal character map. length is the length of this array.

line must be 0, 1, or 2 and refers to the first, second or third line of the MFD respectively.

Limitations
This function can only store a maximum of 16 characters per line. Any additional characters are silently discarded.
Parameters
[in]x52Pointer to the device context
[in]lineLine to be updated (0, 1 or 2)
[in]textPointer to the text string. The text must be mapped to the code page of the X52 display.
[in]lengthLength of the text to display
Returns