mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
[hal, wpilib] Remove analog accumulator and analog gyro (#7697)
The 2 high level classes were temporarily kept to keep the examples compiling. We will remove those when we have the interface into the built in IMU.
This commit is contained in:
@@ -1,29 +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.
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Structure for holding the values stored in an accumulator. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class AccumulatorResult {
|
||||
/** The total value accumulated. */
|
||||
public long value;
|
||||
|
||||
/** The number of sample value was accumulated over. */
|
||||
public long count;
|
||||
|
||||
/** Constructs an AccumulatorResult. */
|
||||
public AccumulatorResult() {}
|
||||
|
||||
/**
|
||||
* Set the value and count.
|
||||
*
|
||||
* @param value The total value accumulated.
|
||||
* @param count The number of samples accumulated.
|
||||
*/
|
||||
public void set(long value, long count) {
|
||||
this.value = value;
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
@@ -1,132 +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.
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* Analog Gyro JNI Functions.
|
||||
*
|
||||
* @see "hal/AnalogGyro.h"
|
||||
*/
|
||||
public class AnalogGyroJNI extends JNIWrapper {
|
||||
/**
|
||||
* Initializes an analog gyro.
|
||||
*
|
||||
* @param halAnalogInputHandle handle to the analog input port
|
||||
* @return the initialized gyro handle
|
||||
* @see "HAL_InitializeAnalogGyro"
|
||||
*/
|
||||
public static native int initializeAnalogGyro(int halAnalogInputHandle);
|
||||
|
||||
/**
|
||||
* Sets up an analog gyro with the proper offsets and settings for the KOP analog gyro.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @see "HAL_SetupAnalogGyro"
|
||||
*/
|
||||
public static native void setupAnalogGyro(int handle);
|
||||
|
||||
/**
|
||||
* Frees an analog gyro.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @see "HAL_FreeAnalogGyro"
|
||||
*/
|
||||
public static native void freeAnalogGyro(int handle);
|
||||
|
||||
/**
|
||||
* Sets the analog gyro parameters to the specified values.
|
||||
*
|
||||
* <p>This is meant to be used if you want to reuse the values from a previous calibration.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @param voltsPerDegreePerSecond the gyro volts scaling
|
||||
* @param offset the gyro offset
|
||||
* @param center the gyro center
|
||||
* @see "HAL_SetAnalogGyroParameters"
|
||||
*/
|
||||
public static native void setAnalogGyroParameters(
|
||||
int handle, double voltsPerDegreePerSecond, double offset, int center);
|
||||
|
||||
/**
|
||||
* Sets the analog gyro volts per degrees per second scaling.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @param voltsPerDegreePerSecond the gyro volts scaling
|
||||
* @see "HAL_SetAnalogGyroVoltsPerDegreePerSecond"
|
||||
*/
|
||||
public static native void setAnalogGyroVoltsPerDegreePerSecond(
|
||||
int handle, double voltsPerDegreePerSecond);
|
||||
|
||||
/**
|
||||
* Resets the analog gyro value to 0.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @see "HAL_ResetAnalogGyro"
|
||||
*/
|
||||
public static native void resetAnalogGyro(int handle);
|
||||
|
||||
/**
|
||||
* Calibrates the analog gyro.
|
||||
*
|
||||
* <p>This happens by calculating the average value of the gyro over 5 seconds, and setting that
|
||||
* as the center. Note that this call blocks for 5 seconds to perform this.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @see "HAL_CalibrateAnalogGyro"
|
||||
*/
|
||||
public static native void calibrateAnalogGyro(int handle);
|
||||
|
||||
/**
|
||||
* Sets the deadband of the analog gyro.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @param volts the voltage deadband
|
||||
* @see "HAL_SetAnalogGyroDeadband"
|
||||
*/
|
||||
public static native void setAnalogGyroDeadband(int handle, double volts);
|
||||
|
||||
/**
|
||||
* Gets the gyro angle in degrees.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @return the gyro angle in degrees
|
||||
* @see "HAL_GetAnalogGyroAngle"
|
||||
*/
|
||||
public static native double getAnalogGyroAngle(int handle);
|
||||
|
||||
/**
|
||||
* Gets the gyro rate in degrees/second.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @return the gyro rate in degrees/second
|
||||
* @see "HAL_GetAnalogGyroRate"
|
||||
*/
|
||||
public static native double getAnalogGyroRate(int handle);
|
||||
|
||||
/**
|
||||
* Gets the calibrated gyro offset.
|
||||
*
|
||||
* <p>Can be used to not repeat a calibration but reconstruct the gyro object.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @return the gyro offset
|
||||
* @see "HAL_GetAnalogGyroOffset"
|
||||
*/
|
||||
public static native double getAnalogGyroOffset(int handle);
|
||||
|
||||
/**
|
||||
* Gets the calibrated gyro center.
|
||||
*
|
||||
* <p>Can be used to not repeat a calibration but reconstruct the gyro object.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @return the gyro center
|
||||
* @see "HAL_GetAnalogGyroCenter"
|
||||
*/
|
||||
public static native int getAnalogGyroCenter(int handle);
|
||||
|
||||
/** Utility class. */
|
||||
private AnalogGyroJNI() {}
|
||||
}
|
||||
@@ -5,10 +5,9 @@
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* Analog Input / Output / Accumulator / Trigger JNI Functions.
|
||||
* Analog Input / Output / Trigger JNI Functions.
|
||||
*
|
||||
* @see "hal/AnalogInput.h"
|
||||
* @see "hal/AnalogAccumulator.h"
|
||||
* @see "hal/AnalogTrigger.h"
|
||||
*/
|
||||
public class AnalogJNI extends JNIWrapper {
|
||||
@@ -249,92 +248,6 @@ public class AnalogJNI extends JNIWrapper {
|
||||
*/
|
||||
public static native int getAnalogOffset(int analogPortHandle);
|
||||
|
||||
/**
|
||||
* Is the channel attached to an accumulator.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @return The analog channel is attached to an accumulator.
|
||||
* @see "HAL_IsAccumulatorChannel"
|
||||
*/
|
||||
public static native boolean isAccumulatorChannel(int analogPortHandle);
|
||||
|
||||
/**
|
||||
* Initialize the accumulator.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @see "HAL_InitAccumulator"
|
||||
*/
|
||||
public static native void initAccumulator(int analogPortHandle);
|
||||
|
||||
/**
|
||||
* Resets the accumulator to the initial value.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @see "HAL_ResetAccumulator"
|
||||
*/
|
||||
public static native void resetAccumulator(int analogPortHandle);
|
||||
|
||||
/**
|
||||
* Set the center value of the accumulator.
|
||||
*
|
||||
* <p>The center value is subtracted from each A/D value before it is added to the accumulator.
|
||||
* This is used for the center value of devices like gyros and accelerometers to make integration
|
||||
* work and to take the device offset into account when integrating.
|
||||
*
|
||||
* <p>This center value is based on the output of the oversampled and averaged source from channel
|
||||
* 1. Because of this, any non-zero oversample bits will affect the size of the value for this
|
||||
* field.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @param center The center value of the accumulator.
|
||||
* @see "HAL_SetAccumulatorCenter"
|
||||
*/
|
||||
public static native void setAccumulatorCenter(int analogPortHandle, int center);
|
||||
|
||||
/**
|
||||
* Set the accumulator's deadband.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @param deadband The deadband of the accumulator.
|
||||
* @see "HAL_SetAccumulatorDeadband"
|
||||
*/
|
||||
public static native void setAccumulatorDeadband(int analogPortHandle, int deadband);
|
||||
|
||||
/**
|
||||
* Read the accumulated value.
|
||||
*
|
||||
* <p>Read the value that has been accumulating on channel 1. The accumulator is attached after
|
||||
* the oversample and average engine.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @return The 64-bit value accumulated since the last Reset().
|
||||
* @see "HAL_GetAccumulatorValue"
|
||||
*/
|
||||
public static native long getAccumulatorValue(int analogPortHandle);
|
||||
|
||||
/**
|
||||
* Read the number of accumulated values.
|
||||
*
|
||||
* <p>Read the count of the accumulated values since the accumulator was last Reset().
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @return The number of times samples from the channel were accumulated.
|
||||
* @see "HAL_GetAccumulatorCount"
|
||||
*/
|
||||
public static native int getAccumulatorCount(int analogPortHandle);
|
||||
|
||||
/**
|
||||
* Read the accumulated value and the number of accumulated values atomically.
|
||||
*
|
||||
* <p>This function reads the value and count from the FPGA atomically. This can be used for
|
||||
* averaging.
|
||||
*
|
||||
* @param analogPortHandle Handle to the analog port.
|
||||
* @param result Accumulator result.
|
||||
* @see "HAL_GetAccumulatorOutput"
|
||||
*/
|
||||
public static native void getAccumulatorOutput(int analogPortHandle, AccumulatorResult result);
|
||||
|
||||
/**
|
||||
* Initializes an analog trigger.
|
||||
*
|
||||
|
||||
@@ -137,29 +137,6 @@ public class DMAJNISample {
|
||||
return readValue(data.m_valueType + 2, data.m_index);
|
||||
}
|
||||
|
||||
public void getAnalogAccumulator(int analogInputHandle, AccumulatorResult result) {
|
||||
BaseStore data = m_propertyMap.get(analogInputHandle);
|
||||
if (data == null) {
|
||||
data = addSensorInternal(analogInputHandle);
|
||||
}
|
||||
|
||||
if (data.m_index == 0) {
|
||||
int val0 = readValue(kEnable_Accumulator0, 0);
|
||||
int val1 = readValue(kEnable_Accumulator0, 1);
|
||||
int val2 = readValue(kEnable_Accumulator0, 2);
|
||||
result.count = val2;
|
||||
result.value = ((long) val1 << 32) | val0;
|
||||
} else if (data.m_index == 1) {
|
||||
int val0 = readValue(kEnable_Accumulator1, 0);
|
||||
int val1 = readValue(kEnable_Accumulator1, 1);
|
||||
int val2 = readValue(kEnable_Accumulator1, 2);
|
||||
result.count = val2;
|
||||
result.value = ((long) val1 << 32) | val0;
|
||||
} else {
|
||||
throw new RuntimeException("Resource not found in DMA capture");
|
||||
}
|
||||
}
|
||||
|
||||
public int getDutyCycleOutput(int dutyCycleHandle) {
|
||||
BaseStore data = m_propertyMap.get(dutyCycleHandle);
|
||||
if (data == null) {
|
||||
|
||||
@@ -10,14 +10,6 @@ package edu.wpi.first.hal;
|
||||
* @see "hal/Ports.h"
|
||||
*/
|
||||
public class PortsJNI extends JNIWrapper {
|
||||
/**
|
||||
* Gets the number of analog accumulators in the current system.
|
||||
*
|
||||
* @return the number of analog accumulators
|
||||
* @see "HAL_GetNumAccumulators"
|
||||
*/
|
||||
public static native int getNumAccumulators();
|
||||
|
||||
/**
|
||||
* Gets the number of analog triggers in the current system.
|
||||
*
|
||||
|
||||
@@ -1,42 +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.
|
||||
|
||||
package edu.wpi.first.hal.simulation;
|
||||
|
||||
import edu.wpi.first.hal.JNIWrapper;
|
||||
|
||||
/** JNI for analog gyro data. */
|
||||
public class AnalogGyroDataJNI extends JNIWrapper {
|
||||
public static native int registerAngleCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelAngleCallback(int index, int uid);
|
||||
|
||||
public static native double getAngle(int index);
|
||||
|
||||
public static native void setAngle(int index, double angle);
|
||||
|
||||
public static native int registerRateCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelRateCallback(int index, int uid);
|
||||
|
||||
public static native double getRate(int index);
|
||||
|
||||
public static native void setRate(int index, double rate);
|
||||
|
||||
public static native int registerInitializedCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelInitializedCallback(int index, int uid);
|
||||
|
||||
public static native boolean getInitialized(int index);
|
||||
|
||||
public static native void setInitialized(int index, boolean initialized);
|
||||
|
||||
public static native void resetData(int index);
|
||||
|
||||
/** Utility class. */
|
||||
private AnalogGyroDataJNI() {}
|
||||
}
|
||||
@@ -44,51 +44,6 @@ public class AnalogInDataJNI extends JNIWrapper {
|
||||
|
||||
public static native void setVoltage(int index, double voltage);
|
||||
|
||||
public static native int registerAccumulatorInitializedCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelAccumulatorInitializedCallback(int index, int uid);
|
||||
|
||||
public static native boolean getAccumulatorInitialized(int index);
|
||||
|
||||
public static native void setAccumulatorInitialized(int index, boolean accumulatorInitialized);
|
||||
|
||||
public static native int registerAccumulatorValueCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelAccumulatorValueCallback(int index, int uid);
|
||||
|
||||
public static native long getAccumulatorValue(int index);
|
||||
|
||||
public static native void setAccumulatorValue(int index, long accumulatorValue);
|
||||
|
||||
public static native int registerAccumulatorCountCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelAccumulatorCountCallback(int index, int uid);
|
||||
|
||||
public static native long getAccumulatorCount(int index);
|
||||
|
||||
public static native void setAccumulatorCount(int index, long accumulatorCount);
|
||||
|
||||
public static native int registerAccumulatorCenterCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelAccumulatorCenterCallback(int index, int uid);
|
||||
|
||||
public static native int getAccumulatorCenter(int index);
|
||||
|
||||
public static native void setAccumulatorCenter(int index, int AccumulatorCenter);
|
||||
|
||||
public static native int registerAccumulatorDeadbandCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
public static native void cancelAccumulatorDeadbandCallback(int index, int uid);
|
||||
|
||||
public static native int getAccumulatorDeadband(int index);
|
||||
|
||||
public static native void setAccumulatorDeadband(int index, int AccumulatorDeadband);
|
||||
|
||||
public static native void resetData(int index);
|
||||
|
||||
/** Utility class. */
|
||||
|
||||
@@ -1,196 +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_AnalogGyroJNI.h"
|
||||
#include "hal/AnalogGyro.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: initializeAnalogGyro
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_initializeAnalogGyro
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
HAL_GyroHandle handle = HAL_InitializeAnalogGyro((HAL_AnalogInputHandle)id,
|
||||
stack.c_str(), &status);
|
||||
// Analog input does range checking, so we don't need to do so.
|
||||
CheckStatusForceThrow(env, status);
|
||||
return (jint)handle;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: setupAnalogGyro
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_setupAnalogGyro
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetupAnalogGyro((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: freeAnalogGyro
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_freeAnalogGyro
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
if (id != HAL_kInvalidHandle) {
|
||||
HAL_FreeAnalogGyro((HAL_GyroHandle)id);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: setAnalogGyroParameters
|
||||
* Signature: (IDDI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_setAnalogGyroParameters
|
||||
(JNIEnv* env, jclass, jint id, jdouble vPDPS, jdouble offset, jint center)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogGyroParameters((HAL_GyroHandle)id, vPDPS, offset, center,
|
||||
&status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: setAnalogGyroVoltsPerDegreePerSecond
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_setAnalogGyroVoltsPerDegreePerSecond
|
||||
(JNIEnv* env, jclass, jint id, jdouble vPDPS)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogGyroVoltsPerDegreePerSecond((HAL_GyroHandle)id, vPDPS, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: resetAnalogGyro
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_resetAnalogGyro
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_ResetAnalogGyro((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: calibrateAnalogGyro
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_calibrateAnalogGyro
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_CalibrateAnalogGyro((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: setAnalogGyroDeadband
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_setAnalogGyroDeadband
|
||||
(JNIEnv* env, jclass, jint id, jdouble deadband)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogGyroDeadband((HAL_GyroHandle)id, deadband, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: getAnalogGyroAngle
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_getAnalogGyroAngle
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jdouble value = HAL_GetAnalogGyroAngle((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: getAnalogGyroRate
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_getAnalogGyroRate
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jdouble value = HAL_GetAnalogGyroRate((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: getAnalogGyroOffset
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_getAnalogGyroOffset
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jdouble value = HAL_GetAnalogGyroOffset((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogGyroJNI
|
||||
* Method: getAnalogGyroCenter
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogGyroJNI_getAnalogGyroCenter
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jint value = HAL_GetAnalogGyroCenter((HAL_GyroHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return value;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "HALUtil.h"
|
||||
#include "edu_wpi_first_hal_AnalogJNI.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/AnalogInput.h"
|
||||
#include "hal/AnalogTrigger.h"
|
||||
#include "hal/Ports.h"
|
||||
@@ -306,129 +305,6 @@ Java_edu_wpi_first_hal_AnalogJNI_getAnalogOffset
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: isAccumulatorChannel
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_isAccumulatorChannel
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
|
||||
jboolean returnValue =
|
||||
HAL_IsAccumulatorChannel((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: initAccumulator
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_initAccumulator
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_InitAccumulator((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: resetAccumulator
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_resetAccumulator
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_ResetAccumulator((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: setAccumulatorCenter
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_setAccumulatorCenter
|
||||
(JNIEnv* env, jclass, jint id, jint center)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAccumulatorCenter((HAL_AnalogInputHandle)id, center, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: setAccumulatorDeadband
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_setAccumulatorDeadband
|
||||
(JNIEnv* env, jclass, jint id, jint deadband)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAccumulatorDeadband((HAL_AnalogInputHandle)id, deadband, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: getAccumulatorValue
|
||||
* Signature: (I)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_getAccumulatorValue
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jlong returnValue =
|
||||
HAL_GetAccumulatorValue((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: getAccumulatorCount
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_getAccumulatorCount
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jint returnValue =
|
||||
HAL_GetAccumulatorCount((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: getAccumulatorOutput
|
||||
* Signature: (ILjava/lang/Object;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AnalogJNI_getAccumulatorOutput
|
||||
(JNIEnv* env, jclass, jint id, jobject accumulatorResult)
|
||||
{
|
||||
int32_t status = 0;
|
||||
int64_t value = 0;
|
||||
int64_t count = 0;
|
||||
HAL_GetAccumulatorOutput((HAL_AnalogInputHandle)id, &value, &count, &status);
|
||||
SetAccumulatorResultObject(env, accumulatorResult, value, count);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AnalogJNI
|
||||
* Method: initializeAnalogTrigger
|
||||
|
||||
@@ -51,7 +51,6 @@ static JClass powerDistributionVersionCls;
|
||||
static JClass pwmConfigDataResultCls;
|
||||
static JClass canStatusCls;
|
||||
static JClass matchInfoDataCls;
|
||||
static JClass accumulatorResultCls;
|
||||
static JClass canDataCls;
|
||||
static JClass canStreamMessageCls;
|
||||
static JClass halValueCls;
|
||||
@@ -65,7 +64,6 @@ static const JClassInit classes[] = {
|
||||
{"edu/wpi/first/hal/PWMConfigDataResult", &pwmConfigDataResultCls},
|
||||
{"edu/wpi/first/hal/can/CANStatus", &canStatusCls},
|
||||
{"edu/wpi/first/hal/MatchInfoData", &matchInfoDataCls},
|
||||
{"edu/wpi/first/hal/AccumulatorResult", &accumulatorResultCls},
|
||||
{"edu/wpi/first/hal/CANData", &canDataCls},
|
||||
{"edu/wpi/first/hal/CANStreamMessage", &canStreamMessageCls},
|
||||
{"edu/wpi/first/hal/HALValue", &halValueCls},
|
||||
@@ -306,15 +304,6 @@ void SetMatchInfoObject(JNIEnv* env, jobject matchStatus,
|
||||
static_cast<jint>(matchInfo.matchType));
|
||||
}
|
||||
|
||||
void SetAccumulatorResultObject(JNIEnv* env, jobject accumulatorResult,
|
||||
int64_t value, int64_t count) {
|
||||
static jmethodID func =
|
||||
env->GetMethodID(accumulatorResultCls, "set", "(JJ)V");
|
||||
|
||||
env->CallVoidMethod(accumulatorResult, func, static_cast<jlong>(value),
|
||||
static_cast<jlong>(count));
|
||||
}
|
||||
|
||||
jbyteArray SetCANDataObject(JNIEnv* env, jobject canData, int32_t length,
|
||||
uint64_t timestamp) {
|
||||
static jmethodID func = env->GetMethodID(canDataCls, "setData", "(IJ)[B");
|
||||
|
||||
@@ -75,9 +75,6 @@ void SetCanStatusObject(JNIEnv* env, jobject canStatus,
|
||||
void SetMatchInfoObject(JNIEnv* env, jobject matchStatus,
|
||||
const HAL_MatchInfo& matchInfo);
|
||||
|
||||
void SetAccumulatorResultObject(JNIEnv* env, jobject accumulatorResult,
|
||||
int64_t value, int64_t count);
|
||||
|
||||
jbyteArray SetCANDataObject(JNIEnv* env, jobject canData, int32_t length,
|
||||
uint64_t timestamp);
|
||||
|
||||
|
||||
@@ -13,19 +13,6 @@
|
||||
using namespace hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PortsJNI
|
||||
* Method: getNumAccumulators
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_PortsJNI_getNumAccumulators
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumAccumulators();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PortsJNI
|
||||
* Method: getNumAnalogTriggers
|
||||
|
||||
@@ -1,177 +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_AnalogGyroDataJNI.h"
|
||||
#include "hal/simulation/AnalogGyroData.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: registerAngleCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_registerAngleCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogGyroAngleCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: cancelAngleCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_cancelAngleCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogGyroAngleCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: getAngle
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_getAngle
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogGyroAngle(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: setAngle
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_setAngle
|
||||
(JNIEnv*, jclass, jint index, jdouble value)
|
||||
{
|
||||
HALSIM_SetAnalogGyroAngle(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: registerRateCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_registerRateCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogGyroRateCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: cancelRateCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_cancelRateCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogGyroRateCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: getRate
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_getRate
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogGyroRate(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: setRate
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_setRate
|
||||
(JNIEnv*, jclass, jint index, jdouble value)
|
||||
{
|
||||
HALSIM_SetAnalogGyroRate(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: registerInitializedCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_registerInitializedCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogGyroInitializedCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: cancelInitializedCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_cancelInitializedCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogGyroInitializedCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: getInitialized
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_getInitialized
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogGyroInitialized(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: setInitialized
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_setInitialized
|
||||
(JNIEnv*, jclass, jint index, jboolean value)
|
||||
{
|
||||
HALSIM_SetAnalogGyroInitialized(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogGyroDataJNI
|
||||
* Method: resetData
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogGyroDataJNI_resetData
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
HALSIM_ResetAnalogGyroData(index);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -212,261 +212,6 @@ Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setVoltage
|
||||
HALSIM_SetAnalogInVoltage(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerAccumulatorInitializedCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerAccumulatorInitializedCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(
|
||||
env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInAccumulatorInitializedCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelAccumulatorInitializedCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelAccumulatorInitializedCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(
|
||||
env, handle, index, &HALSIM_CancelAnalogInAccumulatorInitializedCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: getAccumulatorInitialized
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getAccumulatorInitialized
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInAccumulatorInitialized(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: setAccumulatorInitialized
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setAccumulatorInitialized
|
||||
(JNIEnv*, jclass, jint index, jboolean value)
|
||||
{
|
||||
HALSIM_SetAnalogInAccumulatorInitialized(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerAccumulatorValueCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerAccumulatorValueCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(
|
||||
env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInAccumulatorValueCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelAccumulatorValueCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelAccumulatorValueCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogInAccumulatorValueCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: getAccumulatorValue
|
||||
* Signature: (I)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getAccumulatorValue
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInAccumulatorValue(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: setAccumulatorValue
|
||||
* Signature: (IJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setAccumulatorValue
|
||||
(JNIEnv*, jclass, jint index, jlong value)
|
||||
{
|
||||
HALSIM_SetAnalogInAccumulatorValue(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerAccumulatorCountCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerAccumulatorCountCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(
|
||||
env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInAccumulatorCountCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelAccumulatorCountCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelAccumulatorCountCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogInAccumulatorCountCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: getAccumulatorCount
|
||||
* Signature: (I)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getAccumulatorCount
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInAccumulatorCount(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: setAccumulatorCount
|
||||
* Signature: (IJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setAccumulatorCount
|
||||
(JNIEnv*, jclass, jint index, jlong value)
|
||||
{
|
||||
HALSIM_SetAnalogInAccumulatorCount(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerAccumulatorCenterCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerAccumulatorCenterCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(
|
||||
env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInAccumulatorCenterCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelAccumulatorCenterCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelAccumulatorCenterCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogInAccumulatorCenterCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: getAccumulatorCenter
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getAccumulatorCenter
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInAccumulatorCenter(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: setAccumulatorCenter
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setAccumulatorCenter
|
||||
(JNIEnv*, jclass, jint index, jint value)
|
||||
{
|
||||
HALSIM_SetAnalogInAccumulatorCenter(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerAccumulatorDeadbandCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerAccumulatorDeadbandCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(
|
||||
env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInAccumulatorDeadbandCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelAccumulatorDeadbandCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelAccumulatorDeadbandCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogInAccumulatorDeadbandCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: getAccumulatorDeadband
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getAccumulatorDeadband
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInAccumulatorDeadband(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: setAccumulatorDeadband
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setAccumulatorDeadband
|
||||
(JNIEnv*, jclass, jint index, jint value)
|
||||
{
|
||||
HALSIM_SetAnalogInAccumulatorDeadband(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
||||
* Method: resetData
|
||||
|
||||
@@ -1,120 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hal/Types.h"
|
||||
|
||||
/**
|
||||
* @defgroup hal_analogaccumulator Analog Accumulator Functions
|
||||
* @ingroup hal_capi
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Is the channel attached to an accumulator.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return The analog channel is attached to an accumulator.
|
||||
*/
|
||||
HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Initialize the accumulator.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Resets the accumulator to the initial value.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Set the center value of the accumulator.
|
||||
*
|
||||
* The center value is subtracted from each A/D value before it is added to the
|
||||
* accumulator. This is used for the center value of devices like gyros and
|
||||
* accelerometers to make integration work and to take the device offset into
|
||||
* account when integrating.
|
||||
*
|
||||
* This center value is based on the output of the oversampled and averaged
|
||||
* source from channel 1. Because of this, any non-zero oversample bits will
|
||||
* affect the size of the value for this field.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[in] center The center value of the accumulator.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t center, int32_t* status);
|
||||
|
||||
/**
|
||||
* Set the accumulator's deadband.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[in] deadband The deadband of the accumulator.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t deadband, int32_t* status);
|
||||
|
||||
/**
|
||||
* Read the accumulated value.
|
||||
*
|
||||
* Read the value that has been accumulating on channel 1.
|
||||
* The accumulator is attached after the oversample and average engine.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return The 64-bit value accumulated since the last Reset().
|
||||
*/
|
||||
int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Read the number of accumulated values.
|
||||
*
|
||||
* Read the count of the accumulated values since the accumulator was last
|
||||
* Reset().
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return The number of times samples from the channel were accumulated.
|
||||
*/
|
||||
int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Read the accumulated value and the number of accumulated values atomically.
|
||||
*
|
||||
* This function reads the value and count from the FPGA atomically.
|
||||
* This can be used for averaging.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port.
|
||||
* @param[in] value Pointer to the 64-bit accumulated output.
|
||||
* @param[in] count Pointer to the number of accumulation cycles.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
|
||||
int64_t* value, int64_t* count, int32_t* status);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
/** @} */
|
||||
@@ -1,149 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hal/Types.h"
|
||||
|
||||
/**
|
||||
* @defgroup hal_analoggyro Analog Gyro Functions
|
||||
* @ingroup hal_capi
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes an analog gyro.
|
||||
*
|
||||
* @param[in] handle handle to the analog input port
|
||||
* @param[in] allocationLocation the location where the allocation is occurring
|
||||
* (can be null)
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return the initialized gyro handle
|
||||
*/
|
||||
HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle handle,
|
||||
const char* allocationLocation,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets up an analog gyro with the proper offsets and settings for the KOP
|
||||
* analog gyro.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Frees an analog gyro.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
*/
|
||||
void HAL_FreeAnalogGyro(HAL_GyroHandle handle);
|
||||
|
||||
/**
|
||||
* Sets the analog gyro parameters to the specified values.
|
||||
*
|
||||
* This is meant to be used if you want to reuse the values from a previous
|
||||
* calibration.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[in] voltsPerDegreePerSecond the gyro volts scaling
|
||||
* @param[in] offset the gyro offset
|
||||
* @param[in] center the gyro center
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
|
||||
double voltsPerDegreePerSecond, double offset,
|
||||
int32_t center, int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets the analog gyro volts per degrees per second scaling.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[in] voltsPerDegreePerSecond the gyro volts scaling
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
|
||||
double voltsPerDegreePerSecond,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Resets the analog gyro value to 0.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Calibrates the analog gyro.
|
||||
*
|
||||
* This happens by calculating the average value of the gyro over 5 seconds, and
|
||||
* setting that as the center. Note that this call blocks for 5 seconds to
|
||||
* perform this.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets the deadband of the analog gyro.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[in] volts the voltage deadband
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the gyro angle in degrees.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the gyro angle in degrees
|
||||
*/
|
||||
double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the gyro rate in degrees/second.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the gyro rate in degrees/second
|
||||
*/
|
||||
double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the calibrated gyro offset.
|
||||
*
|
||||
* Can be used to not repeat a calibration but reconstruct the gyro object.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the gyro offset
|
||||
*/
|
||||
double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the calibrated gyro center.
|
||||
*
|
||||
* Can be used to not repeat a calibration but reconstruct the gyro object.
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the gyro center
|
||||
*/
|
||||
int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
/** @} */
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hal/Accelerometer.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/AnalogGyro.h"
|
||||
#include "hal/AnalogInput.h"
|
||||
#include "hal/AnalogTrigger.h"
|
||||
#include "hal/CAN.h"
|
||||
|
||||
@@ -16,13 +16,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Gets the number of analog accumulators in the current system.
|
||||
*
|
||||
* @return the number of analog accumulators
|
||||
*/
|
||||
int32_t HAL_GetNumAccumulators(void);
|
||||
|
||||
/**
|
||||
* Gets the number of analog triggers in the current system.
|
||||
*
|
||||
|
||||
@@ -1,44 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/Types.h"
|
||||
#include "hal/simulation/NotifyListener.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void HALSIM_ResetAnalogGyroData(int32_t index);
|
||||
int32_t HALSIM_RegisterAnalogGyroAngleCallback(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogGyroAngleCallback(int32_t index, int32_t uid);
|
||||
double HALSIM_GetAnalogGyroAngle(int32_t index);
|
||||
void HALSIM_SetAnalogGyroAngle(int32_t index, double angle);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogGyroRateCallback(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogGyroRateCallback(int32_t index, int32_t uid);
|
||||
double HALSIM_GetAnalogGyroRate(int32_t index);
|
||||
void HALSIM_SetAnalogGyroRate(int32_t index, double rate);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogGyroInitializedCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogGyroInitializedCallback(int32_t index, int32_t uid);
|
||||
HAL_Bool HALSIM_GetAnalogGyroInitialized(int32_t index);
|
||||
void HALSIM_SetAnalogGyroInitialized(int32_t index, HAL_Bool initialized);
|
||||
|
||||
void HALSIM_RegisterAnalogGyroAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
@@ -45,48 +45,6 @@ void HALSIM_CancelAnalogInVoltageCallback(int32_t index, int32_t uid);
|
||||
double HALSIM_GetAnalogInVoltage(int32_t index);
|
||||
void HALSIM_SetAnalogInVoltage(int32_t index, double voltage);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInAccumulatorInitializedCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInAccumulatorInitializedCallback(int32_t index,
|
||||
int32_t uid);
|
||||
HAL_Bool HALSIM_GetAnalogInAccumulatorInitialized(int32_t index);
|
||||
void HALSIM_SetAnalogInAccumulatorInitialized(int32_t index,
|
||||
HAL_Bool accumulatorInitialized);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInAccumulatorValueCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInAccumulatorValueCallback(int32_t index, int32_t uid);
|
||||
int64_t HALSIM_GetAnalogInAccumulatorValue(int32_t index);
|
||||
void HALSIM_SetAnalogInAccumulatorValue(int32_t index,
|
||||
int64_t accumulatorValue);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInAccumulatorCountCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInAccumulatorCountCallback(int32_t index, int32_t uid);
|
||||
int64_t HALSIM_GetAnalogInAccumulatorCount(int32_t index);
|
||||
void HALSIM_SetAnalogInAccumulatorCount(int32_t index,
|
||||
int64_t accumulatorCount);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInAccumulatorCenterCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInAccumulatorCenterCallback(int32_t index, int32_t uid);
|
||||
int32_t HALSIM_GetAnalogInAccumulatorCenter(int32_t index);
|
||||
void HALSIM_SetAnalogInAccumulatorCenter(int32_t index,
|
||||
int32_t accumulatorCenter);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInAccumulatorDeadbandCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInAccumulatorDeadbandCallback(int32_t index,
|
||||
int32_t uid);
|
||||
int32_t HALSIM_GetAnalogInAccumulatorDeadband(int32_t index);
|
||||
void HALSIM_SetAnalogInAccumulatorDeadband(int32_t index,
|
||||
int32_t accumulatorDeadband);
|
||||
|
||||
void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify);
|
||||
|
||||
@@ -1,109 +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 "hal/AnalogAccumulator.h"
|
||||
|
||||
#include "AnalogInternal.h"
|
||||
#include "mockdata/AnalogInDataInternal.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeAnalogAccumulator() {}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return false;
|
||||
}
|
||||
for (int32_t i = 0; i < kNumAccumulators; i++) {
|
||||
if (port->channel == kAccumulatorChannels[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HAL_IsAccumulatorChannel(analogPortHandle, status)) {
|
||||
*status = HAL_INVALID_ACCUMULATOR_CHANNEL;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogInData[port->channel].accumulatorInitialized = true;
|
||||
}
|
||||
void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogInData[port->channel].accumulatorCenter = 0;
|
||||
SimAnalogInData[port->channel].accumulatorCount = 0;
|
||||
SimAnalogInData[port->channel].accumulatorValue = 0;
|
||||
}
|
||||
void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t center, int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogInData[port->channel].accumulatorCenter = center;
|
||||
}
|
||||
void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t deadband, int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogInData[port->channel].accumulatorDeadband = deadband;
|
||||
}
|
||||
int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimAnalogInData[port->channel].accumulatorValue;
|
||||
}
|
||||
int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimAnalogInData[port->channel].accumulatorCount;
|
||||
}
|
||||
void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
|
||||
int64_t* value, int64_t* count, int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
*count = SimAnalogInData[port->channel].accumulatorCount;
|
||||
*value = SimAnalogInData[port->channel].accumulatorValue;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,151 +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 "hal/AnalogGyro.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "HALInitializer.h"
|
||||
#include "HALInternal.h"
|
||||
#include "PortsInternal.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/Errors.h"
|
||||
#include "hal/handles/IndexedHandleResource.h"
|
||||
#include "mockdata/AnalogGyroDataInternal.h"
|
||||
|
||||
namespace {
|
||||
struct AnalogGyro {
|
||||
HAL_AnalogInputHandle handle;
|
||||
uint8_t index;
|
||||
std::string previousAllocation;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
using namespace hal;
|
||||
|
||||
static IndexedHandleResource<HAL_GyroHandle, AnalogGyro, kNumAccumulators,
|
||||
HAL_HandleEnum::AnalogGyro>* analogGyroHandles;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeAnalogGyro() {
|
||||
static IndexedHandleResource<HAL_GyroHandle, AnalogGyro, kNumAccumulators,
|
||||
HAL_HandleEnum::AnalogGyro>
|
||||
agH;
|
||||
analogGyroHandles = &agH;
|
||||
}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle analogHandle,
|
||||
const char* allocationLocation,
|
||||
int32_t* status) {
|
||||
hal::init::CheckInit();
|
||||
// Handle will be type checked by HAL_IsAccumulatorChannel
|
||||
int16_t channel = getHandleIndex(analogHandle);
|
||||
if (!HAL_IsAccumulatorChannel(analogHandle, status)) {
|
||||
if (*status == 0) {
|
||||
*status = HAL_INVALID_ACCUMULATOR_CHANNEL;
|
||||
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Analog Gyro",
|
||||
0, kNumAccumulators, channel);
|
||||
}
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
HAL_GyroHandle handle;
|
||||
auto gyro = analogGyroHandles->Allocate(channel, &handle, status);
|
||||
|
||||
if (*status != 0) {
|
||||
if (gyro) {
|
||||
hal::SetLastErrorPreviouslyAllocated(status, "Analog Gyro", channel,
|
||||
gyro->previousAllocation);
|
||||
} else {
|
||||
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Analog Gyro",
|
||||
0, kNumAccumulators, channel);
|
||||
}
|
||||
return HAL_kInvalidHandle; // failed to allocate. Pass error back.
|
||||
}
|
||||
|
||||
gyro->handle = analogHandle;
|
||||
gyro->index = channel;
|
||||
|
||||
SimAnalogGyroData[channel].initialized = true;
|
||||
|
||||
gyro->previousAllocation = allocationLocation ? allocationLocation : "";
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
// No op
|
||||
}
|
||||
|
||||
void HAL_FreeAnalogGyro(HAL_GyroHandle handle) {
|
||||
auto gyro = analogGyroHandles->Get(handle);
|
||||
analogGyroHandles->Free(handle);
|
||||
if (gyro == nullptr) {
|
||||
return;
|
||||
}
|
||||
SimAnalogGyroData[gyro->index].initialized = false;
|
||||
}
|
||||
|
||||
void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
|
||||
double voltsPerDegreePerSecond, double offset,
|
||||
int32_t center, int32_t* status) {
|
||||
// No op
|
||||
}
|
||||
|
||||
void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
|
||||
double voltsPerDegreePerSecond,
|
||||
int32_t* status) {
|
||||
// No op
|
||||
}
|
||||
|
||||
void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
auto gyro = analogGyroHandles->Get(handle);
|
||||
if (gyro == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogGyroData[gyro->index].angle = 0.0;
|
||||
}
|
||||
|
||||
void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
// Just do a reset
|
||||
HAL_ResetAnalogGyro(handle, status);
|
||||
}
|
||||
|
||||
void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
|
||||
int32_t* status) {
|
||||
// No op
|
||||
}
|
||||
|
||||
double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status) {
|
||||
auto gyro = analogGyroHandles->Get(handle);
|
||||
if (gyro == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimAnalogGyroData[gyro->index].angle;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status) {
|
||||
auto gyro = analogGyroHandles->Get(handle);
|
||||
if (gyro == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimAnalogGyroData[gyro->index].rate;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "HALInitializer.h"
|
||||
#include "HALInternal.h"
|
||||
#include "PortsInternal.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
#include "mockdata/AnalogInDataInternal.h"
|
||||
|
||||
@@ -46,14 +45,9 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
|
||||
}
|
||||
|
||||
analog_port->channel = static_cast<uint8_t>(channel);
|
||||
if (HAL_IsAccumulatorChannel(handle, status)) {
|
||||
analog_port->isAccumulator = true;
|
||||
} else {
|
||||
analog_port->isAccumulator = false;
|
||||
}
|
||||
analog_port->isAccumulator = false;
|
||||
|
||||
SimAnalogInData[channel].initialized = true;
|
||||
SimAnalogInData[channel].accumulatorInitialized = false;
|
||||
SimAnalogInData[channel].simDevice = 0;
|
||||
|
||||
analog_port->previousAllocation =
|
||||
@@ -69,7 +63,6 @@ void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle) {
|
||||
return;
|
||||
}
|
||||
SimAnalogInData[port->channel].initialized = false;
|
||||
SimAnalogInData[port->channel].accumulatorInitialized = false;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_CheckAnalogModule(int32_t module) {
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace hal::init {
|
||||
void InitializeHAL() {
|
||||
InitializeAccelerometerData();
|
||||
InitializeAddressableLEDData();
|
||||
InitializeAnalogGyroData();
|
||||
InitializeAnalogInData();
|
||||
InitializeAnalogTriggerData();
|
||||
InitializeCanData();
|
||||
@@ -87,8 +86,6 @@ void InitializeHAL() {
|
||||
InitializeSimDeviceData();
|
||||
InitializeAccelerometer();
|
||||
InitializeAddressableLED();
|
||||
InitializeAnalogAccumulator();
|
||||
InitializeAnalogGyro();
|
||||
InitializeAnalogInput();
|
||||
InitializeAnalogInternal();
|
||||
InitializeAnalogTrigger();
|
||||
|
||||
@@ -18,7 +18,6 @@ inline void CheckInit() {
|
||||
|
||||
extern void InitializeAccelerometerData();
|
||||
extern void InitializeAddressableLEDData();
|
||||
extern void InitializeAnalogGyroData();
|
||||
extern void InitializeAnalogInData();
|
||||
extern void InitializeAnalogTriggerData();
|
||||
extern void InitializeCanData();
|
||||
@@ -38,8 +37,6 @@ extern void InitializeRoboRioData();
|
||||
extern void InitializeSimDeviceData();
|
||||
extern void InitializeAccelerometer();
|
||||
extern void InitializeAddressableLED();
|
||||
extern void InitializeAnalogAccumulator();
|
||||
extern void InitializeAnalogGyro();
|
||||
extern void InitializeAnalogInput();
|
||||
extern void InitializeAnalogInternal();
|
||||
extern void InitializeAnalogTrigger();
|
||||
|
||||
@@ -13,9 +13,6 @@ void InitializePorts() {}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
int32_t HAL_GetNumAccumulators(void) {
|
||||
return kNumAccumulators;
|
||||
}
|
||||
int32_t HAL_GetNumAnalogTriggers(void) {
|
||||
return kNumAnalogTriggers;
|
||||
}
|
||||
|
||||
@@ -1,48 +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 "../PortsInternal.h"
|
||||
#include "AnalogGyroDataInternal.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeAnalogGyroData() {
|
||||
static AnalogGyroData agd[kNumAccumulators];
|
||||
::hal::SimAnalogGyroData = agd;
|
||||
}
|
||||
} // namespace hal::init
|
||||
|
||||
AnalogGyroData* hal::SimAnalogGyroData;
|
||||
void AnalogGyroData::ResetData() {
|
||||
angle.Reset(0.0);
|
||||
rate.Reset(0.0);
|
||||
initialized.Reset(false);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogGyroData(int32_t index) {
|
||||
SimAnalogGyroData[index].ResetData();
|
||||
}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, LOWERNAME) \
|
||||
HAL_SIMDATAVALUE_DEFINE_CAPI(TYPE, HALSIM, AnalogGyro##CAPINAME, \
|
||||
SimAnalogGyroData, LOWERNAME)
|
||||
|
||||
DEFINE_CAPI(double, Angle, angle)
|
||||
DEFINE_CAPI(double, Rate, rate)
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, initialized)
|
||||
|
||||
#define REGISTER(NAME) \
|
||||
SimAnalogGyroData[index].NAME.RegisterCallback(callback, param, initialNotify)
|
||||
|
||||
void HALSIM_RegisterAnalogGyroAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {
|
||||
REGISTER(angle);
|
||||
REGISTER(rate);
|
||||
REGISTER(initialized);
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,25 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/simulation/AnalogGyroData.h"
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
namespace hal {
|
||||
class AnalogGyroData {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Angle)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Rate)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
|
||||
|
||||
public:
|
||||
SimDataValue<double, HAL_MakeDouble, GetAngleName> angle{0.0};
|
||||
SimDataValue<double, HAL_MakeDouble, GetRateName> rate{0.0};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
|
||||
false};
|
||||
|
||||
virtual void ResetData();
|
||||
};
|
||||
extern AnalogGyroData* SimAnalogGyroData;
|
||||
} // namespace hal
|
||||
@@ -21,11 +21,6 @@ void AnalogInData::ResetData() {
|
||||
averageBits.Reset(7);
|
||||
oversampleBits.Reset(0);
|
||||
voltage.Reset(0.0);
|
||||
accumulatorInitialized.Reset(false);
|
||||
accumulatorValue.Reset(0);
|
||||
accumulatorCount.Reset(0);
|
||||
accumulatorCenter.Reset(0);
|
||||
accumulatorDeadband.Reset(0);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@@ -45,11 +40,6 @@ DEFINE_CAPI(HAL_Bool, Initialized, initialized)
|
||||
DEFINE_CAPI(int32_t, AverageBits, averageBits)
|
||||
DEFINE_CAPI(int32_t, OversampleBits, oversampleBits)
|
||||
DEFINE_CAPI(double, Voltage, voltage)
|
||||
DEFINE_CAPI(HAL_Bool, AccumulatorInitialized, accumulatorInitialized)
|
||||
DEFINE_CAPI(int64_t, AccumulatorValue, accumulatorValue)
|
||||
DEFINE_CAPI(int64_t, AccumulatorCount, accumulatorCount)
|
||||
DEFINE_CAPI(int32_t, AccumulatorCenter, accumulatorCenter)
|
||||
DEFINE_CAPI(int32_t, AccumulatorDeadband, accumulatorDeadband)
|
||||
|
||||
#define REGISTER(NAME) \
|
||||
SimAnalogInData[index].NAME.RegisterCallback(callback, param, initialNotify)
|
||||
@@ -61,10 +51,5 @@ void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
|
||||
REGISTER(averageBits);
|
||||
REGISTER(oversampleBits);
|
||||
REGISTER(voltage);
|
||||
REGISTER(accumulatorInitialized);
|
||||
REGISTER(accumulatorValue);
|
||||
REGISTER(accumulatorCount);
|
||||
REGISTER(accumulatorCenter);
|
||||
REGISTER(accumulatorDeadband);
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
@@ -13,11 +13,6 @@ class AnalogInData {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AverageBits)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(OversampleBits)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Voltage)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorInitialized)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorValue)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorCount)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorCenter)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorDeadband)
|
||||
|
||||
public:
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
|
||||
@@ -26,16 +21,6 @@ class AnalogInData {
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetAverageBitsName> averageBits{7};
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetOversampleBitsName> oversampleBits{0};
|
||||
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{0.0};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetAccumulatorInitializedName>
|
||||
accumulatorInitialized{false};
|
||||
SimDataValue<int64_t, HAL_MakeLong, GetAccumulatorValueName> accumulatorValue{
|
||||
0};
|
||||
SimDataValue<int64_t, HAL_MakeLong, GetAccumulatorCountName> accumulatorCount{
|
||||
0};
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetAccumulatorCenterName>
|
||||
accumulatorCenter{0};
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetAccumulatorDeadbandName>
|
||||
accumulatorDeadband{0};
|
||||
|
||||
virtual void ResetData();
|
||||
};
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <hal/simulation/AccelerometerData.h>
|
||||
#include <hal/simulation/AddressableLEDData.h>
|
||||
#include <hal/simulation/AnalogGyroData.h>
|
||||
#include <hal/simulation/AnalogInData.h>
|
||||
#include <hal/simulation/AnalogTriggerData.h>
|
||||
#include <hal/simulation/CTREPCMData.h>
|
||||
@@ -32,10 +31,6 @@ extern "C" void HALSIM_ResetAllSimData(void) {
|
||||
HALSIM_ResetAddressableLEDData(i);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < hal::kNumAccumulators; i++) {
|
||||
HALSIM_ResetAnalogGyroData(i);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < hal::kNumAnalogInputs; i++) {
|
||||
HALSIM_ResetAnalogInData(i);
|
||||
}
|
||||
|
||||
@@ -1,65 +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 "hal/AnalogAccumulator.h"
|
||||
|
||||
#include "hal/HAL.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeAnalogAccumulator() {}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
|
||||
HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t center, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t deadband, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
|
||||
int64_t* value, int64_t* count, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -1,92 +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 "hal/AnalogGyro.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <wpi/print.h>
|
||||
|
||||
#include "HALInitializer.h"
|
||||
#include "HALInternal.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/AnalogInput.h"
|
||||
#include "hal/handles/IndexedHandleResource.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeAnalogGyro() {}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
|
||||
HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle analogHandle,
|
||||
const char* allocationLocation,
|
||||
int32_t* status) {
|
||||
hal::init::CheckInit();
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_FreeAnalogGyro(HAL_GyroHandle handle) {}
|
||||
|
||||
void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
|
||||
double voltsPerDegreePerSecond, double offset,
|
||||
int32_t center, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
|
||||
double voltsPerDegreePerSecond,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "HALInternal.h"
|
||||
#include "PortsInternal.h"
|
||||
#include "SmartIo.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/Errors.h"
|
||||
#include "hal/cpp/fpga_clock.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#include <wpi/print.h>
|
||||
|
||||
#include "PortsInternal.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
#include "hal/AnalogGyro.h"
|
||||
#include "hal/AnalogInput.h"
|
||||
#include "hal/Errors.h"
|
||||
#include "hal/HALBase.h"
|
||||
|
||||
@@ -50,8 +50,6 @@ void InitializeHAL() {
|
||||
InitializeREVPH();
|
||||
InitializeAddressableLED();
|
||||
InitializeAccelerometer();
|
||||
InitializeAnalogAccumulator();
|
||||
InitializeAnalogGyro();
|
||||
InitializeAnalogInput();
|
||||
InitializeAnalogTrigger();
|
||||
InitializeCAN();
|
||||
|
||||
@@ -20,8 +20,6 @@ extern void InitializeCTREPCM();
|
||||
extern void InitializeREVPH();
|
||||
extern void InitializeAccelerometer();
|
||||
extern void InitializeAddressableLED();
|
||||
extern void InitializeAnalogAccumulator();
|
||||
extern void InitializeAnalogGyro();
|
||||
extern void InitializeAnalogInput();
|
||||
extern void InitializeAnalogInternal();
|
||||
extern void InitializeAnalogTrigger();
|
||||
|
||||
@@ -13,10 +13,6 @@ void InitializePorts() {}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t HAL_GetNumAccumulators(void) {
|
||||
return kNumAccumulators;
|
||||
}
|
||||
int32_t HAL_GetNumAnalogTriggers(void) {
|
||||
return kNumAnalogTriggers;
|
||||
}
|
||||
|
||||
@@ -1,23 +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 "hal/simulation/AnalogGyroData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogGyroData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogGyro##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(double, Angle, 0)
|
||||
DEFINE_CAPI(double, Rate, 0)
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
|
||||
void HALSIM_RegisterAnalogGyroAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
@@ -20,11 +20,6 @@ DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, AverageBits, 0)
|
||||
DEFINE_CAPI(int32_t, OversampleBits, 0)
|
||||
DEFINE_CAPI(double, Voltage, 0)
|
||||
DEFINE_CAPI(HAL_Bool, AccumulatorInitialized, false)
|
||||
DEFINE_CAPI(int64_t, AccumulatorValue, 0)
|
||||
DEFINE_CAPI(int64_t, AccumulatorCount, 0)
|
||||
DEFINE_CAPI(int32_t, AccumulatorCenter, 0)
|
||||
DEFINE_CAPI(int32_t, AccumulatorDeadband, 0)
|
||||
|
||||
void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
|
||||
Reference in New Issue
Block a user