Thick bindings for Linux joystick driver.
Instantiate Linux_Joystick
package with two generic type parameters.
The first type, Axis_Type
should represent the available axes of the specific joystick and the second type, Button_Type
should represent buttons.
It is possible to use any scalar, as long as it is limited by 8 bits. For example
type Common_Axis_Type is range 0..20;
type Common_Button_Type is range 0..20;
package LJS is new Linux_Joystick(Button_Type => Common_Button_Type,
Axis_Type => Common_Axis_Type);
type Logiteck_Extreme_3D_Pro_Axis_Type is
(STICK_X, STICK_Y, STICK_Z, THROTTLE, HAT_X, HAT_Y);
type Logiteck_Extreme_3D_Pro_Button_Type is
(BUTTON_01, BUTTON_02, BUTTON_03, BUTTON_04,
BUTTON_05, BUTTON_06, BUTTON_07, BUTTON_08,
BUTTON_09, BUTTON_10, BUTTON_11, BUTTON_12);
package L3D is new Linux_Joystick(Button_Type => Logiteck_Extreme_3D_Pro_Button_Type,
Axis_Type => Logiteck_Extreme_3D_Pro_Axis_Type);
The bindings were successfully tested on Ubuntu with Steam's version of the xpad
driver.
type XBOX_One_Axis_Type is
(LEFT_STICK_X, LEFT_STICK_Y, LEFT_TRIGGER,
RIGHT_STICK_X, RIGHT_STICK_Y, RIGHT_TRIGGER,
DIRECTIONAL_PAD_X, DIRECTIONAL_PAD_Y);
type XBOX_One_Button_Type is
(BUTTON_A, BUTTON_B, BUTTON_X, BUTTON_Y,
LEFT_BUMPER, RIGHT_BUMBER,
BUTTON_SELECT, BUTTON_START, BUTTON_XBOX,
LEFT_THUMB, RIGHT_THUMB);
package LX1 is new Linux_Joystick(Button_Type => XBOX_One_Button_Type,
Axis_Type => XBOX_One_Axis_Type);
A main.adb file is provided with an example of how to use the bindings. It has similar functionality as the jtest
linux tool.
gprbuild -Pada_joystick.gpr --create-missing-dirs
./bin/main