mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Merge "added PDP methods to javalib"
This commit is contained in:
@@ -59,4 +59,53 @@ public class PowerDistributionPanel extends SensorBase {
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current of all the channels
|
||||
*/
|
||||
public double getTotalCurrent(){
|
||||
ByteBuffer status = ByteBuffer.allocateDirect(4);
|
||||
status.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
double current = PDPJNI.getPDPTotalCurrent(status.asIntBuffer());
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the total power
|
||||
*/
|
||||
public double getTotalPower(){
|
||||
ByteBuffer status = ByteBuffer.allocateDirect(4);
|
||||
status.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
double power = PDPJNI.getPDPTotalPower(status.asIntBuffer());
|
||||
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
public double getTotalEnergy(){
|
||||
ByteBuffer status = ByteBuffer.allocateDirect(4);
|
||||
status.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
double energy = PDPJNI.getPDPTotalEnergy(status.asIntBuffer());
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
public void resetTotalEnergy(){
|
||||
ByteBuffer status = ByteBuffer.allocateDirect(4);
|
||||
status.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
PDPJNI.resetPDPTotalEnergy(status.asIntBuffer());
|
||||
}
|
||||
|
||||
public void clearStickyFaults(){
|
||||
ByteBuffer status = ByteBuffer.allocateDirect(4);
|
||||
status.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
PDPJNI.clearPDPStickyFaults(status.asIntBuffer());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,4 +7,9 @@ public class PDPJNI extends JNIWrapper {
|
||||
public static native double getPDPTemperature(IntBuffer status);
|
||||
public static native double getPDPVoltage(IntBuffer status);
|
||||
public static native double getPDPChannelCurrent(byte channel, IntBuffer status);
|
||||
}
|
||||
public static native double getPDPTotalCurrent(IntBuffer status);
|
||||
public static native double getPDPTotalPower(IntBuffer status);
|
||||
public static native double getPDPTotalEnergy(IntBuffer status);
|
||||
public static native void resetPDPTotalEnergy(IntBuffer status);
|
||||
public static native void clearPDPStickyFaults(IntBuffer status);
|
||||
}
|
||||
Reference in New Issue
Block a user