Class PWMJNI


public class PWMJNI extends DIOJNI
PWM JNI Functions.
See Also:
  • "hal/PWM.h"
  • Method Details

    • initializePWMPort

      public static int initializePWMPort(int channel)
      Initializes a PWM port.
      Parameters:
      channel - the smartio channel
      Returns:
      the created pwm handle
    • checkPWMChannel

      public static boolean checkPWMChannel(int channel)
      Checks if a pwm channel is valid.
      Parameters:
      channel - the channel to check
      Returns:
      true if the channel is valid, otherwise false
    • freePWMPort

      public static void freePWMPort(int pwmPortHandle)
      Frees a PWM port.
      Parameters:
      pwmPortHandle - the pwm handle
    • setPWMSimDevice

      public static void setPWMSimDevice(int handle, int device)
      Indicates the pwm is used by a simulated device.
      Parameters:
      handle - the pwm handle
      device - simulated device handle
      See Also:
      • "HAL_SetPWMSimDevice"
    • setPulseTimeMicroseconds

      public static void setPulseTimeMicroseconds(int pwmPortHandle, int microsecondPulseTime)
      Sets a PWM channel to the desired pulse width in microseconds.
      Parameters:
      pwmPortHandle - the PWM handle
      microsecondPulseTime - the PWM value to set
    • getPulseTimeMicroseconds

      public static int getPulseTimeMicroseconds(int pwmPortHandle)
      Gets the current microsecond pulse time from a PWM channel.
      Parameters:
      pwmPortHandle - the PWM handle
      Returns:
      the current PWM microsecond pulse time
    • setPWMOutputPeriod

      public static void setPWMOutputPeriod(int pwmPortHandle, int period)
      Sets the PWM output period.
      Parameters:
      pwmPortHandle - the PWM handle.
      period - 0 for 5ms, 1 or 2 for 10ms, 3 for 20ms