mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Added Omar's changes to the compressor interface
Change-Id: Iff22b0eaa319065b06795b381c4d6072f8087da8
This commit is contained in:
@@ -1,115 +1,102 @@
|
||||
#include "Log.hpp"
|
||||
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
|
||||
#include "HAL/HAL.hpp"
|
||||
|
||||
typedef void *VoidPointer;
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: initializeCompressor
|
||||
* Signature: (B)Ljava/nio/ByteBuffer;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor
|
||||
(JNIEnv *env, jclass, jbyte module)
|
||||
{
|
||||
VoidPointer *pcm_pointer = new VoidPointer;
|
||||
*pcm_pointer = initializeCompressor(module);
|
||||
|
||||
return env->NewDirectByteBuffer(pcm_pointer, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: checkCompressorModule
|
||||
* Signature: (B)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule
|
||||
(JNIEnv *env, jclass, jbyte module)
|
||||
{
|
||||
return checkCompressorModule(module);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: setCompressor
|
||||
* Signature: (Ljava/nio/ByteBuffer;ZLjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setCompressor
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jboolean value, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
setCompressor(*pcm_pointer, value, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getCompressor
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getCompressor(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: setClosedLoopControl
|
||||
* Signature: (Ljava/nio/ByteBuffer;ZLjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setClosedLoopControl
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jboolean value, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
setClosedLoopControl(*pcm_pointer, value, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getClosedLoopControl
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getClosedLoopControl
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getClosedLoopControl(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getPressureSwitch
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getPressureSwitch
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getPressureSwitch(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getCompressorCurrent
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getCompressorCurrent(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
#include "Log.hpp"
|
||||
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
|
||||
#include "HAL/HAL.hpp"
|
||||
|
||||
typedef void *VoidPointer;
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: initializeCompressor
|
||||
* Signature: (B)Ljava/nio/ByteBuffer;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor
|
||||
(JNIEnv *env, jclass, jbyte module)
|
||||
{
|
||||
VoidPointer *pcm_pointer = new VoidPointer;
|
||||
*pcm_pointer = initializeCompressor(module);
|
||||
|
||||
return env->NewDirectByteBuffer(pcm_pointer, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: checkCompressorModule
|
||||
* Signature: (B)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule
|
||||
(JNIEnv *env, jclass, jbyte module)
|
||||
{
|
||||
return checkCompressorModule(module);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getCompressor
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getCompressor(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: setClosedLoopControl
|
||||
* Signature: (Ljava/nio/ByteBuffer;ZLjava/nio/IntBuffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setClosedLoopControl
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jboolean value, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
setClosedLoopControl(*pcm_pointer, value, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getClosedLoopControl
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getClosedLoopControl
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getClosedLoopControl(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getPressureSwitch
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getPressureSwitch
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getPressureSwitch(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
||||
* Method: getCompressorCurrent
|
||||
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent
|
||||
(JNIEnv *env, jclass, jobject pcm_pointer_object, jobject status)
|
||||
{
|
||||
VoidPointer *pcm_pointer = (VoidPointer *)env->GetDirectBufferAddress(pcm_pointer_object);
|
||||
jint *status_pointer = (jint *)env->GetDirectBufferAddress(status);
|
||||
|
||||
return getCompressorCurrent(*pcm_pointer, status_pointer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user