Package edu.wpi.first.wpilibj
Class DMA
java.lang.Object
edu.wpi.first.wpilibj.DMA
- All Implemented Interfaces:
AutoCloseable
Class for configuring Direct Memory Access (DMA) of FPGA inputs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnalogAccumulator(AnalogInput analogInput) Adds accumulator data of an analog input to be collected by DMA.voidaddAnalogInput(AnalogInput analogInput) Adds an analog input to be collected by DMA.voidaddAveragedAnalogInput(AnalogInput analogInput) Adds averaged data of an analog input to be collected by DMA.voidaddCounter(Counter counter) Adds position data for an counter to be collected by DMA.voidaddCounterPeriod(Counter counter) Adds timer data for an counter to be collected by DMA.voidaddDigitalSource(DigitalSource digitalSource) Adds a digital source to be collected by DMA.voidaddDutyCycle(DutyCycle dutyCycle) Adds a duty cycle input to be collected by DMA.voidaddEncoder(Encoder encoder) Adds position data for an encoder to be collected by DMA.voidaddEncoderPeriod(Encoder encoder) Adds timer data for an encoder to be collected by DMA.voidClear all external triggers from the DMA trigger list.voidClear all sensors from the DMA collection list.voidclose()intsetExternalTrigger(DigitalSource source, boolean rising, boolean falling) Sets an external DMA trigger.voidsetPause(boolean pause) Sets whether DMA is paused.intsetPwmEdgeTrigger(PWMMotorController pwm, boolean rising, boolean falling) Sets a DMA PWMMotorController edge trigger.intsetPwmEdgeTrigger(PWM pwm, boolean rising, boolean falling) Sets a DMA PWM edge trigger.voidsetTimedTrigger(double periodSeconds) Sets DMA to trigger at an interval.voidsetTimedTriggerCycles(int cycles) Sets number of DMA cycles to trigger.voidstart(int queueDepth) Starts DMA Collection.voidstop()Stops DMA Collection.
-
Constructor Details
-
DMA
public DMA()Default constructor.
-
-
Method Details
-
close
- Specified by:
closein 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.
-