001package edu.wpi.first.wpilibj.hal;
002
003import java.nio.ByteBuffer;
004import java.nio.IntBuffer;
005
006public class InterruptJNI extends JNIWrapper {
007        public interface InterruptJNIHandlerFunction {
008                void apply(int interruptAssertedMask, Object param);
009        };
010        public static native void initializeInterruptJVM(IntBuffer status);
011        public static native ByteBuffer initializeInterrupts(int interruptIndex, byte watcher, IntBuffer status);
012        public static native void cleanInterrupts(ByteBuffer interrupt_pointer, IntBuffer status);
013        public static native int waitForInterrupt(ByteBuffer interrupt_pointer, double timeout, boolean ignorePrevious, IntBuffer status);
014        public static native void enableInterrupts(ByteBuffer interrupt_pointer, IntBuffer status);
015        public static native void disableInterrupts(ByteBuffer interrupt_pointer, IntBuffer status);
016        public static native double readRisingTimestamp(ByteBuffer interrupt_pointer, IntBuffer status);
017        public static native double readFallingTimestamp(ByteBuffer interrupt_pointer, IntBuffer status);
018        public static native void requestInterrupts(ByteBuffer interrupt_pointer, byte routing_module, int routing_pin, byte routing_analog_trigger, IntBuffer status);
019        public static native void attachInterruptHandler(ByteBuffer interrupt_pointer, InterruptJNIHandlerFunction handler, Object param, IntBuffer status);
020        public static native void setInterruptUpSourceEdge(ByteBuffer interrupt_pointer, byte risingEdge, byte fallingEdge, IntBuffer status);
021}