2016-05-20 17:30:37 -07: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 "HAL/HAL.hpp"
|
2015-11-01 09:11:52 -08:00
|
|
|
#include "HALUtil.h"
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "Log.hpp"
|
|
|
|
|
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jlong JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor(
|
|
|
|
|
JNIEnv *env, jclass, jbyte module) {
|
|
|
|
|
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
|
|
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule(
|
|
|
|
|
JNIEnv *env, jclass, jbyte module) {
|
|
|
|
|
return checkCompressorModule(module);
|
2014-06-12 12:43:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setClosedLoopControl(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer, jboolean value) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getClosedLoopControl(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getPressureSwitch(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jfloat JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults(
|
|
|
|
|
JNIEnv *env, jclass, jlong pcm_pointer) {
|
|
|
|
|
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"
|