Add new joystick features

Axis counts other than six and POVs are both present in C++ and Java now

Add dynamic joystick axis counts, up to 12

Change-Id: Ieade5e61a89df822df8702cb32326e4635558778

Add support for POVs in C++

Change-Id: I12dc0fcaca605a256ddcf990eebde45767229171

Make POVs work in Java

Change-Id: Ie2d98adb416c1930f058bdd21c3e7d26289df503
This commit is contained in:
Thomas Clark
2014-10-17 14:46:25 -04:00
parent 08c8723174
commit 8a541a67ca
16 changed files with 199 additions and 74 deletions

View File

@@ -293,7 +293,7 @@ JNIEXPORT jshortArray JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetwor
(JNIEnv * env, jclass, jbyte joystickNum)
{
HALJoystickAxes axes;
HALGetJoystickAxes(joystickNum, &axes, 6);
HALGetJoystickAxes(joystickNum, &axes);
jshortArray axesArray = env->NewShortArray(axes.count);
env->SetShortArrayRegion(axesArray, 0, axes.count, axes.axes);
@@ -301,6 +301,23 @@ JNIEXPORT jshortArray JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetwor
return axesArray;
}
/*
* Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary
* Method: HALGetJoystickPOVs
* Signature: (B)[S
*/
JNIEXPORT jshortArray JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALGetJoystickPOVs
(JNIEnv * env, jclass, jbyte joystickNum)
{
HALJoystickPOVs povs;
HALGetJoystickPOVs(joystickNum, &povs);
jshortArray povsArray = env->NewShortArray(povs.count);
env->SetShortArrayRegion(povsArray, 0, povs.count, povs.povs);
return povsArray;
}
/*
* Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary
* Method: HALGetJoystickButtons