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
007import java.nio.ByteBuffer;
008
009@SuppressWarnings("AbbreviationAsWordInName")
010public class I2CJNI extends JNIWrapper {
011  public static native void i2CInitialize(int port);
012
013  public static native int i2CTransaction(
014      int port,
015      byte address,
016      ByteBuffer dataToSend,
017      byte sendSize,
018      ByteBuffer dataReceived,
019      byte receiveSize);
020
021  public static native int i2CTransactionB(
022      int port,
023      byte address,
024      byte[] dataToSend,
025      byte sendSize,
026      byte[] dataReceived,
027      byte receiveSize);
028
029  public static native int i2CWrite(int port, byte address, ByteBuffer dataToSend, byte sendSize);
030
031  public static native int i2CWriteB(int port, byte address, byte[] dataToSend, byte sendSize);
032
033  public static native int i2CRead(
034      int port, byte address, ByteBuffer dataReceived, byte receiveSize);
035
036  public static native int i2CReadB(int port, byte address, byte[] dataReceived, byte receiveSize);
037
038  public static native void i2CClose(int port);
039}