2016-01-02 03:02:34 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2014-06-12 12:43:03 -04:00
|
|
|
#include "Log.hpp"
|
|
|
|
|
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
|
|
|
|
|
#include "HAL/HAL.hpp"
|
2015-11-01 09:11:52 -08:00
|
|
|
#include "HALUtil.h"
|
2014-06-12 12:43:03 -04:00
|
|
|
|
2015-11-01 09:11:52 -08:00
|
|
|
extern "C" {
|
2014-06-12 12:43:03 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: initializeCompressor
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (B)J
|
2014-06-12 12:43:03 -04:00
|
|
|
*/
|
2015-11-01 09:11:52 -08:00
|
|
|
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor
|
2014-06-12 12:43:03 -04:00
|
|
|
(JNIEnv *env, jclass, jbyte module)
|
|
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
void* pcm = initializeCompressor(module);
|
|
|
|
|
return (jlong)pcm;
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-06-12 12:43:03 -04:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-06-12 12:43:03 -04:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressor((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: setClosedLoopControl
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (JZ)V
|
2014-06-12 12:43:03 -04:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setClosedLoopControl
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer, jboolean value)
|
2014-06-12 12:43:03 -04:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
setClosedLoopControl((void*)pcm_pointer, value, &status);
|
|
|
|
|
CheckStatus(env, status);
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getClosedLoopControl
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-06-12 12:43:03 -04:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getClosedLoopControl
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-06-12 12:43:03 -04:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getClosedLoopControl((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getPressureSwitch
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-06-12 12:43:03 -04:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getPressureSwitch
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-06-12 12:43:03 -04:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getPressureSwitch((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorCurrent
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)F
|
2014-06-12 12:43:03 -04:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-06-12 12:43:03 -04:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
float val = getCompressorCurrent((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
2014-12-26 19:40:39 -05:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorCurrentTooHighFault
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressorCurrentTooHighFault((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorCurrentTooHighStickyFault
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressorCurrentTooHighStickyFault((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorShortedStickyFault
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressorShortedStickyFault((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorShortedFault
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressorShortedFault((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorNotConnectedStickyFault
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressorNotConnectedStickyFault((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: getCompressorNotConnectedFault
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)Z
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = getCompressorNotConnectedFault((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
|
|
|
|
|
* Method: clearAllPCMStickyFaults
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)V
|
2014-12-26 19:40:39 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv *env, jclass, jlong pcm_pointer)
|
2014-12-26 19:40:39 -05:00
|
|
|
{
|
2015-11-01 09:11:52 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
clearAllPCMStickyFaults((void*)pcm_pointer, &status);
|
|
|
|
|
CheckStatus(env, status);
|
2014-12-26 19:40:39 -05:00
|
|
|
}
|
2015-11-01 09:11:52 -08:00
|
|
|
|
|
|
|
|
} // extern "C"
|