[hal] JNI setDIO: use a boolean and not a short (#3469)

This commit is contained in:
Thad House
2021-07-08 21:42:31 -07:00
committed by GitHub
parent 9d68d95825
commit 6ddef1cca6
3 changed files with 4 additions and 5 deletions

View File

@@ -14,8 +14,7 @@ public class DIOJNI extends JNIWrapper {
public static native void setDIOSimDevice(int handle, int device);
// TODO(Thad): Switch this to use boolean
public static native void setDIO(int dioPortHandle, short value);
public static native void setDIO(int dioPortHandle, boolean value);
public static native void setDIODirection(int dioPortHandle, boolean input);

View File

@@ -75,11 +75,11 @@ Java_edu_wpi_first_hal_DIOJNI_setDIOSimDevice
/*
* Class: edu_wpi_first_hal_DIOJNI
* Method: setDIO
* Signature: (IS)V
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_DIOJNI_setDIO
(JNIEnv* env, jclass, jint id, jshort value)
(JNIEnv* env, jclass, jint id, jboolean value)
{
int32_t status = 0;
HAL_SetDIO((HAL_DigitalHandle)id, value, &status);

View File

@@ -57,7 +57,7 @@ public class DigitalOutput extends DigitalSource implements Sendable {
* @param value true is on, off is false
*/
public void set(boolean value) {
DIOJNI.setDIO(m_handle, (short) (value ? 1 : 0));
DIOJNI.setDIO(m_handle, value);
}
/**