001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
003/* Open Source Software - may be modified and shared by FRC teams. The code   */
004/* must be accompanied by the FIRST BSD license file in the root directory of */
005/* the project.                                                               */
006/*----------------------------------------------------------------------------*/
007
008package edu.wpi.first.wpilibj.hal;
009
010import java.nio.IntBuffer;
011
012public class CounterJNI extends JNIWrapper {
013  public static native int initializeCounter(int mode, IntBuffer index);
014
015  public static native void freeCounter(int counterHandle);
016
017  public static native void setCounterAverageSize(int counterHandle, int size);
018
019  public static native void setCounterUpSource(int counterHandle, int digitalSourceHandle,
020                                               int analogTriggerType);
021
022  public static native void setCounterUpSourceEdge(int counterHandle, boolean risingEdge,
023                                                   boolean fallingEdge);
024
025  public static native void clearCounterUpSource(int counterHandle);
026
027  public static native void setCounterDownSource(int counterHandle, int digitalSourceHandle,
028                                                 int analogTriggerType);
029
030  public static native void setCounterDownSourceEdge(int counterHandle, boolean risingEdge,
031                                                     boolean fallingEdge);
032
033  public static native void clearCounterDownSource(int counterHandle);
034
035  public static native void setCounterUpDownMode(int counterHandle);
036
037  public static native void setCounterExternalDirectionMode(int counterHandle);
038
039  public static native void setCounterSemiPeriodMode(int counterHandle,
040                                                     boolean highSemiPeriod);
041
042  public static native void setCounterPulseLengthMode(int counterHandle, double threshold);
043
044  public static native int getCounterSamplesToAverage(int counterHandle);
045
046  public static native void setCounterSamplesToAverage(int counterHandle,
047                                                       int samplesToAverage);
048
049  public static native void resetCounter(int counterHandle);
050
051  public static native int getCounter(int counterHandle);
052
053  public static native double getCounterPeriod(int counterHandle);
054
055  public static native void setCounterMaxPeriod(int counterHandle, double maxPeriod);
056
057  public static native void setCounterUpdateWhenEmpty(int counterHandle, boolean enabled);
058
059  public static native boolean getCounterStopped(int counterHandle);
060
061  public static native boolean getCounterDirection(int counterHandle);
062
063  public static native void setCounterReverseDirection(int counterHandle,
064                                                       boolean reverseDirection);
065}