1 #ifndef ORG_EEROS_HAL_JOYSTICK_HPP_
2 #define ORG_EEROS_HAL_JOYSTICK_HPP_
6 #include <linux/joystick.h>
8 #define JOYSTICK_BUTTON_COUNT (16)
9 #define JOYSTICK_AXIS_COUNT (8)
28 virtual bool open(
const char* device);
31 virtual void on_event(std::function<
void(
struct js_event)> action);
32 virtual void on_button(std::function<
void(
int,
bool)> action);
33 virtual void on_axis(std::function<
void(
int,
double)> action);
35 virtual std::string
name();
42 std::function<void(struct js_event)> event_action;
43 std::function<void(int, bool)> button_action;
44 std::function<void(int, double)> axis_action;
49 #endif // ORG_EEROS_HAL_JOYSTICK_HPP_
Definition: Joystick.hpp:13
virtual void on_axis(std::function< void(int, double)> action)
Definition: Joystick.cpp:72
#define JOYSTICK_AXIS_COUNT
Definition: Joystick.hpp:9
double axis[JOYSTICK_AXIS_COUNT]
Definition: Joystick.hpp:15
virtual void on_event(std::function< void(struct js_event)> action)
Definition: Joystick.cpp:62
virtual void close()
Definition: Joystick.cpp:41
virtual bool open(const char *device)
Definition: Joystick.cpp:35
bool button_state[JOYSTICK_BUTTON_COUNT]
Definition: Joystick.hpp:16
virtual void loop()
Definition: Joystick.cpp:78
virtual void on_button(std::function< void(int, bool)> action)
Definition: Joystick.cpp:67
~Joystick()
Definition: Joystick.cpp:30
bool button_down[JOYSTICK_BUTTON_COUNT]
Definition: Joystick.hpp:18
Joystick()
Definition: Joystick.cpp:11
Definition: Joystick.hpp:23
virtual std::string name()
Definition: Joystick.cpp:46
JoystickState current
Definition: Joystick.hpp:38
static const double axis_max
Definition: Joystick.hpp:20
JoystickState last
Definition: Joystick.hpp:37
#define JOYSTICK_BUTTON_COUNT
Definition: Joystick.hpp:8
bool button_up[JOYSTICK_BUTTON_COUNT]
Definition: Joystick.hpp:17