mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[hal,wpilib] Remove a ton of things related to the FPGA (#7846)
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
This commit is contained in:
@@ -86,95 +86,6 @@ Java_org_wpilib_hardware_hal_AnalogInputJNI_setAnalogInputSimDevice
|
||||
(HAL_SimDeviceHandle)device);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: setAnalogSampleRate
|
||||
* Signature: (D)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_setAnalogSampleRate
|
||||
(JNIEnv* env, jclass, jdouble value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogSampleRate(value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogSampleRate
|
||||
* Signature: ()D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogSampleRate
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double returnValue = HAL_GetAnalogSampleRate(&status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: setAnalogAverageBits
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_setAnalogAverageBits
|
||||
(JNIEnv* env, jclass, jint id, jint value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogAverageBits((HAL_AnalogInputHandle)id, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogAverageBits
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogAverageBits
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jint returnValue =
|
||||
HAL_GetAnalogAverageBits((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: setAnalogOversampleBits
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_setAnalogOversampleBits
|
||||
(JNIEnv* env, jclass, jint id, jint value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogOversampleBits((HAL_AnalogInputHandle)id, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogOversampleBits
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogOversampleBits
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jint returnValue =
|
||||
HAL_GetAnalogOversampleBits((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogValue
|
||||
@@ -190,22 +101,6 @@ Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogValue
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogAverageValue
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogAverageValue
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jint returnValue =
|
||||
HAL_GetAnalogAverageValue((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogVoltsToValue
|
||||
@@ -254,52 +149,4 @@ Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogVoltage
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogAverageVoltage
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogAverageVoltage
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jdouble returnValue =
|
||||
HAL_GetAnalogAverageVoltage((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogLSBWeight
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogLSBWeight
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
|
||||
jint returnValue = HAL_GetAnalogLSBWeight((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_AnalogInputJNI
|
||||
* Method: getAnalogOffset
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_AnalogInputJNI_getAnalogOffset
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
|
||||
jint returnValue = HAL_GetAnalogOffset((HAL_AnalogInputHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -1,28 +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 "HALUtil.hpp"
|
||||
#include "org_wpilib_hardware_hal_ConstantsJNI.h"
|
||||
#include "wpi/hal/Constants.h"
|
||||
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_ConstantsJNI
|
||||
* Method: getSystemClockTicksPerMicrosecond
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_ConstantsJNI_getSystemClockTicksPerMicrosecond
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetSystemClockTicksPerMicrosecond();
|
||||
return value;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -24,10 +24,6 @@
|
||||
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO ==
|
||||
HAL_RUNTIME_ROBORIO);
|
||||
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO_2 ==
|
||||
HAL_RUNTIME_ROBORIO_2);
|
||||
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_SIMULATION ==
|
||||
HAL_RUNTIME_SIMULATION);
|
||||
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_SYSTEMCORE ==
|
||||
|
||||
@@ -28,92 +28,14 @@ Java_org_wpilib_hardware_hal_PortsJNI_getNumCanBuses
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumAnalogInputs
|
||||
* Method: getNumSmartIo
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumAnalogInputs
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumSmartIo
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumAnalogInputs();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumCounters
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumCounters
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumCounters();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumDigitalChannels
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumDigitalChannels
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumDigitalChannels();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumPWMChannels
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumPWMChannels
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumPWMChannels();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumDigitalPWMOutputs
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumDigitalPWMOutputs
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumDigitalPWMOutputs();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumEncoders
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumEncoders
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumEncoders();
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_PortsJNI
|
||||
* Method: getNumInterrupts
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_PortsJNI_getNumInterrupts
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
jint value = HAL_GetNumInterrupts();
|
||||
jint value = HAL_GetNumSmartIo();
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,106 +62,6 @@ Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_setInitialized
|
||||
HALSIM_SetAnalogInInitialized(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerAverageBitsCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_registerAverageBitsCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInAverageBitsCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelAverageBitsCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_cancelAverageBitsCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogInAverageBitsCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: getAverageBits
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_getAverageBits
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInAverageBits(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: setAverageBits
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_setAverageBits
|
||||
(JNIEnv*, jclass, jint index, jint value)
|
||||
{
|
||||
HALSIM_SetAnalogInAverageBits(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerOversampleBitsCallback
|
||||
* Signature: (ILjava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_registerOversampleBitsCallback
|
||||
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallback(env, index, callback, initialNotify,
|
||||
&HALSIM_RegisterAnalogInOversampleBitsCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: cancelOversampleBitsCallback
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_cancelOversampleBitsCallback
|
||||
(JNIEnv* env, jclass, jint index, jint handle)
|
||||
{
|
||||
return sim::FreeCallback(env, handle, index,
|
||||
&HALSIM_CancelAnalogInOversampleBitsCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: getOversampleBits
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_getOversampleBits
|
||||
(JNIEnv*, jclass, jint index)
|
||||
{
|
||||
return HALSIM_GetAnalogInOversampleBits(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: setOversampleBits
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_AnalogInDataJNI_setOversampleBits
|
||||
(JNIEnv*, jclass, jint index, jint value)
|
||||
{
|
||||
HALSIM_SetAnalogInOversampleBits(index, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_simulation_AnalogInDataJNI
|
||||
* Method: registerVoltageCallback
|
||||
|
||||
@@ -64,83 +64,6 @@ HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel);
|
||||
void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle,
|
||||
HAL_SimDeviceHandle device);
|
||||
|
||||
/**
|
||||
* Sets the sample rate.
|
||||
*
|
||||
* This is a global setting for the Athena and effects all channels.
|
||||
*
|
||||
* @param[in] samplesPerSecond The number of samples per channel per second.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the current sample rate.
|
||||
*
|
||||
* This assumes one entry in the scan list.
|
||||
* This is a global setting for the Athena and effects all channels.
|
||||
*
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return Sample rate.
|
||||
*/
|
||||
double HAL_GetAnalogSampleRate(int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets the number of averaging bits.
|
||||
*
|
||||
* This sets the number of averaging bits. The actual number of averaged samples
|
||||
* is 2**bits. Use averaging to improve the stability of your measurement at the
|
||||
* expense of sampling rate. The averaging is done automatically in the FPGA.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to configure.
|
||||
* @param[in] bits Number of bits to average.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t bits, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the number of averaging bits.
|
||||
*
|
||||
* This gets the number of averaging bits from the FPGA. The actual number of
|
||||
* averaged samples is 2**bits. The averaging is done automatically in the FPGA.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return Bits to average.
|
||||
*/
|
||||
int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets the number of oversample bits.
|
||||
*
|
||||
* This sets the number of oversample bits. The actual number of oversampled
|
||||
* values is 2**bits. Use oversampling to improve the resolution of your
|
||||
* measurements at the expense of sampling rate. The oversampling is done
|
||||
* automatically in the FPGA.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[in] bits Number of bits to oversample.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t bits, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the number of oversample bits.
|
||||
*
|
||||
* This gets the number of oversample bits from the FPGA. The actual number of
|
||||
* oversampled values is 2**bits. The oversampling is done automatically in the
|
||||
* FPGA.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return Bits to oversample.
|
||||
*/
|
||||
int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets a sample straight from the channel on this module.
|
||||
*
|
||||
@@ -155,24 +78,6 @@ int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets a sample from the output of the oversample and average engine for the
|
||||
* channel.
|
||||
*
|
||||
* The sample is 12-bit + the value configured in SetOversampleBits().
|
||||
* The value configured in SetAverageBits() will cause this value to be averaged
|
||||
* 2**bits number of samples. This is not a sliding window. The sample will not
|
||||
* change until 2**(OversampleBits + AverageBits) samples have been acquired
|
||||
* from the module on this channel. Use GetAverageVoltage() to get the analog
|
||||
* value in calibrated units.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return A sample from the oversample and average engine for the channel.
|
||||
*/
|
||||
int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Converts a voltage to a raw value for a specified channel.
|
||||
*
|
||||
@@ -192,8 +97,7 @@ int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
/**
|
||||
* Gets a scaled sample straight from the channel on this module.
|
||||
*
|
||||
* The value is scaled to units of Volts using the calibrated scaling data from
|
||||
* GetLSBWeight() and GetOffset().
|
||||
* The value is scaled to units of Volts.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
@@ -202,51 +106,6 @@ int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets a scaled sample from the output of the oversample and average engine for
|
||||
* the channel.
|
||||
*
|
||||
* The value is scaled to units of Volts using the calibrated scaling data from
|
||||
* GetLSBWeight() and GetOffset(). Using oversampling will cause this value to
|
||||
* be higher resolution, but it will update more slowly. Using averaging will
|
||||
* cause this value to be more stable, but it will update more slowly.
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return A scaled sample from the output of the oversample and average engine
|
||||
* for the channel.
|
||||
*/
|
||||
double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the factory scaling least significant bit weight constant.
|
||||
* The least significant bit weight constant for the channel that was calibrated
|
||||
* in manufacturing and stored in an eeprom in the module.
|
||||
*
|
||||
* Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return Least significant bit weight.
|
||||
*/
|
||||
int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the factory scaling offset constant.
|
||||
* The offset constant for the channel that was calibrated in manufacturing and
|
||||
* stored in an eeprom in the module.
|
||||
*
|
||||
* Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
|
||||
*
|
||||
* @param[in] analogPortHandle Handle to the analog port to use.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return Offset constant.
|
||||
*/
|
||||
int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Get the analog voltage from a raw value.
|
||||
*
|
||||
|
||||
@@ -1,28 +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>
|
||||
|
||||
/**
|
||||
* @defgroup hal_constants Constants Functions
|
||||
* @ingroup hal_capi
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Gets the number of FPGA system clock ticks per microsecond.
|
||||
*
|
||||
* @return the number of clock ticks per microsecond
|
||||
*/
|
||||
int32_t HAL_GetSystemClockTicksPerMicrosecond(void);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
/** @} */
|
||||
@@ -25,14 +25,10 @@
|
||||
* Runtime type.
|
||||
*/
|
||||
HAL_ENUM(HAL_RuntimeType) {
|
||||
/** roboRIO 1.0 */
|
||||
HAL_RUNTIME_ROBORIO,
|
||||
/** roboRIO 2.0 */
|
||||
HAL_RUNTIME_ROBORIO_2,
|
||||
/** Simulation runtime */
|
||||
HAL_RUNTIME_SIMULATION,
|
||||
/** Systemcore */
|
||||
/** Systemcore runtime */
|
||||
HAL_RUNTIME_SYSTEMCORE,
|
||||
/** Simulation runtime */
|
||||
HAL_RUNTIME_SIMULATION
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -23,6 +23,13 @@ extern "C" {
|
||||
*/
|
||||
int32_t HAL_GetNumCanBuses(void);
|
||||
|
||||
/**
|
||||
* Gets the number of smart IO channels in the current system.
|
||||
*
|
||||
* @return the number of SmartIO
|
||||
*/
|
||||
int32_t HAL_GetNumSmartIo(void);
|
||||
|
||||
/**
|
||||
* Gets the number of analog inputs in the current system.
|
||||
*
|
||||
|
||||
@@ -22,21 +22,6 @@ void HALSIM_SetAnalogInInitialized(int32_t index, HAL_Bool initialized);
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInAverageBitsCallback(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInAverageBitsCallback(int32_t index, int32_t uid);
|
||||
int32_t HALSIM_GetAnalogInAverageBits(int32_t index);
|
||||
void HALSIM_SetAnalogInAverageBits(int32_t index, int32_t averageBits);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInOversampleBitsCallback(
|
||||
int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelAnalogInOversampleBitsCallback(int32_t index, int32_t uid);
|
||||
int32_t HALSIM_GetAnalogInOversampleBits(int32_t index);
|
||||
void HALSIM_SetAnalogInOversampleBits(int32_t index, int32_t oversampleBits);
|
||||
|
||||
int32_t HALSIM_RegisterAnalogInVoltageCallback(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
|
||||
@@ -18,13 +18,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
void HALSIM_ResetRoboRioData(void);
|
||||
int32_t HALSIM_RegisterRoboRioFPGAButtonCallback(HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelRoboRioFPGAButtonCallback(int32_t uid);
|
||||
HAL_Bool HALSIM_GetRoboRioFPGAButton(void);
|
||||
void HALSIM_SetRoboRioFPGAButton(HAL_Bool fPGAButton);
|
||||
|
||||
int32_t HALSIM_RegisterRoboRioVInVoltageCallback(HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
|
||||
@@ -43,7 +43,6 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
|
||||
}
|
||||
|
||||
analog_port->channel = static_cast<uint8_t>(channel);
|
||||
analog_port->isAccumulator = false;
|
||||
|
||||
SimAnalogInData[channel].initialized = true;
|
||||
SimAnalogInData[channel].simDevice = 0;
|
||||
@@ -80,52 +79,6 @@ void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle,
|
||||
SimAnalogInData[port->channel].simDevice = device;
|
||||
}
|
||||
|
||||
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status) {
|
||||
// No op
|
||||
}
|
||||
double HAL_GetAnalogSampleRate(int32_t* status) {
|
||||
return kDefaultSampleRate;
|
||||
}
|
||||
void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t bits, int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogInData[port->channel].averageBits = bits;
|
||||
}
|
||||
int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimAnalogInData[port->channel].averageBits;
|
||||
}
|
||||
void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t bits, int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
SimAnalogInData[port->channel].oversampleBits = bits;
|
||||
}
|
||||
int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimAnalogInData[port->channel].oversampleBits;
|
||||
}
|
||||
int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
@@ -137,27 +90,12 @@ int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
double voltage = SimAnalogInData[port->channel].voltage;
|
||||
return HAL_GetAnalogVoltsToValue(analogPortHandle, voltage, status);
|
||||
}
|
||||
int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
// No averaging supported
|
||||
return HAL_GetAnalogValue(analogPortHandle, status);
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
double voltage, int32_t* status) {
|
||||
if (voltage > 5.0) {
|
||||
voltage = 5.0;
|
||||
*status = VOLTAGE_OUT_OF_RANGE;
|
||||
}
|
||||
if (voltage < 0.0) {
|
||||
voltage = 0.0;
|
||||
*status = VOLTAGE_OUT_OF_RANGE;
|
||||
}
|
||||
int32_t LSBWeight = HAL_GetAnalogLSBWeight(analogPortHandle, status);
|
||||
int32_t offset = HAL_GetAnalogOffset(analogPortHandle, status);
|
||||
int32_t value =
|
||||
static_cast<int32_t>((voltage + offset * 1.0e-9) / (LSBWeight * 1.0e-9));
|
||||
return value;
|
||||
return static_cast<int32_t>(voltage * 4095.0 / 3.3);
|
||||
}
|
||||
|
||||
double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
@@ -171,29 +109,6 @@ double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
|
||||
double HAL_GetAnalogValueToVolts(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t rawValue, int32_t* status) {
|
||||
int32_t LSBWeight = HAL_GetAnalogLSBWeight(analogPortHandle, status);
|
||||
int32_t offset = HAL_GetAnalogOffset(analogPortHandle, status);
|
||||
double voltage = LSBWeight * 1.0e-9 * rawValue - offset * 1.0e-9;
|
||||
return voltage;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port = analogInputHandles->Get(analogPortHandle);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// No averaging supported
|
||||
return SimAnalogInData[port->channel].voltage;
|
||||
}
|
||||
int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
return 1220703;
|
||||
}
|
||||
int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
return rawValue / 4095.0 * 3.3;
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
@@ -13,15 +13,9 @@
|
||||
#include "wpi/hal/handles/IndexedHandleResource.hpp"
|
||||
|
||||
namespace wpi::hal {
|
||||
constexpr int32_t kTimebase = 40000000; ///< 40 MHz clock
|
||||
constexpr int32_t kDefaultOversampleBits = 0;
|
||||
constexpr int32_t kDefaultAverageBits = 7;
|
||||
constexpr double kDefaultSampleRate = 50000.0;
|
||||
static constexpr uint32_t kAccumulatorChannels[] = {0, 1};
|
||||
|
||||
struct AnalogPort {
|
||||
uint8_t channel;
|
||||
bool isAccumulator;
|
||||
std::string previousAllocation;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,19 +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 "wpi/hal/Constants.h"
|
||||
|
||||
#include "ConstantsInternal.hpp"
|
||||
|
||||
using namespace wpi::hal;
|
||||
|
||||
namespace wpi::hal::init {
|
||||
void InitializeConstants() {}
|
||||
} // namespace wpi::hal::init
|
||||
|
||||
extern "C" {
|
||||
int32_t HAL_GetSystemClockTicksPerMicrosecond(void) {
|
||||
return kSystemClockTicksPerMicrosecond;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,11 +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>
|
||||
|
||||
namespace wpi::hal {
|
||||
constexpr int32_t kSystemClockTicksPerMicrosecond = 40;
|
||||
} // namespace wpi::hal
|
||||
@@ -86,7 +86,6 @@ void InitializeHAL() {
|
||||
InitializeAnalogInput();
|
||||
InitializeAnalogInternal();
|
||||
InitializeCAN();
|
||||
InitializeConstants();
|
||||
InitializeCounter();
|
||||
InitializeDigitalInternal();
|
||||
InitializeDIO();
|
||||
|
||||
@@ -38,7 +38,6 @@ extern void InitializeAlert();
|
||||
extern void InitializeAnalogInput();
|
||||
extern void InitializeAnalogInternal();
|
||||
extern void InitializeCAN();
|
||||
extern void InitializeConstants();
|
||||
extern void InitializeCounter();
|
||||
extern void InitializeDigitalInternal();
|
||||
extern void InitializeDIO();
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <thread>
|
||||
|
||||
#include "MockHooksInternal.hpp"
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "wpi/hal/PWM.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "DigitalInternal.hpp"
|
||||
#include "HALInitializer.hpp"
|
||||
#include "HALInternal.hpp"
|
||||
|
||||
@@ -16,6 +16,9 @@ extern "C" {
|
||||
int32_t HAL_GetNumCanBuses(void) {
|
||||
return kNumCanBuses;
|
||||
}
|
||||
int32_t HAL_GetNumSmartIo(void) {
|
||||
return kNumSmartIo;
|
||||
}
|
||||
int32_t HAL_GetNumAnalogInputs(void) {
|
||||
return kNumAnalogInputs;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
namespace wpi::hal {
|
||||
constexpr int32_t kNumCanBuses = 5;
|
||||
constexpr int32_t kAccelerometers = 1;
|
||||
constexpr int32_t kNumSmartIo = 6;
|
||||
constexpr int32_t kNumAccumulators = 2;
|
||||
constexpr int32_t kNumAnalogInputs = 8;
|
||||
constexpr int32_t kNumAnalogOutputs = 2;
|
||||
|
||||
@@ -18,8 +18,6 @@ AnalogInData* wpi::hal::SimAnalogInData;
|
||||
void AnalogInData::ResetData() {
|
||||
initialized.Reset(false);
|
||||
simDevice = 0;
|
||||
averageBits.Reset(7);
|
||||
oversampleBits.Reset(0);
|
||||
voltage.Reset(0.0);
|
||||
}
|
||||
|
||||
@@ -37,8 +35,6 @@ HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index) {
|
||||
SimAnalogInData, LOWERNAME)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, initialized)
|
||||
DEFINE_CAPI(int32_t, AverageBits, averageBits)
|
||||
DEFINE_CAPI(int32_t, OversampleBits, oversampleBits)
|
||||
DEFINE_CAPI(double, Voltage, voltage)
|
||||
|
||||
#define REGISTER(NAME) \
|
||||
@@ -48,8 +44,6 @@ void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {
|
||||
REGISTER(initialized);
|
||||
REGISTER(averageBits);
|
||||
REGISTER(oversampleBits);
|
||||
REGISTER(voltage);
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
@@ -11,16 +11,12 @@
|
||||
namespace wpi::hal {
|
||||
class AnalogInData {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AverageBits)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(OversampleBits)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Voltage)
|
||||
|
||||
public:
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
|
||||
false};
|
||||
std::atomic<HAL_SimDeviceHandle> simDevice;
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetAverageBitsName> averageBits{7};
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetOversampleBitsName> oversampleBits{0};
|
||||
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{0.0};
|
||||
|
||||
virtual void ResetData();
|
||||
|
||||
@@ -96,40 +96,6 @@ HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel) {
|
||||
void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle,
|
||||
HAL_SimDeviceHandle device) {}
|
||||
|
||||
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogSampleRate(int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t bits, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t bits, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
auto port =
|
||||
@@ -144,16 +110,9 @@ int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
|
||||
double voltage, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
return static_cast<int32_t>(voltage * 4095.0 / 3.3);
|
||||
}
|
||||
|
||||
double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
@@ -173,26 +132,7 @@ double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
|
||||
double HAL_GetAnalogValueToVolts(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t rawValue, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
return rawValue / 4095.0 * 3.3;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -1,19 +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 "wpi/hal/Constants.h"
|
||||
|
||||
#include "ConstantsInternal.hpp"
|
||||
|
||||
using namespace wpi::hal;
|
||||
|
||||
namespace wpi::hal::init {
|
||||
void InitializeConstants() {}
|
||||
} // namespace wpi::hal::init
|
||||
|
||||
extern "C" {
|
||||
int32_t HAL_GetSystemClockTicksPerMicrosecond(void) {
|
||||
return kSystemClockTicksPerMicrosecond;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,11 +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>
|
||||
|
||||
namespace wpi::hal {
|
||||
constexpr int32_t kSystemClockTicksPerMicrosecond = 40;
|
||||
} // namespace wpi::hal
|
||||
@@ -42,7 +42,6 @@ void InitializeHAL() {
|
||||
InitializeAnalogInput();
|
||||
InitializeCAN();
|
||||
InitializeCANAPI();
|
||||
InitializeConstants();
|
||||
InitializeCounter();
|
||||
InitializeDIO();
|
||||
InitializeDutyCycle();
|
||||
|
||||
@@ -23,7 +23,6 @@ extern void InitializeAnalogInput();
|
||||
extern void InitializeAnalogInternal();
|
||||
extern void InitializeCAN();
|
||||
extern void InitializeCANAPI();
|
||||
extern void InitializeConstants();
|
||||
extern void InitializeCounter();
|
||||
extern void InitializeDigitalInternal();
|
||||
extern void InitializeDIO();
|
||||
|
||||
@@ -16,6 +16,9 @@ extern "C" {
|
||||
int32_t HAL_GetNumCanBuses(void) {
|
||||
return kNumCanBuses;
|
||||
}
|
||||
int32_t HAL_GetNumSmartIo(void) {
|
||||
return kNumSmartIo;
|
||||
}
|
||||
int32_t HAL_GetNumAnalogInputs(void) {
|
||||
return kNumAnalogInputs;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index) {
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogIn##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, AverageBits, 0)
|
||||
DEFINE_CAPI(int32_t, OversampleBits, 0)
|
||||
DEFINE_CAPI(double, Voltage, 0)
|
||||
|
||||
void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
|
||||
|
||||
Reference in New Issue
Block a user