Package edu.wpi.first.wpilibj
Class DMA
java.lang.Object
edu.wpi.first.wpilibj.DMA
- All Implemented Interfaces:
AutoCloseable
public class DMA extends Object implements AutoCloseable
Class for configuring Direct Memory Access (DMA) of FPGA inputs.
-
Constructor Summary
Constructors Constructor Description DMA()
Default constructor. -
Method Summary
Modifier and Type Method Description void
addAnalogAccumulator(AnalogInput analogInput)
Adds accumulator data of an analog input to be collected by DMA.void
addAnalogInput(AnalogInput analogInput)
Adds an analog input to be collected by DMA.void
addAveragedAnalogInput(AnalogInput analogInput)
Adds averaged data of an analog input to be collected by DMA.void
addCounter(Counter counter)
Adds position data for an counter to be collected by DMA.void
addCounterPeriod(Counter counter)
Adds timer data for an counter to be collected by DMA.void
addDigitalSource(DigitalSource digitalSource)
Adds a digital source to be collected by DMA.void
addDutyCycle(DutyCycle dutyCycle)
Adds a duty cycle input to be collected by DMA.void
addEncoder(Encoder encoder)
Adds position data for an encoder to be collected by DMA.void
addEncoderPeriod(Encoder encoder)
Adds timer data for an encoder to be collected by DMA.void
clearExternalTriggers()
Clear all external triggers from the DMA trigger list.void
clearSensors()
Clear all sensors from the DMA collection list.void
close()
int
setExternalTrigger(DigitalSource source, boolean rising, boolean falling)
Sets an external DMA trigger.void
setPause(boolean pause)
Sets whether DMA is paused.int
setPwmEdgeTrigger(PWMMotorController pwm, boolean rising, boolean falling)
Sets a DMA PWMMotorController edge trigger.int
setPwmEdgeTrigger(PWM pwm, boolean rising, boolean falling)
Sets a DMA PWM edge trigger.void
setTimedTrigger(double periodSeconds)
Sets DMA to trigger at an interval.void
setTimedTriggerCycles(int cycles)
Sets number of DMA cycles to trigger.void
start(int queueDepth)
Starts DMA Collection.void
stop()
Stops DMA Collection.
-
Constructor Details
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
-
setPause
Sets whether DMA is paused.- Parameters:
pause
- True pauses DMA.
-
setTimedTrigger
Sets DMA to trigger at an interval.- Parameters:
periodSeconds
- Period at which to trigger DMA in seconds.
-
setTimedTriggerCycles
Sets number of DMA cycles to trigger.- Parameters:
cycles
- Number of cycles.
-
addEncoder
Adds position data for an encoder to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
encoder
- Encoder to add to DMA.
-
addEncoderPeriod
Adds timer data for an encoder to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
encoder
- Encoder to add to DMA.
-
addCounter
Adds position data for an counter to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
counter
- Counter to add to DMA.
-
addCounterPeriod
Adds timer data for an counter to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
counter
- Counter to add to DMA.
-
addDigitalSource
Adds a digital source to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
digitalSource
- DigitalSource to add to DMA.
-
addDutyCycle
Adds a duty cycle input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
dutyCycle
- DutyCycle to add to DMA.
-
addAnalogInput
Adds an analog input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
analogInput
- AnalogInput to add to DMA.
-
addAveragedAnalogInput
Adds averaged data of an analog input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
analogInput
- AnalogInput to add to DMA.
-
addAnalogAccumulator
Adds accumulator data of an analog input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
analogInput
- AnalogInput to add to DMA.
-
setExternalTrigger
Sets an external DMA trigger.- Parameters:
source
- the source to trigger from.rising
- trigger on rising edge.falling
- trigger on falling edge.- Returns:
- the index of the trigger
-
setPwmEdgeTrigger
Sets a DMA PWM edge trigger.- Parameters:
pwm
- the PWM to trigger from.rising
- trigger on rising edge.falling
- trigger on falling edge.- Returns:
- the index of the trigger
-
setPwmEdgeTrigger
Sets a DMA PWMMotorController edge trigger.- Parameters:
pwm
- the PWMMotorController to trigger from.rising
- trigger on rising edge.falling
- trigger on falling edge.- Returns:
- the index of the trigger
-
clearSensors
Clear all sensors from the DMA collection list.This can only be called if DMA is not started.
-
clearExternalTriggers
Clear all external triggers from the DMA trigger list.This can only be called if DMA is not started.
-
start
Starts DMA Collection.- Parameters:
queueDepth
- The number of objects to be able to queue.
-
stop
Stops DMA Collection.
-