(BTStack) Cleanup

This commit is contained in:
twinaphex 2020-07-20 01:32:45 +02:00
parent 005a9c005e
commit 2efb1600a8
2 changed files with 32 additions and 32 deletions

View File

@ -1377,6 +1377,31 @@ static int16_t btstack_hid_joypad_button(void *data,
return 0;
}
static int16_t btstack_hid_joypad_axis(void *data,
unsigned port, uint32_t joyaxis)
{
btstack_hid_t *hid = (btstack_hid_t*)data;
if (AXIS_NEG_GET(joyaxis) < 4)
{
int16_t val = pad_connection_get_axis(
&hid->slots[port], port, AXIS_NEG_GET(joyaxis));
if (val < 0)
return val;
}
else if(AXIS_POS_GET(joyaxis) < 4)
{
int16_t val = pad_connection_get_axis(
&hid->slots[port], port, AXIS_POS_GET(joyaxis));
if (val > 0)
return val;
}
return 0;
}
static int16_t btstack_hid_joypad_state(
void *data,
rarch_joypad_info_t *joypad_info,
@ -1421,29 +1446,6 @@ static bool btstack_hid_joypad_rumble(void *data, unsigned pad,
return pad_connection_rumble(&hid->slots[pad], pad, effect, strength);
}
static int16_t btstack_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
{
btstack_hid_t *hid = (btstack_hid_t*)data;
int16_t val = 0;
if (AXIS_NEG_GET(joyaxis) < 4)
{
val += pad_connection_get_axis(&hid->slots[port], port, AXIS_NEG_GET(joyaxis));
if (val >= 0)
val = 0;
}
else if(AXIS_POS_GET(joyaxis) < 4)
{
val += pad_connection_get_axis(&hid->slots[port], port, AXIS_POS_GET(joyaxis));
if (val <= 0)
val = 0;
}
return val;
}
static void btstack_hid_free(const void *data)
{
btstack_hid_t *hid = (btstack_hid_t*)data;

View File

@ -484,26 +484,24 @@ static int16_t libusb_hid_joypad_axis(void *data,
unsigned port, uint32_t joyaxis)
{
libusb_hid_t *hid = (libusb_hid_t*)data;
int16_t val = 0;
if (AXIS_NEG_GET(joyaxis) < 4)
{
val = pad_connection_get_axis(&hid->slots[port],
int16_t val = pad_connection_get_axis(&hid->slots[port],
port, AXIS_NEG_GET(joyaxis));
if (val >= 0)
val = 0;
if (val < 0)
return val;
}
else if(AXIS_POS_GET(joyaxis) < 4)
{
val = pad_connection_get_axis(&hid->slots[port],
int16_t val = pad_connection_get_axis(&hid->slots[port],
port, AXIS_POS_GET(joyaxis));
if (val <= 0)
val = 0;
if (val > 0)
return val;
}
return val;
return 0;
}
static int16_t libusb_hid_joypad_state(