WPILibC++ 2024.3.2
Analog Trigger Functions

Enumerations

enum  HAL_AnalogTriggerType : int32_t { HAL_Trigger_kInWindow = 0 , HAL_Trigger_kState = 1 , HAL_Trigger_kRisingPulse = 2 , HAL_Trigger_kFallingPulse = 3 }
 The type of analog trigger to trigger on. More...
 

Functions

HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger (HAL_AnalogInputHandle portHandle, int32_t *status)
 Initializes an analog trigger. More...
 
HAL_AnalogTriggerHandle HAL_InitializeAnalogTriggerDutyCycle (HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
 Initializes an analog trigger with a Duty Cycle input. More...
 
void HAL_CleanAnalogTrigger (HAL_AnalogTriggerHandle analogTriggerHandle, int32_t *status)
 Frees an analog trigger. More...
 
void HAL_SetAnalogTriggerLimitsRaw (HAL_AnalogTriggerHandle analogTriggerHandle, int32_t lower, int32_t upper, int32_t *status)
 Sets the raw ADC upper and lower limits of the analog trigger. More...
 
void HAL_SetAnalogTriggerLimitsVoltage (HAL_AnalogTriggerHandle analogTriggerHandle, double lower, double upper, int32_t *status)
 Sets the upper and lower limits of the analog trigger. More...
 
void HAL_SetAnalogTriggerLimitsDutyCycle (HAL_AnalogTriggerHandle analogTriggerHandle, double lower, double upper, int32_t *status)
 Sets the upper and lower limits of the analog trigger. More...
 
void HAL_SetAnalogTriggerAveraged (HAL_AnalogTriggerHandle analogTriggerHandle, HAL_Bool useAveragedValue, int32_t *status)
 Configures the analog trigger to use the averaged vs. More...
 
void HAL_SetAnalogTriggerFiltered (HAL_AnalogTriggerHandle analogTriggerHandle, HAL_Bool useFilteredValue, int32_t *status)
 Configures the analog trigger to use a filtered value. More...
 
HAL_Bool HAL_GetAnalogTriggerInWindow (HAL_AnalogTriggerHandle analogTriggerHandle, int32_t *status)
 Returns the InWindow output of the analog trigger. More...
 
HAL_Bool HAL_GetAnalogTriggerTriggerState (HAL_AnalogTriggerHandle analogTriggerHandle, int32_t *status)
 Returns the TriggerState output of the analog trigger. More...
 
HAL_Bool HAL_GetAnalogTriggerOutput (HAL_AnalogTriggerHandle analogTriggerHandle, HAL_AnalogTriggerType type, int32_t *status)
 Gets the state of the analog trigger output. More...
 
int32_t HAL_GetAnalogTriggerFPGAIndex (HAL_AnalogTriggerHandle analogTriggerHandle, int32_t *status)
 Get the FPGA index for the AnlogTrigger. More...
 

Detailed Description

Enumeration Type Documentation

◆ HAL_AnalogTriggerType

enum HAL_AnalogTriggerType : int32_t

The type of analog trigger to trigger on.

Enumerator
HAL_Trigger_kInWindow 
HAL_Trigger_kState 
HAL_Trigger_kRisingPulse 
HAL_Trigger_kFallingPulse 

Function Documentation

◆ HAL_CleanAnalogTrigger()

void HAL_CleanAnalogTrigger ( HAL_AnalogTriggerHandle  analogTriggerHandle,
int32_t *  status 
)

Frees an analog trigger.

Parameters
[in]analogTriggerHandlethe trigger handle
[out]statusError status variable. 0 on success.

◆ HAL_GetAnalogTriggerFPGAIndex()

int32_t HAL_GetAnalogTriggerFPGAIndex ( HAL_AnalogTriggerHandle  analogTriggerHandle,
int32_t *  status 
)

Get the FPGA index for the AnlogTrigger.

Parameters
[in]analogTriggerHandlethe trigger handle
[out]statusError status variable. 0 on success.
Returns
the FPGA index

◆ HAL_GetAnalogTriggerInWindow()

HAL_Bool HAL_GetAnalogTriggerInWindow ( HAL_AnalogTriggerHandle  analogTriggerHandle,
int32_t *  status 
)

Returns the InWindow output of the analog trigger.

True if the analog input is between the upper and lower limits.

Parameters
[in]analogTriggerHandlethe trigger handle
[out]statusError status variable. 0 on success.
Returns
the InWindow output of the analog trigger

◆ HAL_GetAnalogTriggerOutput()

HAL_Bool HAL_GetAnalogTriggerOutput ( HAL_AnalogTriggerHandle  analogTriggerHandle,
HAL_AnalogTriggerType  type,
int32_t *  status 
)

Gets the state of the analog trigger output.

Parameters
[in]analogTriggerHandlethe trigger handle
[in]typethe type of trigger to trigger on
[out]statusError status variable. 0 on success.
Returns
the state of the analog trigger output

◆ HAL_GetAnalogTriggerTriggerState()

HAL_Bool HAL_GetAnalogTriggerTriggerState ( HAL_AnalogTriggerHandle  analogTriggerHandle,
int32_t *  status 
)

Returns the TriggerState output of the analog trigger.

True if above upper limit. False if below lower limit. If in Hysteresis, maintain previous state.

Parameters
[in]analogTriggerHandlethe trigger handle
[out]statusError status variable. 0 on success.
Returns
the TriggerState output of the analog trigger

◆ HAL_InitializeAnalogTrigger()

HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger ( HAL_AnalogInputHandle  portHandle,
int32_t *  status 
)

Initializes an analog trigger.

Parameters
[in]portHandlethe analog input to use for triggering
[out]statusError status variable. 0 on success.
Returns
the created analog trigger handle

◆ HAL_InitializeAnalogTriggerDutyCycle()

HAL_AnalogTriggerHandle HAL_InitializeAnalogTriggerDutyCycle ( HAL_DutyCycleHandle  dutyCycleHandle,
int32_t *  status 
)

Initializes an analog trigger with a Duty Cycle input.

Parameters
[in]dutyCycleHandlethe analog input to use for duty cycle
[out]statusError status variable. 0 on success.
Returns
tbe created analog trigger handle

◆ HAL_SetAnalogTriggerAveraged()

void HAL_SetAnalogTriggerAveraged ( HAL_AnalogTriggerHandle  analogTriggerHandle,
HAL_Bool  useAveragedValue,
int32_t *  status 
)

Configures the analog trigger to use the averaged vs.

raw values.

If the value is true, then the averaged value is selected for the analog trigger, otherwise the immediate value is used.

This is not allowed to be used if filtered mode is set. This is not allowed to be used with Duty Cycle based inputs.

Parameters
[in]analogTriggerHandlethe trigger handle
[in]useAveragedValuetrue to use averaged values, false for raw
[out]statusError status variable. 0 on success.

◆ HAL_SetAnalogTriggerFiltered()

void HAL_SetAnalogTriggerFiltered ( HAL_AnalogTriggerHandle  analogTriggerHandle,
HAL_Bool  useFilteredValue,
int32_t *  status 
)

Configures the analog trigger to use a filtered value.

The analog trigger will operate with a 3 point average rejection filter. This is designed to help with 360 degree pot applications for the period where the pot crosses through zero.

This is not allowed to be used if averaged mode is set.

Parameters
[in]analogTriggerHandlethe trigger handle
[in]useFilteredValuetrue to use filtered values, false for average or raw
[out]statusError status variable. 0 on success.

◆ HAL_SetAnalogTriggerLimitsDutyCycle()

void HAL_SetAnalogTriggerLimitsDutyCycle ( HAL_AnalogTriggerHandle  analogTriggerHandle,
double  lower,
double  upper,
int32_t *  status 
)

Sets the upper and lower limits of the analog trigger.

The limits are given as floating point duty cycle values.

Parameters
[in]analogTriggerHandlethe trigger handle
[in]lowerthe lower duty cycle value
[in]upperthe upper duty cycle value
[out]statusError status variable. 0 on success.

◆ HAL_SetAnalogTriggerLimitsRaw()

void HAL_SetAnalogTriggerLimitsRaw ( HAL_AnalogTriggerHandle  analogTriggerHandle,
int32_t  lower,
int32_t  upper,
int32_t *  status 
)

Sets the raw ADC upper and lower limits of the analog trigger.

HAL_SetAnalogTriggerLimitsVoltage or HAL_SetAnalogTriggerLimitsDutyCycle is likely better in most cases.

Parameters
[in]analogTriggerHandlethe trigger handle
[in]lowerthe lower ADC value
[in]upperthe upper ADC value
[out]statusError status variable. 0 on success.

◆ HAL_SetAnalogTriggerLimitsVoltage()

void HAL_SetAnalogTriggerLimitsVoltage ( HAL_AnalogTriggerHandle  analogTriggerHandle,
double  lower,
double  upper,
int32_t *  status 
)

Sets the upper and lower limits of the analog trigger.

The limits are given as floating point voltage values.

Parameters
[in]analogTriggerHandlethe trigger handle
[in]lowerthe lower voltage value
[in]upperthe upper voltage value
[out]statusError status variable. 0 on success.