[docs] Add Missing JNI docs from C++ (NFC) (#6139)

This commit is contained in:
m10653
2024-01-02 23:13:46 -05:00
committed by GitHub
parent 5c424248c4
commit 01fb98baaa
6 changed files with 404 additions and 0 deletions

View File

@@ -84,6 +84,16 @@ public class AnalogJNI extends JNIWrapper {
*/
public static native boolean checkAnalogInputChannel(int channel);
/**
* Checks that the analog output channel number is valid.
*
* <p>Verifies that the analog channel number is one of the legal channel numbers. Channel numbers
* are 0-based.
*
* @param channel The analog output channel number.
* @return Analog channel is valid
* @see "HAL_CheckAnalogOutputChannel"
*/
public static native boolean checkAnalogOutputChannel(int channel);
/**
@@ -95,8 +105,22 @@ public class AnalogJNI extends JNIWrapper {
*/
public static native void setAnalogInputSimDevice(int handle, int device);
/**
* Sets an analog output value.
*
* @param portHandle the analog output handle
* @param voltage the voltage (0-5v) to output
* @see "HAL_SetAnalogOutput"
*/
public static native void setAnalogOutput(int portHandle, double voltage);
/**
* Gets the current analog output value.
*
* @param portHandle the analog output handle
* @return the current output voltage (0-5v)
* @see "HAL_GetAnalogOutput"
*/
public static native double getAnalogOutput(int portHandle);
/**

View File

@@ -5,12 +5,41 @@
package edu.wpi.first.hal;
public class PWMJNI extends DIOJNI {
/**
* Initializes a PWM port.
*
* @param halPortHandle the port to initialize
* @return the created pwm handle
*/
public static native int initializePWMPort(int halPortHandle);
/**
* Checks if a pwm channel is valid.
*
* @param channel the channel to check
* @return true if the channel is valid, otherwise false
*/
public static native boolean checkPWMChannel(int channel);
/**
* Frees a PWM port.
*
* @param pwmPortHandle the pwm handle
*/
public static native void freePWMPort(int pwmPortHandle);
/**
* Sets the configuration settings for the PWM channel.
*
* <p>All values are in microseconds.
*
* @param pwmPortHandle the PWM handle
* @param maxPwm the maximum PWM value
* @param deadbandMaxPwm the high range of the center deadband
* @param centerPwm the center PWM value
* @param deadbandMinPwm the low range of the center deadband
* @param minPwm the minimum PWM value
*/
public static native void setPWMConfigMicroseconds(
int pwmPortHandle,
int maxPwm,
@@ -19,30 +48,120 @@ public class PWMJNI extends DIOJNI {
int deadbandMinPwm,
int minPwm);
/**
* Gets the pwm configuration settings for the PWM channel.
*
* <p>Values are in microseconds.
*
* @param pwmPortHandle the PWM handle
* @return the pwm configuration settings
*/
public static native PWMConfigDataResult getPWMConfigMicroseconds(int pwmPortHandle);
/**
* Sets if the FPGA should output the center value if the input value is within the deadband.
*
* @param pwmPortHandle the PWM handle
* @param eliminateDeadband true to eliminate deadband, otherwise false
*/
public static native void setPWMEliminateDeadband(int pwmPortHandle, boolean eliminateDeadband);
/**
* Gets the current eliminate deadband value.
*
* @param pwmPortHandle the PWM handle
* @return true if set, otherwise false
*/
public static native boolean getPWMEliminateDeadband(int pwmPortHandle);
/**
* Sets a PWM channel to the desired pulse width in microseconds.
*
* @param pwmPortHandle the PWM handle
* @param microsecondPulseTime the PWM value to set
*/
public static native void setPulseTimeMicroseconds(int pwmPortHandle, int microsecondPulseTime);
/**
* Sets a PWM channel to the desired scaled value.
*
* <p>The values range from -1 to 1 and the period is controlled by the PWM Period and MinHigh
* registers.
*
* @param pwmPortHandle the PWM handle
* @param speed the scaled PWM value to set
*/
public static native void setPWMSpeed(int pwmPortHandle, double speed);
/**
* Sets a PWM channel to the desired position value.
*
* <p>The values range from 0 to 1 and the period is controlled by the PWM Period and MinHigh
* registers.
*
* @param pwmPortHandle the PWM handle
* @param position the positional PWM value to set
*/
public static native void setPWMPosition(int pwmPortHandle, double position);
/**
* Gets the current microsecond pulse time from a PWM channel.
*
* @param pwmPortHandle the PWM handle
* @return the current PWM microsecond pulse time
*/
public static native int getPulseTimeMicroseconds(int pwmPortHandle);
/**
* Gets a scaled value from a PWM channel.
*
* <p>The values range from -1 to 1.
*
* @param pwmPortHandle the PWM handle
* @return the current speed PWM value
*/
public static native double getPWMSpeed(int pwmPortHandle);
/**
* Gets a position value from a PWM channel.
*
* <p>The values range from 0 to 1.
*
* @param pwmPortHandle the PWM handle
* @return the current positional PWM value
*/
public static native double getPWMPosition(int pwmPortHandle);
/**
* Sets a PWM channel to be disabled.
*
* <p>The channel is disabled until the next time it is set. Note this is different from just
* setting a 0 speed, as this will actively stop all signaling on the channel.
*
* @param pwmPortHandle the PWM handle.
*/
public static native void setPWMDisabled(int pwmPortHandle);
/**
* Forces a PWM signal to go to 0 temporarily.
*
* @param pwmPortHandle the PWM handle.
*/
public static native void latchPWMZero(int pwmPortHandle);
/**
* Sets the PWM output to be a continuous high signal while enabled.
*
* @param pwmPortHandle the PWM handle.
*/
public static native void setAlwaysHighMode(int pwmPortHandle);
/**
* Sets how how often the PWM signal is squelched, thus scaling the period.
*
* @param pwmPortHandle the PWM handle.
* @param squelchMask the 2-bit mask of outputs to squelch
*/
public static native void setPWMPeriodScale(int pwmPortHandle, int squelchMask);
/** Utility class. */