Some cleanup
This commit is contained in:
parent
e85ad43b95
commit
bf26c2912c
4 changed files with 25 additions and 42 deletions
4
TODO
4
TODO
|
@ -45,7 +45,9 @@ Stuff to do before 0.5 release:
|
|||
|
||||
* create dummy joystick, mouse and keyboard buttons so that the
|
||||
devices always act as they should, also figure out the exakt minimum
|
||||
requirements for each device.
|
||||
requirements for each device (i.e. if a device is a
|
||||
joystick/mouse/keyboard is determined if it as certain button or
|
||||
axis).
|
||||
|
||||
* add a way to not create a joystick/event device
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <string.h>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "helper.hpp"
|
||||
#include "firestorm_dual_controller.hpp"
|
||||
|
||||
// 044f:b312
|
||||
|
@ -115,15 +116,6 @@ FirestormDualController::~FirestormDualController()
|
|||
|
||||
void
|
||||
FirestormDualController::set_rumble(uint8_t left, uint8_t right)
|
||||
{
|
||||
if (is_vsb)
|
||||
set_rumble_vsb(left, right);
|
||||
else
|
||||
set_rumble_default(left, right);
|
||||
}
|
||||
|
||||
void
|
||||
FirestormDualController::set_rumble_vsb(uint8_t left, uint8_t right)
|
||||
{
|
||||
if (left_rumble != left ||
|
||||
right_rumble != right)
|
||||
|
@ -132,20 +124,10 @@ FirestormDualController::set_rumble_vsb(uint8_t left, uint8_t right)
|
|||
right_rumble = right;
|
||||
|
||||
char cmd[] = { left, right, 0x00, 0x00 };
|
||||
usb_control_msg(handle, 0x21, 0x09, 0x0200, 0x00, cmd, sizeof(cmd), 0);
|
||||
}
|
||||
}
|
||||
if (is_vsb)
|
||||
usb_control_msg(handle, 0x21, 0x09, 0x0200, 0x00, cmd, sizeof(cmd), 0);
|
||||
else
|
||||
|
||||
void
|
||||
FirestormDualController::set_rumble_default(uint8_t left, uint8_t right)
|
||||
{
|
||||
if (left_rumble != left ||
|
||||
right_rumble != right)
|
||||
{
|
||||
left_rumble = left;
|
||||
right_rumble = right;
|
||||
|
||||
char cmd[] = { left, right, 0x00, 0x00 };
|
||||
usb_control_msg(handle, 0x21, 0x09, 0x02, 0x00, cmd, sizeof(cmd), 0);
|
||||
}
|
||||
}
|
||||
|
@ -156,23 +138,6 @@ FirestormDualController::set_led(uint8_t status)
|
|||
// not supported
|
||||
}
|
||||
|
||||
// Change the sign
|
||||
inline int16_t negate_16(int16_t v)
|
||||
{
|
||||
if (v)
|
||||
return ~v;
|
||||
else
|
||||
return v;
|
||||
}
|
||||
|
||||
inline int16_t scale_8to16(int8_t a)
|
||||
{
|
||||
if (a > 0)
|
||||
return a * 32767 / 127;
|
||||
else
|
||||
return a * 32768 / 128;
|
||||
}
|
||||
|
||||
bool
|
||||
FirestormDualController::read(XboxGenericMsg& msg, bool verbose, int timeout)
|
||||
{
|
||||
|
|
|
@ -38,8 +38,6 @@ public:
|
|||
~FirestormDualController();
|
||||
|
||||
void set_rumble(uint8_t left, uint8_t right);
|
||||
void set_rumble_default(uint8_t left, uint8_t right);
|
||||
void set_rumble_vsb(uint8_t left, uint8_t right);
|
||||
void set_led(uint8_t status);
|
||||
|
||||
/** @param timeout timeout in msec, 0 means forever */
|
||||
|
|
|
@ -62,6 +62,24 @@ T clamp (const T& low, const T& v, const T& high)
|
|||
}
|
||||
} // namespace Math
|
||||
|
||||
|
||||
// Change the sign
|
||||
inline int16_t negate_16(int16_t v)
|
||||
{
|
||||
if (v)
|
||||
return ~v;
|
||||
else // v == 0
|
||||
return v;
|
||||
}
|
||||
|
||||
inline int16_t scale_8to16(int8_t a)
|
||||
{
|
||||
if (a > 0)
|
||||
return a * 32767 / 127;
|
||||
else
|
||||
return a * 32768 / 128;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Add table
Reference in a new issue