All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sources.Gpio Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.6
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package mraa;

public class Gpio {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected Gpio(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(Gpio obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        mraaJNI.delete_Gpio(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public Gpio(int pin, boolean owner, boolean raw) {
    this(mraaJNI.new_Gpio__SWIG_0(pin, owner, raw), true);
  }

  public Gpio(int pin, boolean owner) {
    this(mraaJNI.new_Gpio__SWIG_1(pin, owner), true);
  }

  public Gpio(int pin) {
    this(mraaJNI.new_Gpio__SWIG_2(pin), true);
  }

  public Result edge(Edge mode) {
    return Result.swigToEnum(mraaJNI.Gpio_edge(swigCPtr, this, mode.swigValue()));
  }

  public Result isr(Edge mode, java.lang.Runnable runnable) {
    return Result.swigToEnum(mraaJNI.Gpio_isr(swigCPtr, this, mode.swigValue(), runnable));
  }

  public Result isrExit() {
    return Result.swigToEnum(mraaJNI.Gpio_isrExit(swigCPtr, this));
  }

  public Result mode(Mode mode) {
    return Result.swigToEnum(mraaJNI.Gpio_mode(swigCPtr, this, mode.swigValue()));
  }

  public Result dir(Dir dir) {
    return Result.swigToEnum(mraaJNI.Gpio_dir(swigCPtr, this, dir.swigValue()));
  }

  public Dir readDir() {
    return Dir.swigToEnum(mraaJNI.Gpio_readDir(swigCPtr, this));
  }

  public int read() {
    return mraaJNI.Gpio_read(swigCPtr, this);
  }

  public Result write(int value) {
    return Result.swigToEnum(mraaJNI.Gpio_write(swigCPtr, this, value));
  }

  public Result useMmap(boolean enable) {
    return Result.swigToEnum(mraaJNI.Gpio_useMmap(swigCPtr, this, enable));
  }

  public int getPin(boolean raw) {
    return mraaJNI.Gpio_getPin__SWIG_0(swigCPtr, this, raw);
  }

  public int getPin() {
    return mraaJNI.Gpio_getPin__SWIG_1(swigCPtr, this);
  }

  public Result inputMode(InputMode mode) {
    return Result.swigToEnum(mraaJNI.Gpio_inputMode(swigCPtr, this, mode.swigValue()));
  }

  public Result outputMode(OutputMode mode) {
    return Result.swigToEnum(mraaJNI.Gpio_outputMode(swigCPtr, this, mode.swigValue()));
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy