USB Joystick library, modified to work as a 6 DOF joystick.
Fork of USBJoystick by
Diff: USBJoystick.h
- Revision:
- 2:1549541d3b4b
- Parent:
- 1:8b5f213b169f
- Child:
- 3:f8be03f31e6c
diff -r 8b5f213b169f -r 1549541d3b4b USBJoystick.h --- a/USBJoystick.h Fri Jan 13 05:37:07 2017 +0000 +++ b/USBJoystick.h Fri Jan 13 07:09:28 2017 +0000 @@ -109,30 +109,14 @@ * @param hat hat state 0 (up), 1 (right, 2 (down), 3 (left) or 4 (neutral) * @returns true if there is no error, false otherwise */ - bool update(int16_t t, int16_t r, int16_t x, int16_t y, uint32_t buttons, uint8_t hat); + bool update(int16_t x, int16_t y, int16_t z, int16_t rx, int16_t ry, int16_t rz, uint32_t buttons, uint8_t hat); /** * Write state of the joystick * * @returns true if there is no error, false otherwise */ - bool update(); - - /** - * Move the throttle position - * - * @param t throttle position - * @returns true if there is no error, false otherwise - */ - bool throttle(int16_t t); - - /** - * Move the rudder position - * - * @param r rudder position - * @returns true if there is no error, false otherwise - */ - bool rudder(int16_t r); + bool update(); /** * Move the cursor to (x, y) @@ -141,7 +125,7 @@ * @param y-axis position * @returns true if there is no error, false otherwise */ - bool move(int16_t x, int16_t y); + bool move(int16_t x, int16_t y, int16_t z, int16_t rx, int16_t ry, int16_t rz); /** * Press one or several buttons @@ -167,13 +151,15 @@ virtual uint8_t * reportDesc(); private: - int16_t _t; - int16_t _r; - int16_t _x; - int16_t _y; + int16_t _x; + int16_t _y; + int16_t _z; + int16_t _rx; + int16_t _ry; + int16_t _rz; uint32_t _buttons; uint8_t _hat; - + void _init(); };