46 int32_t* remaining, int32_t* status) {
48 HAL_ReadDMA(dma->dmaHandle,
this, timeout.value(), remaining, status));
64 return units::second_t{
static_cast<double>(
GetTime()) * 1.0e-6};
87 val *= encoder->DecodingScaleFactor();
133 int32_t* status)
const {
146 int32_t* status)
const {
171 int32_t* status)
const {
199 int64_t* value, int32_t* status)
const {
212 int32_t* status)
const {
230static_assert(std::is_standard_layout_v<frc::DMASample>,
231 "frc::DMASample must have standard layout");
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:35
hal::Handle< HAL_CounterHandle > m_counter
The FPGA counter object.
Definition: Counter.h:461
Class for configuring Direct Memory Access (DMA) of FPGA inputs.
Definition: DMA.h:23
DMA sample.
Definition: DMASample.h:23
double GetEncoderDistance(const Encoder *encoder, int32_t *status) const
Returns encoder distance from DMA.
Definition: DMASample.h:85
double GetAveragedAnalogInputVoltage(const AnalogInput *analogInput, int32_t *status)
Returns averaged analog input voltage from DMA.
Definition: DMASample.h:183
void GetAnalogAccumulator(const AnalogInput *analogInput, int64_t *count, int64_t *value, int32_t *status) const
Returns analog accumulator value from DMA.
Definition: DMASample.h:198
int32_t GetCounter(const Counter *counter, int32_t *status) const
Returns counter value from DMA.
Definition: DMASample.h:110
int32_t GetCounterPeriod(const Counter *counter, int32_t *status) const
Returns counter period from DMA.
Definition: DMASample.h:121
uint64_t GetTime() const
Returns the DMA sample time in microseconds.
Definition: DMASample.h:56
bool GetDigitalSource(const DigitalSource *digitalSource, int32_t *status) const
Returns digital source value from DMA.
Definition: DMASample.h:132
int32_t GetEncoderRaw(const Encoder *encoder, int32_t *status) const
Returns raw encoder value from DMA.
Definition: DMASample.h:74
double GetDutyCycleOutput(const DutyCycle *dutyCycle, int32_t *status)
Returns duty cycle output (0-1) from DMA.
Definition: DMASample.h:224
int32_t GetAveragedAnalogInputRaw(const AnalogInput *analogInput, int32_t *status) const
Returns averaged analog input raw value from DMA.
Definition: DMASample.h:170
int32_t GetDutyCycleOutputRaw(const DutyCycle *dutyCycle, int32_t *status) const
Returns raw duty cycle output from DMA.
Definition: DMASample.h:211
int32_t GetEncoderPeriodRaw(const Encoder *encoder, int32_t *status) const
Returns raw encoder period from DMA.
Definition: DMASample.h:99
DMAReadStatus
DMA read status.
Definition: DMASample.h:28
double GetAnalogInputVoltage(const AnalogInput *analogInput, int32_t *status)
Returns analog input voltage from DMA.
Definition: DMASample.h:157
units::second_t GetTimeStamp() const
Returns the DMA sample timestamp.
Definition: DMASample.h:63
int32_t GetAnalogInputRaw(const AnalogInput *analogInput, int32_t *status) const
Returns raw analog input value from DMA.
Definition: DMASample.h:145
DMAReadStatus Update(const DMA *dma, units::second_t timeout, int32_t *remaining, int32_t *status)
Retrieves a new DMA sample.
Definition: DMASample.h:45
DigitalSource Interface.
Definition: DigitalSource.h:22
virtual HAL_Handle GetPortHandleForRouting() const =0
Class to read a duty cycle PWM input.
Definition: DutyCycle.h:31
unsigned int GetOutputScaleFactor() const
Get the scale factor of the output.
Class to read quad encoders.
Definition: Encoder.h:40
double GetDistancePerPulse() const
Get the distance per pulse for this encoder.
int32_t HAL_GetDMASampleDutyCycleOutputRaw(const HAL_DMASample *dmaSample, HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
Returns the raw duty cycle input ratio data from the sample.
enum HAL_DMAReadStatus HAL_ReadDMA(HAL_DMAHandle handle, HAL_DMASample *dmaSample, double timeoutSeconds, int32_t *remainingOut, int32_t *status)
Reads a DMA sample from the queue.
int32_t HAL_GetDMASampleAveragedAnalogInputRaw(const HAL_DMASample *dmaSample, HAL_AnalogInputHandle aInHandle, int32_t *status)
Returns the raw averaged analog data for an analog input from the sample.
HAL_Bool HAL_GetDMASampleDigitalSource(const HAL_DMASample *dmaSample, HAL_Handle dSourceHandle, int32_t *status)
Returns the state of a digital source from the sample.
int32_t HAL_GetDMASampleEncoderPeriodRaw(const HAL_DMASample *dmaSample, HAL_EncoderHandle encoderHandle, int32_t *status)
Returns the raw period data for an encoder from the sample.
int32_t HAL_GetDMASampleCounter(const HAL_DMASample *dmaSample, HAL_CounterHandle counterHandle, int32_t *status)
Returns the distance data for an counter from the sample.
int32_t HAL_GetDMASampleCounterPeriod(const HAL_DMASample *dmaSample, HAL_CounterHandle counterHandle, int32_t *status)
Returns the period data for an counter from the sample.
int32_t HAL_GetDMASampleAnalogInputRaw(const HAL_DMASample *dmaSample, HAL_AnalogInputHandle aInHandle, int32_t *status)
Returns the raw analog data for an analog input from the sample.
void HAL_GetDMASampleAnalogAccumulator(const HAL_DMASample *dmaSample, HAL_AnalogInputHandle aInHandle, int64_t *count, int64_t *value, int32_t *status)
Returns the analog accumulator data for an analog input from the sample.
int32_t HAL_GetDMASampleEncoderRaw(const HAL_DMASample *dmaSample, HAL_EncoderHandle encoderHandle, int32_t *status)
Returns the raw distance data for an encoder from the sample.
@ HAL_DMA_ERROR
Definition: DMA.h:22
@ HAL_DMA_TIMEOUT
Definition: DMA.h:21
@ HAL_DMA_OK
Definition: DMA.h:20
constexpr auto count() -> size_t
Definition: core.h:1203
Definition: AprilTagPoseEstimator.h:15
Buffer for containing all DMA data for a specific sample.
Definition: DMA.h:28
uint64_t timeStamp
Definition: DMA.h:31