mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
AnalogTrigger support in Java
Analog triggers now work in Java. Integration tests for analog triggers are included. A message in the C++ analog trigger IT was fixed. Change-Id: I50007c6901b8391d32c0e81becdbe18e48a7840f
This commit is contained in:
@@ -91,5 +91,5 @@ TEST_F(AnalogLoopTest, AnalogTriggerCounterWorks) {
|
||||
}
|
||||
|
||||
// The counter should be 50
|
||||
EXPECT_EQ(50, counter.Get()) << "Analog trigger counter did not count 100 ticks";
|
||||
EXPECT_EQ(50, counter.Get()) << "Analog trigger counter did not count 50 ticks";
|
||||
}
|
||||
|
||||
@@ -50,19 +50,18 @@ public class AnalogTrigger {
|
||||
|
||||
/**
|
||||
* Initialize an analog trigger from a channel.
|
||||
*
|
||||
*
|
||||
* @param channel
|
||||
* the port to use for the analog trigger
|
||||
*/
|
||||
protected void initTrigger(final int channel) {
|
||||
ByteBuffer port_pointer = AnalogJNI.getPort((byte) channel);
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer index = IntBuffer.allocate(1);
|
||||
// XXX: Uncomment when analog has been fixed
|
||||
// m_port = HALLibrary
|
||||
// .initializeAnalogTrigger(port_pointer, index, status);
|
||||
//HALUtil.checkStatus(status);
|
||||
//m_index = index.get(0);
|
||||
IntBuffer index = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
|
||||
m_port = AnalogJNI.initializeAnalogTrigger(port_pointer, index, status);
|
||||
HALUtil.checkStatus(status);
|
||||
m_index = index.get(0);
|
||||
|
||||
UsageReporting.report(tResourceType.kResourceType_AnalogTrigger, channel);
|
||||
}
|
||||
@@ -93,7 +92,7 @@ public class AnalogTrigger {
|
||||
* Release the resources used by this object
|
||||
*/
|
||||
public void free() {
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
AnalogJNI.cleanAnalogTrigger(m_port, status);
|
||||
HALUtil.checkStatus(status);
|
||||
m_port = null;
|
||||
@@ -113,7 +112,7 @@ public class AnalogTrigger {
|
||||
if (lower > upper) {
|
||||
throw new BoundaryException("Lower bound is greater than upper");
|
||||
}
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
AnalogJNI.setAnalogTriggerLimitsRaw(m_port, lower, upper, status);
|
||||
HALUtil.checkStatus(status);
|
||||
}
|
||||
@@ -132,9 +131,7 @@ public class AnalogTrigger {
|
||||
throw new BoundaryException(
|
||||
"Lower bound is greater than upper bound");
|
||||
}
|
||||
// TODO: This depends on the averaged setting. Only raw values will work
|
||||
// as is.
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
AnalogJNI.setAnalogTriggerLimitsVoltage(m_port, (float) lower,
|
||||
(float) upper, status);
|
||||
HALUtil.checkStatus(status);
|
||||
@@ -149,7 +146,7 @@ public class AnalogTrigger {
|
||||
* true to use an averaged value, false otherwise
|
||||
*/
|
||||
public void setAveraged(boolean useAveragedValue) {
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
AnalogJNI.setAnalogTriggerAveraged(m_port,
|
||||
(byte) (useAveragedValue ? 1 : 0), status);
|
||||
HALUtil.checkStatus(status);
|
||||
@@ -165,7 +162,7 @@ public class AnalogTrigger {
|
||||
* true to use a filterd value, false otherwise
|
||||
*/
|
||||
public void setFiltered(boolean useFilteredValue) {
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
AnalogJNI.setAnalogTriggerFiltered(m_port,
|
||||
(byte) (useFilteredValue ? 1 : 0), status);
|
||||
HALUtil.checkStatus(status);
|
||||
@@ -188,7 +185,7 @@ public class AnalogTrigger {
|
||||
* @return The InWindow output of the analog trigger.
|
||||
*/
|
||||
public boolean getInWindow() {
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
byte value = AnalogJNI.getAnalogTriggerInWindow(m_port, status);
|
||||
HALUtil.checkStatus(status);
|
||||
return value != 0;
|
||||
@@ -202,7 +199,7 @@ public class AnalogTrigger {
|
||||
* @return The TriggerState output of the analog trigger.
|
||||
*/
|
||||
public boolean getTriggerState() {
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
byte value = AnalogJNI.getAnalogTriggerTriggerState(m_port, status);
|
||||
HALUtil.checkStatus(status);
|
||||
return value != 0;
|
||||
|
||||
@@ -26,11 +26,11 @@ import edu.wpi.first.wpilibj.test.TestBench;
|
||||
*/
|
||||
public class AnalogCrossConnectTest extends AbstractComsSetup {
|
||||
private static final Logger logger = Logger.getLogger(AnalogCrossConnectTest.class.getName());
|
||||
|
||||
|
||||
private static AnalogCrossConnectFixture analogIO;
|
||||
|
||||
static final double kDelayTime = 0.05;
|
||||
|
||||
|
||||
static final double kDelayTime = 0.01;
|
||||
|
||||
@Override
|
||||
protected Logger getClassLogger() {
|
||||
return logger;
|
||||
@@ -72,11 +72,82 @@ public class AnalogCrossConnectTest extends AbstractComsSetup {
|
||||
public void testAnalogOuput() {
|
||||
for(int i = 0; i < 50; i++) {
|
||||
analogIO.getOutput().setVoltage(i / 10.0f);
|
||||
Timer.delay(kDelayTime);
|
||||
assertEquals(analogIO.getOutput().getVoltage(), analogIO.getInput().getVoltage(), 0.01);
|
||||
Timer.delay(kDelayTime);
|
||||
assertEquals(analogIO.getOutput().getVoltage(), analogIO.getInput().getVoltage(), 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAnalogTriggerBelowWindow() {
|
||||
// Given
|
||||
AnalogTrigger trigger = new AnalogTrigger(analogIO.getInput());
|
||||
trigger.setLimitsVoltage(2.0f, 3.0f);
|
||||
|
||||
// When the output voltage is than less the lower limit
|
||||
analogIO.getOutput().setVoltage(1.0f);
|
||||
Timer.delay(kDelayTime);
|
||||
|
||||
// Then the analog trigger is not in the window and the trigger state is off
|
||||
assertFalse("Analog trigger is in the window (2V, 3V)", trigger.getInWindow());
|
||||
assertFalse("Analog trigger is on", trigger.getTriggerState());
|
||||
|
||||
trigger.free();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnalogTriggerInWindow() {
|
||||
// Given
|
||||
AnalogTrigger trigger = new AnalogTrigger(analogIO.getInput());
|
||||
trigger.setLimitsVoltage(2.0f, 3.0f);
|
||||
|
||||
// When the output voltage is within the lower and upper limits
|
||||
analogIO.getOutput().setVoltage(2.5f);
|
||||
Timer.delay(kDelayTime);
|
||||
|
||||
// Then the analog trigger is in the window and the trigger state is off
|
||||
assertTrue("Analog trigger is not in the window (2V, 3V)", trigger.getInWindow());
|
||||
assertFalse("Analog trigger is on", trigger.getTriggerState());
|
||||
|
||||
trigger.free();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnalogTriggerAboveWindow() {
|
||||
// Given
|
||||
AnalogTrigger trigger = new AnalogTrigger(analogIO.getInput());
|
||||
trigger.setLimitsVoltage(2.0f, 3.0f);
|
||||
|
||||
// When the output voltage is greater than the upper limit
|
||||
analogIO.getOutput().setVoltage(4.0f);
|
||||
Timer.delay(kDelayTime);
|
||||
|
||||
// Then the analog trigger is not in the window and the trigger state is on
|
||||
assertFalse("Analog trigger is in the window (2V, 3V)", trigger.getInWindow());
|
||||
assertTrue("Analog trigger is not on", trigger.getTriggerState());
|
||||
|
||||
trigger.free();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnalogTriggerCounter() {
|
||||
// Given
|
||||
AnalogTrigger trigger = new AnalogTrigger(analogIO.getInput());
|
||||
trigger.setLimitsVoltage(2.0f, 3.0f);
|
||||
|
||||
Counter counter = new Counter(trigger);
|
||||
|
||||
// When the analog output is turned low and high 50 times
|
||||
for(int i = 0; i < 50; i++) {
|
||||
analogIO.getOutput().setVoltage(1.0);
|
||||
Timer.delay(kDelayTime);
|
||||
analogIO.getOutput().setVoltage(4.0);
|
||||
Timer.delay(kDelayTime);
|
||||
}
|
||||
|
||||
// Then the counter should be at 50
|
||||
assertEquals("Analog trigger counter did not count 50 ticks", 50, counter.get());
|
||||
}
|
||||
|
||||
@Test(expected=RuntimeException.class)
|
||||
public void testRuntimeExceptionOnInvalidAccumulatorPort(){
|
||||
analogIO.getInput().getAccumulatorCount();
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
TLogLevel analogJNILogLevel = logWARNING;
|
||||
|
||||
#define ANALOGJNI_LOG(level) \
|
||||
if (level > analogJNILogLevel) ; \
|
||||
else Log().Get(level)
|
||||
if (level > analogJNILogLevel) ; \
|
||||
else Log().Get(level)
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_AnalogJNI
|
||||
@@ -430,7 +430,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator
|
||||
* Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter
|
||||
(JNIEnv *env, jclass, jobject id, jint center, jobject status)
|
||||
(JNIEnv * env, jclass, jobject id, jint center, jobject status)
|
||||
{
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId;
|
||||
@@ -447,7 +447,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCe
|
||||
* Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband
|
||||
(JNIEnv *env, jclass, jobject id, jint deadband, jobject status)
|
||||
(JNIEnv * env, jclass, jobject id, jint deadband, jobject status)
|
||||
{
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId;
|
||||
@@ -463,7 +463,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDe
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue
|
||||
(JNIEnv *env, jclass, jobject id, jobject status)
|
||||
(JNIEnv * env, jclass, jobject id, jobject status)
|
||||
{
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId;
|
||||
@@ -482,7 +482,7 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorV
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount
|
||||
(JNIEnv *env, jclass, jobject id, jobject status)
|
||||
(JNIEnv * env, jclass, jobject id, jobject status)
|
||||
{
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId;
|
||||
@@ -522,9 +522,23 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOu
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger
|
||||
(JNIEnv *, jclass, jobject, jobject , jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jobject index, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId;
|
||||
|
||||
jint * indexPtr = (jint*)env->GetDirectBufferAddress(index);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Index Ptr = " << indexPtr;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
void ** analogTriggerPtr = new void *;
|
||||
*analogTriggerPtr = initializeAnalogTrigger(*javaId, (uint32_t *)indexPtr, statusPtr);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
|
||||
ANALOGJNI_LOG(logDEBUG) << "AnalogTrigger Ptr = " << *analogTriggerPtr;
|
||||
|
||||
return env->NewDirectByteBuffer(analogTriggerPtr, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -533,9 +547,17 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAna
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger
|
||||
(JNIEnv *, jclass, jobject, jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
cleanAnalogTrigger( *javaId, statusPtr );
|
||||
|
||||
delete javaId;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -544,9 +566,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigg
|
||||
* Signature: (Ljava/nio/ByteBuffer;IILjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw
|
||||
(JNIEnv *, jclass, jobject, jint, jint, jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jint lower, jint upper, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
setAnalogTriggerLimitsRaw( *javaId, lower, upper, statusPtr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -555,9 +583,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTrigger
|
||||
* Signature: (Ljava/nio/ByteBuffer;DDLjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage
|
||||
(JNIEnv *, jclass, jobject, jdouble, jdouble, jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jdouble lower, jdouble upper, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
setAnalogTriggerLimitsVoltage( *javaId, lower, upper, statusPtr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -566,9 +600,14 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTrigger
|
||||
* Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged
|
||||
(JNIEnv *, jclass, jobject, jbyte, jobject)
|
||||
{
|
||||
assert(false);
|
||||
(JNIEnv * env, jclass, jobject id, jbyte averaged, jobject status){
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
setAnalogTriggerAveraged( *javaId, averaged, statusPtr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -577,9 +616,14 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTrigger
|
||||
* Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered
|
||||
(JNIEnv *, jclass, jobject, jbyte, jobject)
|
||||
{
|
||||
assert(false);
|
||||
(JNIEnv * env, jclass, jobject id, jbyte filtered, jobject status){
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
setAnalogTriggerFiltered( *javaId, filtered, statusPtr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -588,9 +632,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTrigger
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow
|
||||
(JNIEnv *, jclass, jobject, jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
return getAnalogTriggerInWindow( *javaId, statusPtr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -599,10 +649,15 @@ JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTrigge
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState
|
||||
(JNIEnv *, jclass, jobject, jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
return getAnalogTriggerTriggerState( *javaId, statusPtr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -611,8 +666,13 @@ JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTrigge
|
||||
* Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)B
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerOutput
|
||||
(JNIEnv *, jclass, jobject, jint, jobject)
|
||||
(JNIEnv * env, jclass, jobject id, jint type, jobject status)
|
||||
{
|
||||
assert(false);
|
||||
void ** javaId = (void**)env->GetDirectBufferAddress(id);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Ptr = " << *javaId;
|
||||
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
|
||||
|
||||
return getAnalogTriggerOutput( *javaId, (AnalogTriggerType)type, statusPtr )? 1 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user