mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Add a method to detect the HAL runtime version (#228)
This commit is contained in:
committed by
Peter Johnson
parent
1416fb8f67
commit
2ecb939b35
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user