mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
The HAL functions often call NI functions that may expect status to be initialized on entry. Java does not guarantee direct pointer allocation memory to be initialized, although that may have been occurring by accident. Change-Id: I5e3a553f3a7be8de3716ccfc13e6ca1cb4f2a552
127 lines
3.4 KiB
C++
127 lines
3.4 KiB
C++
#include "edu_wpi_first_wpilibj_hal_PDPJNI.h"
|
|
#include "HAL/PDP.hpp"
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: getPDPTemperature
|
|
* Signature: (Ljava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP
|
|
(JNIEnv *, jclass, jint module)
|
|
{
|
|
initializePDP(module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: getPDPTemperature
|
|
* Signature: (Ljava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
return getPDPTemperature(status_ptr, module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: getPDPVoltage
|
|
* Signature: (Ljava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
return getPDPVoltage(status_ptr, module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: getPDPChannelCurrent
|
|
* Signature: (BLjava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent
|
|
(JNIEnv *env, jclass, jbyte channel, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
return getPDPChannelCurrent(channel, status_ptr, module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: getPDPTotalCurrent
|
|
* Signature: (BLjava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
return getPDPTotalCurrent(status_ptr, module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: getPDPTotalPower
|
|
* Signature: (BLjava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
return getPDPTotalPower(status_ptr, module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: resetPDPTotalEnergy
|
|
* Signature: (BLjava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
return getPDPTotalEnergy(status_ptr, module);
|
|
}
|
|
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: resetPDPTotalEnergy
|
|
* Signature: (BLjava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
resetPDPTotalEnergy(status_ptr, module);
|
|
}
|
|
|
|
/*
|
|
* Class: edu_wpi_first_wpilibj_hal_PDPJNI
|
|
* Method: clearStickyFaults
|
|
* Signature: (BLjava/nio/IntBuffer;)D
|
|
*/
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_clearPDPStickyFaults
|
|
(JNIEnv *env, jclass, jobject status, jint module)
|
|
{
|
|
jint *status_ptr = (jint *)env->GetDirectBufferAddress(status);
|
|
|
|
*status_ptr = 0;
|
|
clearPDPStickyFaults(status_ptr, module);
|
|
}
|