Skip to content

Commit

Permalink
[hal, wpilib] Remove analog output (#7696)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse authored Jan 17, 2025
1 parent 5017393 commit ff1b2a2
Show file tree
Hide file tree
Showing 45 changed files with 0 additions and 1,685 deletions.
55 changes: 0 additions & 55 deletions glass/src/lib/native/cpp/hardware/AnalogOutput.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions glass/src/lib/native/include/glass/hardware/AnalogOutput.h

This file was deleted.

48 changes: 0 additions & 48 deletions hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Analog Input / Output / Accumulator / Trigger JNI Functions.
*
* @see "hal/AnalogInput.h"
* @see "hal/AnalogOutput.h"
* @see "hal/AnalogAccumulator.h"
* @see "hal/AnalogTrigger.h"
*/
Expand Down Expand Up @@ -48,23 +47,6 @@ public interface AnalogTriggerType {
*/
public static native void freeAnalogInputPort(int portHandle);

/**
* Initializes the analog output port using the given port object.
*
* @param halPortHandle handle to the port
* @return the created analog output handle
* @see "HAL_InitializeAnalogOutputPort"
*/
public static native int initializeAnalogOutputPort(int halPortHandle);

/**
* Frees an analog output port.
*
* @param portHandle the analog output handle
* @see "HAL_FreeAnalogOutputPort"
*/
public static native void freeAnalogOutputPort(int portHandle);

/**
* Checks that the analog module number is valid.
*
Expand All @@ -84,18 +66,6 @@ public interface AnalogTriggerType {
*/
public static native boolean checkAnalogInputChannel(int channel);

/**
* Checks that the analog output channel number is valid.
*
* <p>Verifies that the analog channel number is one of the legal channel numbers. Channel numbers
* are 0-based.
*
* @param channel The analog output channel number.
* @return Analog channel is valid
* @see "HAL_CheckAnalogOutputChannel"
*/
public static native boolean checkAnalogOutputChannel(int channel);

/**
* Indicates the analog input is used by a simulated device.
*
Expand All @@ -105,24 +75,6 @@ public interface AnalogTriggerType {
*/
public static native void setAnalogInputSimDevice(int handle, int device);

/**
* Sets an analog output value.
*
* @param portHandle the analog output handle
* @param voltage the voltage (0-5v) to output
* @see "HAL_SetAnalogOutput"
*/
public static native void setAnalogOutput(int portHandle, double voltage);

/**
* Gets the current analog output value.
*
* @param portHandle the analog output handle
* @return the current output voltage (0-5v)
* @see "HAL_GetAnalogOutput"
*/
public static native double getAnalogOutput(int portHandle);

/**
* Sets the sample rate.
*
Expand Down
8 changes: 0 additions & 8 deletions hal/src/main/java/edu/wpi/first/hal/PortsJNI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ public class PortsJNI extends JNIWrapper {
*/
public static native int getNumAnalogInputs();

/**
* Gets the number of analog outputs in the current system.
*
* @return the number of analog outputs
* @see "HAL_GetNumAnalogOutputs"
*/
public static native int getNumAnalogOutputs();

/**
* Gets the number of counters in the current system.
*
Expand Down

This file was deleted.

74 changes: 0 additions & 74 deletions hal/src/main/native/cpp/jni/AnalogJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "edu_wpi_first_hal_AnalogJNI.h"
#include "hal/AnalogAccumulator.h"
#include "hal/AnalogInput.h"
#include "hal/AnalogOutput.h"
#include "hal/AnalogTrigger.h"
#include "hal/Ports.h"
#include "hal/handles/HandlesInternal.h"
Expand Down Expand Up @@ -52,37 +51,6 @@ Java_edu_wpi_first_hal_AnalogJNI_freeAnalogInputPort
}
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: initializeAnalogOutputPort
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_AnalogJNI_initializeAnalogOutputPort
(JNIEnv* env, jclass, jint id)
{
int32_t status = 0;
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
HAL_AnalogOutputHandle analog = HAL_InitializeAnalogOutputPort(
(HAL_PortHandle)id, stack.c_str(), &status);
CheckStatusForceThrow(env, status);
return (jlong)analog;
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: freeAnalogOutputPort
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_AnalogJNI_freeAnalogOutputPort
(JNIEnv* env, jclass, jint id)
{
if (id != HAL_kInvalidHandle) {
HAL_FreeAnalogOutputPort((HAL_AnalogOutputHandle)id);
}
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: checkAnalogModule
Expand All @@ -109,19 +77,6 @@ Java_edu_wpi_first_hal_AnalogJNI_checkAnalogInputChannel
return returnValue;
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: checkAnalogOutputChannel
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_AnalogJNI_checkAnalogOutputChannel
(JNIEnv*, jclass, jint value)
{
jboolean returnValue = HAL_CheckAnalogOutputChannel(value);
return returnValue;
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: setAnalogInputSimDevice
Expand All @@ -135,35 +90,6 @@ Java_edu_wpi_first_hal_AnalogJNI_setAnalogInputSimDevice
(HAL_SimDeviceHandle)device);
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: setAnalogOutput
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_AnalogJNI_setAnalogOutput
(JNIEnv* env, jclass, jint id, jdouble voltage)
{
int32_t status = 0;
HAL_SetAnalogOutput((HAL_AnalogOutputHandle)id, voltage, &status);
CheckStatus(env, status);
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: getAnalogOutput
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_AnalogJNI_getAnalogOutput
(JNIEnv* env, jclass, jint id)
{
int32_t status = 0;
double val = HAL_GetAnalogOutput((HAL_AnalogOutputHandle)id, &status);
CheckStatus(env, status);
return val;
}

/*
* Class: edu_wpi_first_hal_AnalogJNI
* Method: setAnalogSampleRate
Expand Down
13 changes: 0 additions & 13 deletions hal/src/main/native/cpp/jni/PortsJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ Java_edu_wpi_first_hal_PortsJNI_getNumAnalogInputs
return value;
}

/*
* Class: edu_wpi_first_hal_PortsJNI
* Method: getNumAnalogOutputs
* Signature: ()I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PortsJNI_getNumAnalogOutputs
(JNIEnv* env, jclass)
{
jint value = HAL_GetNumAnalogOutputs();
return value;
}

/*
* Class: edu_wpi_first_hal_PortsJNI
* Method: getNumCounters
Expand Down
Loading

0 comments on commit ff1b2a2

Please sign in to comment.