Add a method to detect the HAL runtime version (#228)

This commit is contained in:
Thad House
2016-09-13 21:21:57 -07:00
committed by Peter Johnson
parent 1416fb8f67
commit 2ecb939b35
4 changed files with 28 additions and 0 deletions

View File

@@ -38,6 +38,11 @@
namespace HALUsageReporting = nUsageReporting;
enum HAL_RuntimeType : int32_t {
HAL_Athena,
HAL_Mock
};
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,6 +54,7 @@ int32_t HAL_GetFPGAVersion(int32_t* status);
int64_t HAL_GetFPGARevision(int32_t* status);
uint64_t HAL_GetFPGATime(int32_t* status);
HAL_RuntimeType HAL_GetRuntimeType();
HAL_Bool HAL_GetFPGAButton(int32_t* status);
HAL_Bool HAL_GetSystemActive(int32_t* status);

View File

@@ -164,6 +164,13 @@ const char* HAL_GetErrorMessage(int32_t code) {
}
}
/**
* Returns the runtime type of this HAL
*/
HAL_RuntimeType HAL_GetRuntimeType() {
return HAL_Athena;
}
/**
* Return the FPGA Version number.
* For now, expect this to be competition year.

View File

@@ -429,6 +429,19 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime(JNIEnv *env, jclass) {
return returnValue;
}
/*
* Class: edu_wpi_first_wpilibj_hal_HALUtil
* Method: getHALRuntimeType
* Signature: ()I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType(JNIEnv *env, jclass) {
// HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALRuntimeType";
jint returnValue = HAL_GetRuntimeType();
// HALUTIL_LOG(logDEBUG) << "RuntimeType = " << returnValue;
return returnValue;
}
/*
* Class: edu_wpi_first_wpilibj_hal_HALUtil
* Method: getFPGAButton

View File

@@ -23,6 +23,8 @@ public class HALUtil extends JNIWrapper {
public static native int getFPGARevision();
public static native long getFPGATime();
public static native int getHALRuntimeType();
public static native boolean getFPGAButton();