[hal, wpilib] Remove relay (#7695)

This commit is contained in:
Thad House
2025-01-16 23:20:07 -08:00
committed by GitHub
parent d9f8fded09
commit 5017393b3a
54 changed files with 1 additions and 3115 deletions

View File

@@ -169,32 +169,6 @@ Java_edu_wpi_first_hal_PortsJNI_getNumInterrupts
return value;
}
/*
* Class: edu_wpi_first_hal_PortsJNI
* Method: getNumRelayChannels
* Signature: ()I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PortsJNI_getNumRelayChannels
(JNIEnv* env, jclass)
{
jint value = HAL_GetNumRelayChannels();
return value;
}
/*
* Class: edu_wpi_first_hal_PortsJNI
* Method: getNumRelayHeaders
* Signature: ()I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PortsJNI_getNumRelayHeaders
(JNIEnv* env, jclass)
{
jint value = HAL_GetNumRelayHeaders();
return value;
}
/*
* Class: edu_wpi_first_hal_PortsJNI
* Method: getNumCTREPCMModules

View File

@@ -1,93 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <jni.h>
#include <cassert>
#include <wpi/jni_util.h>
#include "HALUtil.h"
#include "edu_wpi_first_hal_RelayJNI.h"
#include "hal/Ports.h"
#include "hal/Relay.h"
#include "hal/handles/HandlesInternal.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_RelayJNI
* Method: initializeRelayPort
* Signature: (IZ)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_RelayJNI_initializeRelayPort
(JNIEnv* env, jclass, jint id, jboolean fwd)
{
int32_t status = 0;
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
HAL_RelayHandle handle = HAL_InitializeRelayPort(
(HAL_PortHandle)id, static_cast<uint8_t>(fwd), stack.c_str(), &status);
CheckStatusForceThrow(env, status);
return (jint)handle;
}
/*
* Class: edu_wpi_first_hal_RelayJNI
* Method: freeRelayPort
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_RelayJNI_freeRelayPort
(JNIEnv* env, jclass, jint id)
{
if (id != HAL_kInvalidHandle) {
HAL_FreeRelayPort((HAL_RelayHandle)id);
}
}
/*
* Class: edu_wpi_first_hal_RelayJNI
* Method: checkRelayChannel
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_RelayJNI_checkRelayChannel
(JNIEnv* env, jclass, jint channel)
{
return (jboolean)HAL_CheckRelayChannel(static_cast<uint8_t>(channel));
}
/*
* Class: edu_wpi_first_hal_RelayJNI
* Method: setRelay
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_RelayJNI_setRelay
(JNIEnv* env, jclass, jint id, jboolean value)
{
int32_t status = 0;
HAL_SetRelay((HAL_RelayHandle)id, value, &status);
CheckStatus(env, status);
}
/*
* Class: edu_wpi_first_hal_RelayJNI
* Method: getRelay
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_RelayJNI_getRelay
(JNIEnv* env, jclass, jint id)
{
int32_t status = 0;
jboolean returnValue = HAL_GetRelay((HAL_RelayHandle)id, &status);
CheckStatus(env, status);
return returnValue;
}
} // extern "C"

View File

@@ -1,227 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <jni.h>
#include "CallbackStore.h"
#include "edu_wpi_first_hal_simulation_RelayDataJNI.h"
#include "hal/simulation/RelayData.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: registerInitializedForwardCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_registerInitializedForwardCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayInitializedForwardCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: cancelInitializedForwardCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_cancelInitializedForwardCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayInitializedForwardCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: getInitializedForward
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_getInitializedForward
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayInitializedForward(index);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: setInitializedForward
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_setInitializedForward
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRelayInitializedForward(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: registerInitializedReverseCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_registerInitializedReverseCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayInitializedReverseCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: cancelInitializedReverseCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_cancelInitializedReverseCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayInitializedReverseCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: getInitializedReverse
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_getInitializedReverse
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayInitializedReverse(index);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: setInitializedReverse
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_setInitializedReverse
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRelayInitializedReverse(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: registerForwardCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_registerForwardCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayForwardCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: cancelForwardCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_cancelForwardCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayForwardCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: getForward
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_getForward
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayForward(index);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: setForward
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_setForward
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRelayForward(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: registerReverseCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_registerReverseCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayReverseCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: cancelReverseCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_cancelReverseCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayReverseCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: getReverse
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_getReverse
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayReverse(index);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: setReverse
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_setReverse
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRelayReverse(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_RelayDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_RelayDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetRelayData(index);
}
} // extern "C"