Class DMAJNI
public class DMAJNI extends JNIWrapper
- See Also:
- "hal/DHA.h"
-
Nested Class Summary
-
Method Summary
Modifier and Type Method Description static void
addAnalogAccumulator(int handle, int analogInputHandle)
Adds accumulator data of an analog input to be collected by DMA.static void
addAnalogInput(int handle, int analogInputHandle)
Adds an analog input to be collected by DMA.static void
addAveragedAnalogInput(int handle, int analogInputHandle)
Adds averaged data of an analog input to be collected by DMA.static void
addCounter(int handle, int counterHandle)
Adds position data for an counter to be collected by DMA.static void
addCounterPeriod(int handle, int counterHandle)
Adds timer data for an counter to be collected by DMA.static void
addDigitalSource(int handle, int digitalSourceHandle)
Adds a digital source to be collected by DMA.static void
addDutyCycle(int handle, int dutyCycleHandle)
Adds a duty cycle input to be collected by DMA.static void
addEncoder(int handle, int encoderHandle)
Adds position data for an encoder to be collected by DMA.static void
addEncoderPeriod(int handle, int encoderHandle)
Adds timer data for an encoder to be collected by DMA.static void
clearExternalTriggers(int handle)
Clear all external triggers from the DMA trigger list.static void
clearSensors(int handle)
Clear all sensors from the DMA collection list.static void
free(int handle)
Frees a DMA object.static edu.wpi.first.hal.DMAJNISample.BaseStore
getSensorReadData(int handle)
Get the sensor DMA sample.static int
initialize()
Initializes an object for performing DMA transfers.static long
readDMA(int handle, double timeoutSeconds, int[] buffer, int[] sampleStore)
Reads a DMA sample from the queue.static int
setExternalTrigger(int handle, int digitalSourceHandle, int analogTriggerType, boolean rising, boolean falling)
Sets DMA transfers to occur on an external trigger.static void
setPause(int handle, boolean pause)
Pauses or unpauses a DMA transfer.static void
setTimedTrigger(int handle, double periodSeconds)
Sets DMA transfers to occur at a specific timed interval.static void
setTimedTriggerCycles(int handle, int cycles)
Sets DMA transfers to occur at a specific timed interval in FPGA cycles.static void
startDMA(int handle, int queueDepth)
Starts DMA Collection.static void
stopDMA(int handle)
Stops DMA Collection.
-
Method Details
-
initialize
Initializes an object for performing DMA transfers.- Returns:
- the created dma handle
- See Also:
- "HAL_InitializeDMA"
-
free
Frees a DMA object.- Parameters:
handle
- the dma handle- See Also:
- "HAL_FreeDMA"
-
setPause
Pauses or unpauses a DMA transfer.This can only be called while DMA is running.
- Parameters:
handle
- the dma handlepause
- true to pause transfers, false to resume.- See Also:
- "HAL_SetDMAPause"
-
setTimedTrigger
Sets DMA transfers to occur at a specific timed interval.This will remove any external triggers. Only timed or external is supported.
Only 1 timed period is supported.
This can only be called if DMA is not started.
- Parameters:
handle
- the dma handleperiodSeconds
- the period to trigger in seconds- See Also:
- "HAL_SetDMATimedTrigger"
-
setTimedTriggerCycles
Sets DMA transfers to occur at a specific timed interval in FPGA cycles.This will remove any external triggers. Only timed or external is supported.
Only 1 timed period is supported
The FPGA currently runs at 40 MHz, but this can change. HAL_GetSystemClockTicksPerMicrosecond can be used to get a computable value for this.
This can only be called if DMA is not started.
- Parameters:
handle
- the dma handlecycles
- the period to trigger in FPGA cycles- See Also:
- "HAL_SetDMATimedTriggerCycles"
-
addEncoder
Adds position data for an encoder to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handleencoderHandle
- the encoder to add- See Also:
- "HAL_AddDMAEncoder"
-
addEncoderPeriod
Adds timer data for an encoder to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handleencoderHandle
- the encoder to add- See Also:
- "HAL_AddDMAEncoderPeriod"
-
addCounter
Adds position data for an counter to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handlecounterHandle
- the counter to add- See Also:
- "HAL_AddDMACounter"
-
addCounterPeriod
Adds timer data for an counter to be collected by DMA.- Parameters:
handle
- the dma handlecounterHandle
- the counter to add- See Also:
- "HAL_AddDMACounterPeriod"
-
addDigitalSource
Adds a digital source to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handledigitalSourceHandle
- the digital source to add- See Also:
- "HAL_AddDMADigitalSource"
-
addDutyCycle
Adds a duty cycle input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handledutyCycleHandle
- the duty cycle input to add- See Also:
- "HAL_AddDMADutyCycle"
-
addAnalogInput
Adds an analog input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handleanalogInputHandle
- the analog input to add- See Also:
- "HAL_AddDMAAnalogInput"
-
addAveragedAnalogInput
Adds averaged data of an analog input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handleanalogInputHandle
- the analog input to add- See Also:
- "HAL_AddDMAAveragedAnalogInput"
-
addAnalogAccumulator
Adds accumulator data of an analog input to be collected by DMA.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handleanalogInputHandle
- the analog input to add- See Also:
- "HAL_AddDMAAnalogAccumulator"
-
setExternalTrigger
public static int setExternalTrigger(int handle, int digitalSourceHandle, int analogTriggerType, boolean rising, boolean falling)Sets DMA transfers to occur on an external trigger.This will remove any timed trigger set. Only timed or external is supported.
Up to 8 external triggers are currently supported.
This can only be called if DMA is not started.
- Parameters:
handle
- the dma handledigitalSourceHandle
- the digital source handle (either a HAL_AnalogTriggerHandle or a HAL_DigitalHandle)analogTriggerType
- the analog trigger type if the source is an analog triggerrising
- true to trigger on rising edgefalling
- true to trigger on falling edge- Returns:
- the index of the trigger
- See Also:
- "HAL_SetDMAExternalTrigger"
-
clearSensors
Clear all sensors from the DMA collection list.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handle- See Also:
- "HAL_ClearDMASensors"
-
clearExternalTriggers
Clear all external triggers from the DMA trigger list.This can only be called if DMA is not started.
- Parameters:
handle
- the dma handle- See Also:
- "HAL_ClearDMAExternalTriggers"
-
startDMA
Starts DMA Collection.- Parameters:
handle
- the dma handlequeueDepth
- the number of objects to be able to queue- See Also:
- "HAL_StartDMA"
-
stopDMA
Stops DMA Collection.- Parameters:
handle
- the dma handle- See Also:
- "HAL_StopDMA"
-
readDMA
Reads a DMA sample from the queue.- Parameters:
handle
- the dma handletimeoutSeconds
- the time to wait for data to be queued before timing outbuffer
- the sample object to place data intosampleStore
- index 0-21 channelOffsets, index 22: capture size, index 23: triggerChannels (bitflags), index 24: remaining, index 25: read status- Returns:
- timestamp of the DMA Sample
-
getSensorReadData
Get the sensor DMA sample.- Parameters:
handle
- the dma handle- Returns:
- The DMA sample
-