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 EncoderJNI extends JNIWrapper {
008  public static native int initializeEncoder(
009      int digitalSourceHandleA,
010      int analogTriggerTypeA,
011      int digitalSourceHandleB,
012      int analogTriggerTypeB,
013      boolean reverseDirection,
014      int encodingType);
015
016  public static native void freeEncoder(int encoderHandle);
017
018  public static native void setEncoderSimDevice(int handle, int device);
019
020  public static native int getEncoder(int encoderHandle);
021
022  public static native int getEncoderRaw(int encoderHandle);
023
024  public static native int getEncodingScaleFactor(int encoderHandle);
025
026  public static native void resetEncoder(int encoderHandle);
027
028  public static native double getEncoderPeriod(int encoderHandle);
029
030  public static native void setEncoderMaxPeriod(int encoderHandle, double maxPeriod);
031
032  public static native boolean getEncoderStopped(int encoderHandle);
033
034  public static native boolean getEncoderDirection(int encoderHandle);
035
036  public static native double getEncoderDistance(int encoderHandle);
037
038  public static native double getEncoderRate(int encoderHandle);
039
040  public static native void setEncoderMinRate(int encoderHandle, double minRate);
041
042  public static native void setEncoderDistancePerPulse(int encoderHandle, double distancePerPulse);
043
044  public static native void setEncoderReverseDirection(int encoderHandle, boolean reverseDirection);
045
046  public static native void setEncoderSamplesToAverage(int encoderHandle, int samplesToAverage);
047
048  public static native int getEncoderSamplesToAverage(int encoderHandle);
049
050  public static native void setEncoderIndexSource(
051      int encoderHandle, int digitalSourceHandle, int analogTriggerType, int indexingType);
052
053  public static native int getEncoderFPGAIndex(int encoderHandle);
054
055  public static native int getEncoderEncodingScale(int encoderHandle);
056
057  public static native double getEncoderDecodingScaleFactor(int encoderHandle);
058
059  public static native double getEncoderDistancePerPulse(int encoderHandle);
060
061  public static native int getEncoderEncodingType(int encoderHandle);
062}