mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Switches HAL to fixed length signed integers, and adds our own HAL_Bool Type (#155)
* Switches HAL to fixed length signed integers, and adds our own HAL_Bool type * Replaces HAL Floats with Doubles Doubles are just as fast as floats with optimizations turned on, so switches to all doubles. All made doubles for consistency. * Prepends HAL/ to HAL include files. Also fixes some range errors
This commit is contained in:
committed by
Peter Johnson
parent
4a98e68815
commit
b51e85ae26
@@ -295,12 +295,12 @@ public class AnalogInput extends SensorBase implements PIDSource, LiveWindowSend
|
||||
ByteBuffer value = ByteBuffer.allocateDirect(8);
|
||||
// set the byte order
|
||||
value.order(ByteOrder.LITTLE_ENDIAN);
|
||||
ByteBuffer count = ByteBuffer.allocateDirect(4);
|
||||
ByteBuffer count = ByteBuffer.allocateDirect(8);
|
||||
// set the byte order
|
||||
count.order(ByteOrder.LITTLE_ENDIAN);
|
||||
AnalogJNI.getAccumulatorOutput(m_port, value.asLongBuffer(), count.asIntBuffer());
|
||||
AnalogJNI.getAccumulatorOutput(m_port, value.asLongBuffer(), count.asLongBuffer());
|
||||
result.value = value.asLongBuffer().get(0) + m_accumulatorOffset;
|
||||
result.count = count.asIntBuffer().get(0);
|
||||
result.count = count.asLongBuffer().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -365,11 +365,11 @@ public class SPI extends SensorBase {
|
||||
ByteBuffer value = ByteBuffer.allocateDirect(8);
|
||||
// set the byte order
|
||||
value.order(ByteOrder.LITTLE_ENDIAN);
|
||||
ByteBuffer count = ByteBuffer.allocateDirect(4);
|
||||
ByteBuffer count = ByteBuffer.allocateDirect(8);
|
||||
// set the byte order
|
||||
count.order(ByteOrder.LITTLE_ENDIAN);
|
||||
SPIJNI.spiGetAccumulatorOutput(m_port, value.asLongBuffer(), count.asIntBuffer());
|
||||
SPIJNI.spiGetAccumulatorOutput(m_port, value.asLongBuffer(), count.asLongBuffer());
|
||||
result.value = value.asLongBuffer().get(0);
|
||||
result.count = count.asIntBuffer().get(0);
|
||||
result.count = count.asLongBuffer().get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class AnalogJNI extends JNIWrapper {
|
||||
public static native int getAccumulatorCount(int analogPortHandle);
|
||||
|
||||
public static native void getAccumulatorOutput(int analogPortHandle, LongBuffer value,
|
||||
IntBuffer count);
|
||||
LongBuffer count);
|
||||
|
||||
public static native int initializeAnalogTrigger(int analogInputHandle, IntBuffer index);
|
||||
|
||||
|
||||
@@ -54,5 +54,5 @@ public class SPIJNI extends JNIWrapper {
|
||||
public static native double spiGetAccumulatorAverage(byte port);
|
||||
|
||||
public static native void spiGetAccumulatorOutput(byte port, LongBuffer value,
|
||||
IntBuffer count);
|
||||
LongBuffer count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user