Package edu.wpi.first.hal
Class RelayJNI
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.DIOJNI
edu.wpi.first.hal.RelayJNI
public class RelayJNI extends DIOJNI
Relay Output HAL JNI Functions.
- See Also:
- "hal/Relay.h"
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description RelayJNI()
-
Method Summary
Modifier and Type Method Description static boolean
checkRelayChannel(int channel)
Checks if a relay channel is valid.static void
freeRelayPort(int relayPortHandle)
Frees a relay port.static boolean
getRelay(int relayPortHandle)
Gets the current state of the relay channel.static int
initializeRelayPort(int halPortHandle, boolean forward)
Initializes a relay.static void
setRelay(int relayPortHandle, boolean on)
Sets the state of a relay output.Methods inherited from class edu.wpi.first.hal.DIOJNI
allocateDigitalPWM, checkDIOChannel, freeDigitalPWM, freeDIOPort, getDIO, getDIODirection, getLoopTiming, initializeDIOPort, isAnyPulsing, isPulsing, pulse, pulseMultiple, setDigitalPWMDutyCycle, setDigitalPWMOutputChannel, setDigitalPWMPPS, setDigitalPWMRate, setDIO, setDIODirection, setDIOSimDevice
-
Constructor Details
-
Method Details
-
initializeRelayPort
Initializes a relay.Note this call will only initialize either the forward or reverse port of the relay. If you need both, you will need to initialize 2 relays.
- Parameters:
halPortHandle
- the port handle to initializeforward
- true for the forward port, false for the reverse port- Returns:
- the created relay handle
- See Also:
- "HAL_InitializeRelayPort"
-
freeRelayPort
Frees a relay port.- Parameters:
relayPortHandle
- the relay handle- See Also:
- "HAL_FreeRelayPort"
-
checkRelayChannel
Checks if a relay channel is valid.- Parameters:
channel
- the channel to check- Returns:
- true if the channel is valid, otherwise false
- See Also:
- "HAL_CheckRelayChannel"
-
setRelay
Sets the state of a relay output.- Parameters:
relayPortHandle
- the relay handleon
- true for on, false for off- See Also:
- "HAL_SetRelay"
-
getRelay
Gets the current state of the relay channel.- Parameters:
relayPortHandle
- the relay handle- Returns:
- true for on, false for off
- See Also:
- "HAL_GetRelay"
-