libx52  0.3.2
Saitek X52/X52Pro drivers for Linux/Unix
Typedefs | Enumerations | Functions
libx52.h File Reference

Functions, structures and enumerations for the Saitek X52 MFD & LED driver library. More...

Go to the source code of this file.

Typedefs

typedef struct libx52_device libx52_device
 Device context structure used by libx52. More...
 

Enumerations

enum  libx52_clock_id { LIBX52_CLOCK_1 , LIBX52_CLOCK_2 , LIBX52_CLOCK_3 }
 List of supported clocks on the MFD. More...
 
enum  libx52_clock_format { LIBX52_CLOCK_FORMAT_12HR , LIBX52_CLOCK_FORMAT_24HR }
 Supported clock formats. More...
 
enum  libx52_date_format { LIBX52_DATE_FORMAT_DDMMYY , LIBX52_DATE_FORMAT_MMDDYY , LIBX52_DATE_FORMAT_YYMMDD }
 Supported date formats. More...
 
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...
 
enum  libx52_error_code {
  LIBX52_SUCCESS = 0 , LIBX52_ERROR_INIT_FAILURE , LIBX52_ERROR_OUT_OF_MEMORY , LIBX52_ERROR_INVALID_PARAM ,
  LIBX52_ERROR_NOT_SUPPORTED , LIBX52_ERROR_TRY_AGAIN , LIBX52_ERROR_OUT_OF_RANGE , LIBX52_ERROR_USB_FAILURE ,
  LIBX52_ERROR_IO , LIBX52_ERROR_PERM , LIBX52_ERROR_NO_DEVICE , LIBX52_ERROR_NOT_FOUND ,
  LIBX52_ERROR_BUSY , LIBX52_ERROR_TIMEOUT , LIBX52_ERROR_OVERFLOW , LIBX52_ERROR_PIPE ,
  LIBX52_ERROR_INTERRUPTED
}
 LibX52 Error codes. More...
 
enum  libx52_feature { LIBX52_FEATURE_LED }
 Feature support for libx52. More...
 

Functions

int libx52_init (libx52_device **dev)
 Initialize the X52 library. More...
 
void libx52_exit (libx52_device *dev)
 Exit the library and free up any resources used. More...
 
int libx52_connect (libx52_device *dev)
 Connect to the X52 device. More...
 
int libx52_disconnect (libx52_device *dev)
 Disconnect from the X52 device. More...
 
bool libx52_is_connected (libx52_device *dev)
 Check if joystick is connected. More...
 
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_clock (libx52_device *x52, time_t time, int local)
 Set the clock. More...
 
int libx52_set_clock_timezone (libx52_device *x52, libx52_clock_id clock, int offset)
 Set the timezone for the secondary and tertiary clocks. More...
 
int libx52_set_clock_format (libx52_device *x52, libx52_clock_id clock, libx52_clock_format format)
 Set whether the clock is displayed in 12 hour or 24 hour format. More...
 
int libx52_set_time (libx52_device *x52, uint8_t hour, uint8_t minute)
 Set the hour and minute on clock 1. More...
 
int libx52_set_date (libx52_device *x52, uint8_t dd, uint8_t mm, uint8_t yy)
 Set the date. More...
 
int libx52_set_date_format (libx52_device *x52, libx52_date_format format)
 Set the date format for the MFD date display. 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...
 
int libx52_update (libx52_device *x52)
 Update the X52. More...
 
int libx52_vendor_command (libx52_device *x52, uint16_t index, uint16_t value)
 Write a raw vendor control packet. More...
 
int libx52_check_feature (libx52_device *x52, libx52_feature feature)
 Check if the device supports the given feature. More...
 
const char * libx52_strerror (libx52_error_code error)
 Return a string representation of the error code. More...
 
const char * libx52_clock_id_to_str (libx52_clock_id id)
 Returns a string representation of the clock ID. More...
 
const char * libx52_clock_format_to_str (libx52_clock_format format)
 Returns a string representation of the clock format. More...
 
const char * libx52_date_format_to_str (libx52_date_format format)
 Returns a string representation of the date format. More...
 
const char * libx52_led_id_to_str (libx52_led_id id)
 Returns a string representation of the LED. More...
 
const char * libx52_led_state_to_str (libx52_led_state state)
 Returns a string representation of the LED state. More...
 

Detailed Description

Functions, structures and enumerations for the Saitek X52 MFD & LED driver library.

This file contains the type, enum and function prototypes for the Saitek X52 driver library. These functions allow an application to connect to a supported X52/X52Pro joystick and control the MFD and LEDs.

Author
Nirenjan Krishnan (niren.nosp@m.jan@.nosp@m.niren.nosp@m.jan..nosp@m.org)