mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Implement DriverStation::GetBatteryVoltage
Make the GetBatteryVoltage method work using the new tPower header Change-Id: If504f8a46f3f7f737f0b729b72fc6b5da0d29ff9
This commit is contained in:
99
wpilibj/wpilibJavaJNI/lib/PowerJNI.cpp
Normal file
99
wpilibj/wpilibJavaJNI/lib/PowerJNI.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
#include <jni.h>
|
||||
#include "edu_wpi_first_wpilibj_hal_PowerJNI.h"
|
||||
#include "HAL/Power.hpp"
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getVinVoltage
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getVinVoltage(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getVinCurrent
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getVinCurrent(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getUserVoltage6V
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getUserVoltage6V(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getUserCurrent6V
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getUserCurrent6V(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getUserVoltage5V
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getUserVoltage5V(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getUserCurrent5V
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getUserCurrent5V(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getUserVoltage3V3
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getUserVoltage3V3(statusPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_PowerJNI
|
||||
* Method: getUserCurrent3V3
|
||||
* Signature: (Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
return getUserCurrent3V3(statusPtr);
|
||||
}
|
||||
Reference in New Issue
Block a user