WPILibC++  2020.2.2-33-g65eab93
Analog Accumulator Functions

Functions

HAL_Bool HAL_IsAccumulatorChannel (HAL_AnalogInputHandle analogPortHandle, int32_t *status)
 Is the channel attached to an accumulator. More...
 
void HAL_InitAccumulator (HAL_AnalogInputHandle analogPortHandle, int32_t *status)
 Initialize the accumulator. More...
 
void HAL_ResetAccumulator (HAL_AnalogInputHandle analogPortHandle, int32_t *status)
 Resets the accumulator to the initial value. More...
 
void HAL_SetAccumulatorCenter (HAL_AnalogInputHandle analogPortHandle, int32_t center, int32_t *status)
 Set the center value of the accumulator. More...
 
void HAL_SetAccumulatorDeadband (HAL_AnalogInputHandle analogPortHandle, int32_t deadband, int32_t *status)
 Set the accumulator's deadband. More...
 
int64_t HAL_GetAccumulatorValue (HAL_AnalogInputHandle analogPortHandle, int32_t *status)
 Read the accumulated value. More...
 
int64_t HAL_GetAccumulatorCount (HAL_AnalogInputHandle analogPortHandle, int32_t *status)
 Read the number of accumulated values. More...
 
void HAL_GetAccumulatorOutput (HAL_AnalogInputHandle analogPortHandle, int64_t *value, int64_t *count, int32_t *status)
 Read the accumulated value and the number of accumulated values atomically. More...
 

Detailed Description

Function Documentation

◆ HAL_GetAccumulatorCount()

int64_t HAL_GetAccumulatorCount ( HAL_AnalogInputHandle  analogPortHandle,
int32_t *  status 
)

Read the number of accumulated values.

Read the count of the accumulated values since the accumulator was last Reset().

Parameters
analogPortHandleHandle to the analog port.
Returns
The number of times samples from the channel were accumulated.

◆ HAL_GetAccumulatorOutput()

void HAL_GetAccumulatorOutput ( HAL_AnalogInputHandle  analogPortHandle,
int64_t *  value,
int64_t *  count,
int32_t *  status 
)

Read the accumulated value and the number of accumulated values atomically.

This function reads the value and count from the FPGA atomically. This can be used for averaging.

Parameters
analogPortHandleHandle to the analog port.
valuePointer to the 64-bit accumulated output.
countPointer to the number of accumulation cycles.

◆ HAL_GetAccumulatorValue()

int64_t HAL_GetAccumulatorValue ( HAL_AnalogInputHandle  analogPortHandle,
int32_t *  status 
)

Read the accumulated value.

Read the value that has been accumulating on channel 1. The accumulator is attached after the oversample and average engine.

Parameters
analogPortHandleHandle to the analog port.
Returns
The 64-bit value accumulated since the last Reset().

◆ HAL_InitAccumulator()

void HAL_InitAccumulator ( HAL_AnalogInputHandle  analogPortHandle,
int32_t *  status 
)

Initialize the accumulator.

Parameters
analogPortHandleHandle to the analog port.

◆ HAL_IsAccumulatorChannel()

HAL_Bool HAL_IsAccumulatorChannel ( HAL_AnalogInputHandle  analogPortHandle,
int32_t *  status 
)

Is the channel attached to an accumulator.

Parameters
analogPortHandleHandle to the analog port.
Returns
The analog channel is attached to an accumulator.

◆ HAL_ResetAccumulator()

void HAL_ResetAccumulator ( HAL_AnalogInputHandle  analogPortHandle,
int32_t *  status 
)

Resets the accumulator to the initial value.

Parameters
analogPortHandleHandle to the analog port.

◆ HAL_SetAccumulatorCenter()

void HAL_SetAccumulatorCenter ( HAL_AnalogInputHandle  analogPortHandle,
int32_t  center,
int32_t *  status 
)

Set the center value of the accumulator.

The center value is subtracted from each A/D value before it is added to the accumulator. This is used for the center value of devices like gyros and accelerometers to make integration work and to take the device offset into account when integrating.

This center value is based on the output of the oversampled and averaged source from channel 1. Because of this, any non-zero oversample bits will affect the size of the value for this field.

Parameters
analogPortHandleHandle to the analog port.
centerThe center value of the accumulator.

◆ HAL_SetAccumulatorDeadband()

void HAL_SetAccumulatorDeadband ( HAL_AnalogInputHandle  analogPortHandle,
int32_t  deadband,
int32_t *  status 
)

Set the accumulator's deadband.

Parameters
analogPortHandleHandle to the analog port.
deadbandThe deadband of the accumulator.