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

io.silverspoon.bulldog.beagleboneblack.jni.NativePwm Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package io.silverspoon.bulldog.beagleboneblack.jni;

public class NativePwm {

   public static native int setup();

   public static native void teardown();

   public static native int setPwm(int pwmId, float frequency, float dutyA, float dutyB);

   public static native void enable(int pwmId);

   public static native void disable(int pwmId);

   private static boolean isInitialized = false;

   static {
      initialize();
   }

   public static void initialize() {
      if (isInitialized) {
         return;
      }
      setup();
      isInitialized = true;
      Runtime.getRuntime().addShutdownHook(new Thread() {
         @Override
         public void run() {
            deinitialize();
         }
      });
   }

   public static void deinitialize() {
      if (isInitialized) {
         teardown();
         isInitialized = false;
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy