Package edu.wpi.first.hal
Class DIOJNI
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.DIOJNI
- Direct Known Subclasses:
PWMJNI
Digital Input/Output (IO) JNI Functions.
- See Also:
-
- "hal/DIO.h"
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.hal.JNIWrapper
JNIWrapper.Helper -
Method Summary
Modifier and TypeMethodDescriptionstatic intAllocates a DO PWM Generator.static booleancheckDIOChannel(int channel) Checks if a DIO channel is valid.static voidfreeDigitalPWM(int pwmGenerator) Frees the resource associated with a DO PWM generator.static voidfreeDIOPort(int dioPortHandle) Frees a DIO port.static booleangetDIO(int dioPortHandle) Reads a digital value from a DIO channel.static booleangetDIODirection(int dioPortHandle) Reads the direction of a DIO channel.static intinitializeDIOPort(int channel, boolean input) Creates a new instance of a digital port.static booleanChecks if any DIO line is currently generating a pulse.static booleanisPulsing(int dioPortHandle) Checks a DIO line to see if it is currently generating a pulse.static voidpulse(int dioPortHandle, double pulseLength) Generates a single digital pulse.static voidpulseMultiple(long channelMask, double pulseLength) Generates a single digital pulse on multiple channels.static voidsetDigitalPWMDutyCycle(int pwmGenerator, double dutyCycle) Configures the duty-cycle of the PWM generator.static voidsetDigitalPWMOutputChannel(int pwmGenerator, int channel) Configures which DO channel the PWM signal is output on.static voidsetDigitalPWMPPS(int pwmGenerator, double dutyCycle) Configures the digital PWM to be a PPS signal with specified duty cycle.static voidsetDigitalPWMRate(double rate) Changes the frequency of the DO PWM generator.static voidsetDIO(int dioPortHandle, boolean value) Writes a digital value to a DIO channel.static voidsetDIODirection(int dioPortHandle, boolean input) Sets the direction of a DIO channel.static voidsetDIOSimDevice(int handle, int device) Indicates the DIO channel is used by a simulated device.Methods inherited from class edu.wpi.first.hal.JNIWrapper
forceLoad, suppressUnused
-
Method Details
-
initializeDIOPort
Creates a new instance of a digital port.- Parameters:
channel- the smartio channelinput- true for input, false for output- Returns:
- the created digital handle
- See Also:
-
- "HAL_InitializeDIOPort"
-
checkDIOChannel
Checks if a DIO channel is valid.- Parameters:
channel- the channel number to check- Returns:
- true if the channel is valid, otherwise false
- See Also:
-
- "HAL_CheckDIOChannel"
-
freeDIOPort
Frees a DIO port.- Parameters:
dioPortHandle- the DIO channel handle- See Also:
-
- "HAL_FreeDIOPort"
-
setDIOSimDevice
Indicates the DIO channel is used by a simulated device.- Parameters:
handle- the DIO channel handledevice- simulated device handle- See Also:
-
- "HAL_SetDIOSimDevice"
-
setDIO
Writes a digital value to a DIO channel.- Parameters:
dioPortHandle- the digital port handlevalue- the state to set the digital channel (if it is configured as an output)- See Also:
-
- "HAL_SetDIO"
-
setDIODirection
Sets the direction of a DIO channel.- Parameters:
dioPortHandle- the digital port handleinput- true to set input, false for output- See Also:
-
- "HAL_SetDIODirection"
-
getDIO
Reads a digital value from a DIO channel.- Parameters:
dioPortHandle- the digital port handle- Returns:
- the state of the specified channel
- See Also:
-
- "HAL_GetDIO"
-
getDIODirection
Reads the direction of a DIO channel.- Parameters:
dioPortHandle- the digital port handle- Returns:
- true for input, false for output
- See Also:
-
- "HAL_GetDIODirection"
-
pulse
Generates a single digital pulse.Write a pulse to the specified digital output channel. There can only be a single pulse going at any time.
- Parameters:
dioPortHandle- the digital port handlepulseLength- the active length of the pulse in seconds- See Also:
-
- "HAL_Pulse"
-
pulseMultiple
Generates a single digital pulse on multiple channels.Write a pulse to the channels enabled by the mask. There can only be a single pulse going at any time.
- Parameters:
channelMask- the channel maskpulseLength- the active length of the pulse in seconds- See Also:
-
- "HAL_PulseMultiple"
-
isPulsing
Checks a DIO line to see if it is currently generating a pulse.- Parameters:
dioPortHandle- the digital port handle- Returns:
- true if a pulse is in progress, otherwise false
- See Also:
-
- "HAL_IsPulsing"
-
isAnyPulsing
Checks if any DIO line is currently generating a pulse.- Returns:
- true if a pulse on some line is in progress
- See Also:
-
- "HAL_IsAnyPulsing"
-
allocateDigitalPWM
Allocates a DO PWM Generator.- Returns:
- the allocated digital PWM handle
-
freeDigitalPWM
Frees the resource associated with a DO PWM generator.- Parameters:
pwmGenerator- the digital PWM handle- See Also:
-
- "HAL_FreeDigitalPWM"
-
setDigitalPWMRate
Changes the frequency of the DO PWM generator.The valid range is from 0.6 Hz to 19 kHz.
The frequency resolution is logarithmic.
- Parameters:
rate- the frequency to output all digital output PWM signals- See Also:
-
- "HAL_SetDigitalPWMRate"
-
setDigitalPWMDutyCycle
Configures the duty-cycle of the PWM generator.- Parameters:
pwmGenerator- the digital PWM handledutyCycle- the percent duty cycle to output [0..1]- See Also:
-
- "HAL_SetDigitalPWMDutyCycle"
-
setDigitalPWMPPS
Configures the digital PWM to be a PPS signal with specified duty cycle.- Parameters:
pwmGenerator- the digital PWM handledutyCycle- the percent duty cycle to output [0..1]- See Also:
-
- "HAL_SetDigitalPWMPPS"
-
setDigitalPWMOutputChannel
Configures which DO channel the PWM signal is output on.- Parameters:
pwmGenerator- the digital PWM handlechannel- the channel to output on- See Also:
-
- "HAL_SetDigitalPWMOutputChannel"
-