001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.hal;
006
007public class AnalogJNI extends JNIWrapper {
008  /**
009   * <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:58</i><br>
010   * enum values
011   */
012  public interface AnalogTriggerType {
013    /** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:54</i> */
014    int kInWindow = 0;
015    /** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:55</i> */
016    int kState = 1;
017    /** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:56</i> */
018    int kRisingPulse = 2;
019    /** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:57</i> */
020    int kFallingPulse = 3;
021  }
022
023  public static native int initializeAnalogInputPort(int halPortHandle);
024
025  public static native void freeAnalogInputPort(int portHandle);
026
027  public static native int initializeAnalogOutputPort(int halPortHandle);
028
029  public static native void freeAnalogOutputPort(int portHandle);
030
031  public static native boolean checkAnalogModule(byte module);
032
033  public static native boolean checkAnalogInputChannel(int channel);
034
035  public static native boolean checkAnalogOutputChannel(int channel);
036
037  public static native void setAnalogInputSimDevice(int handle, int device);
038
039  public static native void setAnalogOutput(int portHandle, double voltage);
040
041  public static native double getAnalogOutput(int portHandle);
042
043  public static native void setAnalogSampleRate(double samplesPerSecond);
044
045  public static native double getAnalogSampleRate();
046
047  public static native void setAnalogAverageBits(int analogPortHandle, int bits);
048
049  public static native int getAnalogAverageBits(int analogPortHandle);
050
051  public static native void setAnalogOversampleBits(int analogPortHandle, int bits);
052
053  public static native int getAnalogOversampleBits(int analogPortHandle);
054
055  public static native short getAnalogValue(int analogPortHandle);
056
057  public static native int getAnalogAverageValue(int analogPortHandle);
058
059  public static native int getAnalogVoltsToValue(int analogPortHandle, double voltage);
060
061  public static native double getAnalogValueToVolts(int analogPortHandle, int value);
062
063  public static native double getAnalogVoltage(int analogPortHandle);
064
065  public static native double getAnalogAverageVoltage(int analogPortHandle);
066
067  public static native int getAnalogLSBWeight(int analogPortHandle);
068
069  public static native int getAnalogOffset(int analogPortHandle);
070
071  public static native boolean isAccumulatorChannel(int analogPortHandle);
072
073  public static native void initAccumulator(int analogPortHandle);
074
075  public static native void resetAccumulator(int analogPortHandle);
076
077  public static native void setAccumulatorCenter(int analogPortHandle, int center);
078
079  public static native void setAccumulatorDeadband(int analogPortHandle, int deadband);
080
081  public static native long getAccumulatorValue(int analogPortHandle);
082
083  public static native int getAccumulatorCount(int analogPortHandle);
084
085  public static native void getAccumulatorOutput(int analogPortHandle, AccumulatorResult result);
086
087  public static native int initializeAnalogTrigger(int analogInputHandle);
088
089  public static native int initializeAnalogTriggerDutyCycle(int dutyCycleHandle);
090
091  public static native void cleanAnalogTrigger(int analogTriggerHandle);
092
093  public static native void setAnalogTriggerLimitsRaw(
094      int analogTriggerHandle, int lower, int upper);
095
096  public static native void setAnalogTriggerLimitsDutyCycle(
097      int analogTriggerHandle, double lower, double higher);
098
099  public static native void setAnalogTriggerLimitsVoltage(
100      int analogTriggerHandle, double lower, double upper);
101
102  public static native void setAnalogTriggerAveraged(
103      int analogTriggerHandle, boolean useAveragedValue);
104
105  public static native void setAnalogTriggerFiltered(
106      int analogTriggerHandle, boolean useFilteredValue);
107
108  public static native boolean getAnalogTriggerInWindow(int analogTriggerHandle);
109
110  public static native boolean getAnalogTriggerTriggerState(int analogTriggerHandle);
111
112  public static native boolean getAnalogTriggerOutput(int analogTriggerHandle, int type);
113
114  @SuppressWarnings("AbbreviationAsWordInName")
115  public static native int getAnalogTriggerFPGAIndex(int analogTriggerHandle);
116}