Package edu.wpi.first.wpilibj
Class DigitalGlitchFilter
java.lang.Object
edu.wpi.first.wpilibj.DigitalGlitchFilter
- All Implemented Interfaces:
Sendable,AutoCloseable
Class to enable glitch filtering on a set of digital inputs. This class will manage adding and
removing digital inputs from an FPGA glitch filter. The filter lets the user configure the time
that an input must remain high or low before it is classified as high or low.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigures the Digital Glitch Filter to its default settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidAssigns the Counter to this glitch filter.voidadd(DigitalSource input) Assigns the DigitalSource to this glitch filter.voidAssigns the Encoder to this glitch filter.voidclose()intGets the number of FPGA cycles that the input must hold steady to pass through this glitch filter.longGets the number of nanoseconds that the input must hold steady to pass through this glitch filter.voidinitSendable(SendableBuilder builder) Initializes thisSendableobject.voidRemoves this filter from the given Counter.voidremove(DigitalSource input) Removes this filter from the given digital input.voidRemoves this filter from the given Encoder.voidsetPeriodCycles(int fpgaCycles) Sets the number of FPGA cycles that the input must hold steady to pass through this glitch filter.voidsetPeriodNanoSeconds(long nanoseconds) Sets the number of nanoseconds that the input must hold steady to pass through this glitch filter.
-
Constructor Details
-
DigitalGlitchFilter
public DigitalGlitchFilter()Configures the Digital Glitch Filter to its default settings.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
add
Assigns the DigitalSource to this glitch filter.- Parameters:
input- The DigitalSource to add.
-
add
Assigns the Encoder to this glitch filter.- Parameters:
input- The Encoder to add.
-
add
Assigns the Counter to this glitch filter.- Parameters:
input- The Counter to add.
-
remove
Removes this filter from the given digital input.- Parameters:
input- The DigitalSource to stop filtering.
-
remove
Removes this filter from the given Encoder.- Parameters:
input- the Encoder to stop filtering.
-
remove
Removes this filter from the given Counter.- Parameters:
input- The Counter to stop filtering.
-
setPeriodCycles
Sets the number of FPGA cycles that the input must hold steady to pass through this glitch filter.- Parameters:
fpgaCycles- The number of FPGA cycles.
-
setPeriodNanoSeconds
Sets the number of nanoseconds that the input must hold steady to pass through this glitch filter.- Parameters:
nanoseconds- The number of nanoseconds.
-
getPeriodCycles
Gets the number of FPGA cycles that the input must hold steady to pass through this glitch filter.- Returns:
- The number of cycles.
-
getPeriodNanoSeconds
Gets the number of nanoseconds that the input must hold steady to pass through this glitch filter.- Returns:
- The number of nanoseconds.
-
initSendable
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Parameters:
builder- sendable builder
-