Initial for Condor Simulator
Dependents: USBJoystick_2 USBJoystick_NEW
Fork of USBJoystick by
Diff: USBJoystick.cpp
- Revision:
- 5:fa0a30d0ef3d
- Parent:
- 4:71835900760f
- Child:
- 6:cefcdf03ca0e
--- a/USBJoystick.cpp Sat Sep 29 09:27:44 2018 +0000 +++ b/USBJoystick.cpp Sun Oct 07 14:37:43 2018 +0000 @@ -27,7 +27,7 @@ #include "stdint.h" #include "USBJoystick.h" -bool USBJoystick::update(uint16_t x, uint16_t y, uint16_t b, uint16_t f, uint16_t r, uint16_t t, uint8_t hat, uint32_t buttons) +bool USBJoystick::update(int16_t x, int16_t y, int16_t b, int16_t f, int16_t r, int16_t t, uint8_t hat, uint32_t buttons) { _x = x; @@ -96,32 +96,32 @@ return send(&report); } -bool USBJoystick::move(uint16_t x, uint16_t y) +bool USBJoystick::move(int16_t x, int16_t y) { _x = x; _y = y; return update(); } -bool USBJoystick::diveBreak(uint16_t b) +bool USBJoystick::diveBreak(int16_t b) { _b = b; return update(); } -bool USBJoystick::flaps(uint16_t f) +bool USBJoystick::flaps(int16_t f) { _f = f; return update(); } -bool USBJoystick::rudder(uint16_t r) +bool USBJoystick::rudder(int16_t r) { _r = r; return update(); } -bool USBJoystick::throttle(uint16_t t) +bool USBJoystick::throttle(int16_t t) { _t = t; return update(); @@ -173,8 +173,8 @@ // USAGE(1), 0x34, // Ry // USAGE(1), 0x35, // Rz (Rudder on Usage Page 0x02) // USAGE(1), 0x36 // Slider (Throttle on Usage Page 0x02) - LOGICAL_MINIMUM(1), 0x00, // 0 - LOGICAL_MAXIMUM(2), 0xff, 0xff, // 65536 + LOGICAL_MINIMUM(2), 0x01, 0x80, // -32767 ; war 0, 0x00 + LOGICAL_MAXIMUM(2), 0xff, 0x7f, // 32767 ; war 65536, 0xff 0xff REPORT_SIZE(1), 0x10, REPORT_COUNT(1), 0x04, INPUT(1), 0x02, // Data, Variable, Absolute