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 @SuppressWarnings("AbbreviationAsWordInName") 054 public static native int getEncoderFPGAIndex(int encoderHandle); 055 056 public static native int getEncoderEncodingScale(int encoderHandle); 057 058 public static native double getEncoderDecodingScaleFactor(int encoderHandle); 059 060 public static native double getEncoderDistancePerPulse(int encoderHandle); 061 062 public static native int getEncoderEncodingType(int encoderHandle); 063}