mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib, hal] Add support for getting faults and versions from power distribution (#3794)
This commit is contained in:
@@ -46,6 +46,7 @@ static JException canMessageNotFoundExCls;
|
||||
static JException canMessageNotAllowedExCls;
|
||||
static JException canNotInitializedExCls;
|
||||
static JException uncleanStatusExCls;
|
||||
static JClass powerDistributionVersionCls;
|
||||
static JClass pwmConfigDataResultCls;
|
||||
static JClass canStatusCls;
|
||||
static JClass matchInfoDataCls;
|
||||
@@ -56,6 +57,8 @@ static JClass baseStoreCls;
|
||||
static JClass revPHVersionCls;
|
||||
|
||||
static const JClassInit classes[] = {
|
||||
{"edu/wpi/first/hal/PowerDistributionVersion",
|
||||
&powerDistributionVersionCls},
|
||||
{"edu/wpi/first/hal/PWMConfigDataResult", &pwmConfigDataResultCls},
|
||||
{"edu/wpi/first/hal/can/CANStatus", &canStatusCls},
|
||||
{"edu/wpi/first/hal/MatchInfoData", &matchInfoDataCls},
|
||||
@@ -333,6 +336,21 @@ jobject CreateDMABaseStore(JNIEnv* env, jint valueType, jint index) {
|
||||
return env->NewObject(baseStoreCls, ctor, valueType, index);
|
||||
}
|
||||
|
||||
jobject CreatePowerDistributionVersion(JNIEnv* env, uint32_t firmwareMajor,
|
||||
uint32_t firmwareMinor,
|
||||
uint32_t firmwareFix,
|
||||
uint32_t hardwareMinor,
|
||||
uint32_t hardwareMajor,
|
||||
uint32_t uniqueId) {
|
||||
static jmethodID constructor =
|
||||
env->GetMethodID(powerDistributionVersionCls, "<init>", "(IIIIII)V");
|
||||
return env->NewObject(
|
||||
powerDistributionVersionCls, constructor,
|
||||
static_cast<jint>(firmwareMajor), static_cast<jint>(firmwareMinor),
|
||||
static_cast<jint>(firmwareFix), static_cast<jint>(hardwareMinor),
|
||||
static_cast<jint>(hardwareMajor), static_cast<jint>(uniqueId));
|
||||
}
|
||||
|
||||
JavaVM* GetJVM() {
|
||||
return jvm;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user