WPILibC++  2020.3.2-60-g3011ebe
DutyCycle Functions

Functions

HAL_DutyCycleHandle HAL_InitializeDutyCycle (HAL_Handle digitalSourceHandle, HAL_AnalogTriggerType triggerType, int32_t *status)
 Initialize a DutyCycle input. More...
 
void HAL_FreeDutyCycle (HAL_DutyCycleHandle dutyCycleHandle)
 Free a DutyCycle. More...
 
void HAL_SetDutyCycleSimDevice (HAL_DutyCycleHandle handle, HAL_SimDeviceHandle device)
 Indicates the duty cycle is used by a simulated device. More...
 
int32_t HAL_GetDutyCycleFrequency (HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
 Get the frequency of the duty cycle signal. More...
 
double HAL_GetDutyCycleOutput (HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
 Get the output ratio of the duty cycle signal. More...
 
int32_t HAL_GetDutyCycleOutputRaw (HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
 Get the raw output ratio of the duty cycle signal. More...
 
int32_t HAL_GetDutyCycleOutputScaleFactor (HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
 Get the scale factor of the output. More...
 
int32_t HAL_GetDutyCycleFPGAIndex (HAL_DutyCycleHandle dutyCycleHandle, int32_t *status)
 Get the FPGA index for the DutyCycle. More...
 

Detailed Description

Function Documentation

◆ HAL_FreeDutyCycle()

void HAL_FreeDutyCycle ( HAL_DutyCycleHandle  dutyCycleHandle)

Free a DutyCycle.

Parameters
dutyCycleHandlethe duty cycle handle

◆ HAL_GetDutyCycleFPGAIndex()

int32_t HAL_GetDutyCycleFPGAIndex ( HAL_DutyCycleHandle  dutyCycleHandle,
int32_t *  status 
)

Get the FPGA index for the DutyCycle.

Parameters
dutyCycleHandlethe duty cycle handle
Returns
the FPGA index

◆ HAL_GetDutyCycleFrequency()

int32_t HAL_GetDutyCycleFrequency ( HAL_DutyCycleHandle  dutyCycleHandle,
int32_t *  status 
)

Get the frequency of the duty cycle signal.

Parameters
dutyCycleHandlethe duty cycle handle
Returns
frequency in Hertz

◆ HAL_GetDutyCycleOutput()

double HAL_GetDutyCycleOutput ( HAL_DutyCycleHandle  dutyCycleHandle,
int32_t *  status 
)

Get the output ratio of the duty cycle signal.

0 means always low, 1 means always high.

Parameters
dutyCycleHandlethe duty cycle handle
Returns
output ratio between 0 and 1

◆ HAL_GetDutyCycleOutputRaw()

int32_t HAL_GetDutyCycleOutputRaw ( HAL_DutyCycleHandle  dutyCycleHandle,
int32_t *  status 
)

Get the raw output ratio of the duty cycle signal.

0 means always low, an output equal to GetOutputScaleFactor() means always high.

Parameters
dutyCycleHandlethe duty cycle handle
Returns
output ratio in raw units

◆ HAL_GetDutyCycleOutputScaleFactor()

int32_t HAL_GetDutyCycleOutputScaleFactor ( HAL_DutyCycleHandle  dutyCycleHandle,
int32_t *  status 
)

Get the scale factor of the output.

An output equal to this value is always high, and then linearly scales down to 0. Divide the result of getOutputRaw by this in order to get the percentage between 0 and 1.

Parameters
dutyCycleHandlethe duty cycle handle
Returns
the output scale factor

◆ HAL_InitializeDutyCycle()

HAL_DutyCycleHandle HAL_InitializeDutyCycle ( HAL_Handle  digitalSourceHandle,
HAL_AnalogTriggerType  triggerType,
int32_t *  status 
)

Initialize a DutyCycle input.

Parameters
digitalSourceHandlethe digital source to use (either a HAL_DigitalHandle or a HAL_AnalogTriggerHandle)
triggerTypethe analog trigger type of the source if it is an analog trigger
Returns
thre created duty cycle handle

◆ HAL_SetDutyCycleSimDevice()

void HAL_SetDutyCycleSimDevice ( HAL_DutyCycleHandle  handle,
HAL_SimDeviceHandle  device 
)

Indicates the duty cycle is used by a simulated device.

Parameters
handlethe duty cycle handle
devicesimulated device handle