[docs] Fix Doxygen warnings, add CI docs lint job (#3639)

The CI docs lint build is configured to fail on Doxygen warnings.
This commit is contained in:
Tyler Veness
2021-10-14 18:09:38 -07:00
committed by GitHub
parent 4ad3a54026
commit 4647d09b50
125 changed files with 1723 additions and 1131 deletions

View File

@@ -44,7 +44,7 @@ int32_t HAL_GetPDPModuleNumber(HAL_PDPHandle handle, int32_t* status);
* Checks if a PDP channel is valid.
*
* @param channel the channel to check
* @return true if the channel is valid, otherwise false
* @return true if the channel is valid, otherwise false
*/
HAL_Bool HAL_CheckPDPChannel(int32_t channel);
@@ -52,7 +52,7 @@ HAL_Bool HAL_CheckPDPChannel(int32_t channel);
* Checks if a PDP module is valid.
*
* @param channel the module to check
* @return true if the module is valid, otherwise false
* @return true if the module is valid, otherwise false
*/
HAL_Bool HAL_CheckPDPModule(int32_t module);
@@ -60,7 +60,7 @@ HAL_Bool HAL_CheckPDPModule(int32_t module);
* Gets the temperature of the PDP.
*
* @param handle the module handle
* @return the module temperature (celsius)
* @return the module temperature (celsius)
*/
double HAL_GetPDPTemperature(HAL_PDPHandle handle, int32_t* status);
@@ -68,7 +68,7 @@ double HAL_GetPDPTemperature(HAL_PDPHandle handle, int32_t* status);
* Gets the PDP input voltage.
*
* @param handle the module handle
* @return the input voltage (volts)
* @return the input voltage (volts)
*/
double HAL_GetPDPVoltage(HAL_PDPHandle handle, int32_t* status);
@@ -77,7 +77,7 @@ double HAL_GetPDPVoltage(HAL_PDPHandle handle, int32_t* status);
*
* @param module the module
* @param channel the channel
* @return the channel current (amps)
* @return the channel current (amps)
*/
double HAL_GetPDPChannelCurrent(HAL_PDPHandle handle, int32_t channel,
int32_t* status);
@@ -97,7 +97,7 @@ void HAL_GetPDPAllChannelCurrents(HAL_PDPHandle handle, double* currents,
* Gets the total current of the PDP.
*
* @param handle the module handle
* @return the total current (amps)
* @return the total current (amps)
*/
double HAL_GetPDPTotalCurrent(HAL_PDPHandle handle, int32_t* status);
@@ -105,7 +105,7 @@ double HAL_GetPDPTotalCurrent(HAL_PDPHandle handle, int32_t* status);
* Gets the total power of the PDP.
*
* @param handle the module handle
* @return the total power (watts)
* @return the total power (watts)
*/
double HAL_GetPDPTotalPower(HAL_PDPHandle handle, int32_t* status);
@@ -113,7 +113,7 @@ double HAL_GetPDPTotalPower(HAL_PDPHandle handle, int32_t* status);
* Gets the total energy of the PDP.
*
* @param handle the module handle
* @return the total energy (joules)
* @return the total energy (joules)
*/
double HAL_GetPDPTotalEnergy(HAL_PDPHandle handle, int32_t* status);

View File

@@ -69,15 +69,15 @@ static int32_t HAL_GetJoystickButtonsInternal(int32_t joystickNum,
joystickNum, &buttons->buttons, &buttons->count);
}
/**
* Retrieve the Joystick Descriptor for particular slot
* @param desc [out] descriptor (data transfer object) to fill in. desc is
* filled in regardless of success. In other words, if descriptor is not
* available, desc is filled in with default values matching the init-values in
* Java and C++ Driverstation for when caller requests a too-large joystick
* index.
* Retrieve the Joystick Descriptor for particular slot.
*
* @param[out] desc descriptor (data transfer object) to fill in. desc is filled
* in regardless of success. In other words, if descriptor is
* not available, desc is filled in with default values
* matching the init-values in Java and C++ Driverstation for
* when caller requests a too-large joystick index.
* @return error code reported from Network Comm back-end. Zero is good,
* nonzero is bad.
* nonzero is bad.
*/
static int32_t HAL_GetJoystickDescriptorInternal(int32_t joystickNum,
HAL_JoystickDescriptor* desc) {

View File

@@ -280,10 +280,10 @@ uint64_t HAL_GetFPGATime(int32_t* status) {
return (upper2 << 32) + lower;
}
uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status) {
uint64_t HAL_ExpandFPGATime(uint32_t unexpandedLower, int32_t* status) {
// Capture the current FPGA time. This will give us the upper half of the
// clock.
uint64_t fpga_time = HAL_GetFPGATime(status);
uint64_t fpgaTime = HAL_GetFPGATime(status);
if (*status != 0) {
return 0;
}
@@ -293,15 +293,15 @@ uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status) {
// be.
// Break it into lower and upper portions.
uint32_t lower = fpga_time & 0xffffffffull;
uint64_t upper = (fpga_time >> 32) & 0xffffffff;
uint32_t lower = fpgaTime & 0xffffffffull;
uint64_t upper = (fpgaTime >> 32) & 0xffffffff;
// The time was sampled *before* the current time, so roll it back.
if (lower < unexpanded_lower) {
if (lower < unexpandedLower) {
--upper;
}
return (upper << 32) + static_cast<uint64_t>(unexpanded_lower);
return (upper << 32) + static_cast<uint64_t>(unexpandedLower);
}
HAL_Bool HAL_GetFPGAButton(int32_t* status) {

View File

@@ -30,7 +30,7 @@ extern "C" {
* Initializes a REV Power Distribution Hub (PDH) device.
*
* @param module the device CAN ID (1 .. 63)
* @return the created PDH handle
* @return the created PDH handle
*/
HAL_REVPDHHandle HAL_REV_InitializePDH(int32_t module,
const char* allocationLocation,
@@ -54,7 +54,7 @@ int32_t HAL_REV_GetPDHModuleNumber(HAL_REVPDHHandle handle, int32_t* status);
* Does not check if a PDH device with this module has been initialized.
*
* @param module module number (1 .. 63)
* @return 1 if the module number is valid; 0 otherwise
* @return 1 if the module number is valid; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHModuleNumber(int32_t module);
@@ -62,7 +62,7 @@ HAL_Bool HAL_REV_CheckPDHModuleNumber(int32_t module);
* Checks if a PDH channel number is valid.
*
* @param module channel number (0 .. HAL_REV_PDH_NUM_CHANNELS)
* @return 1 if the channel number is valid; 0 otherwise
* @return 1 if the channel number is valid; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHChannelNumber(int32_t channel);
@@ -73,7 +73,7 @@ HAL_Bool HAL_REV_CheckPDHChannelNumber(int32_t channel);
* @param channel the channel to retrieve the current of (0 ..
* HAL_REV_PDH_NUM_CHANNELS)
*
* @return the current of the PDH channel in Amps
* @return the current of the PDH channel in Amps
*/
double HAL_REV_GetPDHChannelCurrent(HAL_REVPDHHandle handle, int32_t channel,
int32_t* status);
@@ -91,7 +91,7 @@ void HAL_REV_GetPDHAllChannelCurrents(HAL_REVPDHHandle handle, double* currents,
*
* @param handle PDH handle
*
* @return the total current of the PDH in Amps
* @return the total current of the PDH in Amps
*/
uint16_t HAL_REV_GetPDHTotalCurrent(HAL_REVPDHHandle handle, int32_t* status);
@@ -112,7 +112,7 @@ void HAL_REV_SetPDHSwitchableChannel(HAL_REVPDHHandle handle, HAL_Bool enabled,
* fresh as the last packet received.
*
* @param handle PDH handle
* @return 1 if the switchable channel is enabled; 0 otherwise
* @return 1 if the switchable channel is enabled; 0 otherwise
*/
HAL_Bool HAL_REV_GetPDHSwitchableChannelState(HAL_REVPDHHandle handle,
int32_t* status);
@@ -125,7 +125,7 @@ HAL_Bool HAL_REV_GetPDHSwitchableChannelState(HAL_REVPDHHandle handle,
* @param handle PDH handle
* @param channel the channel to retrieve the brownout status of
*
* @return 1 if the channel is experiencing a brownout; 0 otherwise
* @return 1 if the channel is experiencing a brownout; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHChannelBrownout(HAL_REVPDHHandle handle,
int32_t channel, int32_t* status);
@@ -135,7 +135,7 @@ HAL_Bool HAL_REV_CheckPDHChannelBrownout(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return the voltage at the input of the PDH in Volts
* @return the voltage at the input of the PDH in Volts
*/
double HAL_REV_GetPDHSupplyVoltage(HAL_REVPDHHandle handle, int32_t* status);
@@ -144,7 +144,7 @@ double HAL_REV_GetPDHSupplyVoltage(HAL_REVPDHHandle handle, int32_t* status);
*
* @param handle PDH handle
*
* @return 1 if the PDH is enabled; 0 otherwise
* @return 1 if the PDH is enabled; 0 otherwise
*/
HAL_Bool HAL_REV_IsPDHEnabled(HAL_REVPDHHandle handle, int32_t* status);
@@ -156,7 +156,7 @@ HAL_Bool HAL_REV_IsPDHEnabled(HAL_REVPDHHandle handle, int32_t* status);
*
* @param handle PDH handle
*
* @return 1 if the PDH is experiencing a brownout; 0 otherwise
* @return 1 if the PDH is experiencing a brownout; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHBrownout(HAL_REVPDHHandle handle, int32_t* status);
@@ -168,7 +168,7 @@ HAL_Bool HAL_REV_CheckPDHBrownout(HAL_REVPDHHandle handle, int32_t* status);
*
* @param handle PDH handle
*
* @return 1 if the device has exceeded the warning threshold; 0
* @return 1 if the device has exceeded the warning threshold; 0
* otherwise
*/
HAL_Bool HAL_REV_CheckPDHCANWarning(HAL_REVPDHHandle handle, int32_t* status);
@@ -180,7 +180,7 @@ HAL_Bool HAL_REV_CheckPDHCANWarning(HAL_REVPDHHandle handle, int32_t* status);
*
* @param handle PDH handle
*
* @return 1 if the device is in a hardware fault state; 0
* @return 1 if the device is in a hardware fault state; 0
* otherwise
*/
HAL_Bool HAL_REV_CheckPDHHardwareFault(HAL_REVPDHHandle handle,
@@ -194,7 +194,7 @@ HAL_Bool HAL_REV_CheckPDHHardwareFault(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return 1 if the device has had a brownout; 0 otherwise
* @return 1 if the device has had a brownout; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyBrownout(HAL_REVPDHHandle handle,
int32_t* status);
@@ -207,7 +207,7 @@ HAL_Bool HAL_REV_CheckPDHStickyBrownout(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return 1 if the device has exceeded the CAN warning threshold;
* @return 1 if the device has exceeded the CAN warning threshold;
* 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyCANWarning(HAL_REVPDHHandle handle,
@@ -221,7 +221,7 @@ HAL_Bool HAL_REV_CheckPDHStickyCANWarning(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return 1 if the device has experienced a 'Bus Off' event; 0
* @return 1 if the device has experienced a 'Bus Off' event; 0
* otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyCANBusOff(HAL_REVPDHHandle handle,
@@ -234,7 +234,7 @@ HAL_Bool HAL_REV_CheckPDHStickyCANBusOff(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return 1 if the device has had a malfunction; 0 otherwise
* @return 1 if the device has had a malfunction; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyHardwareFault(HAL_REVPDHHandle handle,
int32_t* status);
@@ -247,7 +247,7 @@ HAL_Bool HAL_REV_CheckPDHStickyHardwareFault(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return 1 if the device has had a malfunction and reset; 0
* @return 1 if the device has had a malfunction and reset; 0
* otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyFirmwareFault(HAL_REVPDHHandle handle,
@@ -264,7 +264,7 @@ HAL_Bool HAL_REV_CheckPDHStickyFirmwareFault(HAL_REVPDHHandle handle,
* 23)
*
*
* @return 1 if the channel has had a brownout; 0 otherwise
* @return 1 if the channel has had a brownout; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyChannelBrownout(HAL_REVPDHHandle handle,
int32_t channel,
@@ -277,7 +277,7 @@ HAL_Bool HAL_REV_CheckPDHStickyChannelBrownout(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return 1 if the device has reset; 0 otherwise
* @return 1 if the device has reset; 0 otherwise
*/
HAL_Bool HAL_REV_CheckPDHStickyHasReset(HAL_REVPDHHandle handle,
int32_t* status);
@@ -287,7 +287,7 @@ HAL_Bool HAL_REV_CheckPDHStickyHasReset(HAL_REVPDHHandle handle,
*
* @param handle PDH handle
*
* @return version information
* @return version information
*/
REV_PDH_Version HAL_REV_GetPDHVersion(HAL_REVPDHHandle handle, int32_t* status);

View File

@@ -21,7 +21,8 @@ extern "C" {
/**
* Is the channel attached to an accumulator.
*
* @param analogPortHandle Handle to the analog port.
* @param[in] analogPortHandle Handle to the analog port.
* @param[out] status Error status variable. 0 on success.
* @return The analog channel is attached to an accumulator.
*/
HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
@@ -30,7 +31,8 @@ HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
/**
* Initialize the accumulator.
*
* @param analogPortHandle Handle to the analog port.
* @param[in] analogPortHandle Handle to the analog port.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
int32_t* status);
@@ -38,7 +40,8 @@ void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
/**
* Resets the accumulator to the initial value.
*
* @param analogPortHandle Handle to the analog port.
* @param[in] analogPortHandle Handle to the analog port.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
int32_t* status);
@@ -55,8 +58,9 @@ void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
* source from channel 1. Because of this, any non-zero oversample bits will
* affect the size of the value for this field.
*
* @param analogPortHandle Handle to the analog port.
* @param center The center value of the accumulator.
* @param[in] analogPortHandle Handle to the analog port.
* @param[in] center The center value of the accumulator.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
int32_t center, int32_t* status);
@@ -64,8 +68,9 @@ void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
/**
* Set the accumulator's deadband.
*
* @param analogPortHandle Handle to the analog port.
* @param deadband The deadband of the accumulator.
* @param[in] analogPortHandle Handle to the analog port.
* @param[in] deadband The deadband of the accumulator.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
int32_t deadband, int32_t* status);
@@ -76,7 +81,8 @@ void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
* Read the value that has been accumulating on channel 1.
* The accumulator is attached after the oversample and average engine.
*
* @param analogPortHandle Handle to the analog port.
* @param[in] analogPortHandle Handle to the analog port.
* @param[out] status Error status variable. 0 on success.
* @return The 64-bit value accumulated since the last Reset().
*/
int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
@@ -88,7 +94,8 @@ int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
* Read the count of the accumulated values since the accumulator was last
* Reset().
*
* @param analogPortHandle Handle to the analog port.
* @param[in] analogPortHandle Handle to the analog port.
* @param[out] status Error status variable. 0 on success.
* @return The number of times samples from the channel were accumulated.
*/
int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
@@ -100,9 +107,10 @@ int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
* This function reads the value and count from the FPGA atomically.
* This can be used for averaging.
*
* @param analogPortHandle Handle to the analog port.
* @param value Pointer to the 64-bit accumulated output.
* @param count Pointer to the number of accumulation cycles.
* @param[in] analogPortHandle Handle to the analog port.
* @param[in] value Pointer to the 64-bit accumulated output.
* @param[in] count Pointer to the number of accumulation cycles.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
int64_t* value, int64_t* count, int32_t* status);

View File

@@ -21,10 +21,11 @@ extern "C" {
/**
* Initializes an analog gyro.
*
* @param handle handle to the analog port
* @param allocationLocation the location where the allocation is occuring
* (can be null)
* @return the initialized gyro handle
* @param[in] handle handle to the analog port
* @param[in] allocationLocation the location where the allocation is occuring
* (can be null)
* @param[out] status the error code, or 0 for success
* @return the initialized gyro handle
*/
HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle handle,
const char* allocationLocation,
@@ -34,7 +35,8 @@ HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle handle,
* Sets up an analog gyro with the proper offsets and settings for the KOP
* analog gyro.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status the error code, or 0 for success
*/
void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status);
@@ -51,10 +53,11 @@ void HAL_FreeAnalogGyro(HAL_GyroHandle handle);
* This is meant to be used if you want to reuse the values from a previous
* calibration.
*
* @param handle the gyro handle
* @param voltsPerDegreePerSecond the gyro volts scaling
* @param offset the gyro offset
* @param center the gyro center
* @param[in] handle the gyro handle
* @param[in] voltsPerDegreePerSecond the gyro volts scaling
* @param[in] offset the gyro offset
* @param[in] center the gyro center
* @param[out] status the error code, or 0 for success
*/
void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
double voltsPerDegreePerSecond, double offset,
@@ -63,8 +66,9 @@ void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
/**
* Sets the analog gyro volts per degrees per second scaling.
*
* @param handle the gyro handle
* @param voltsPerDegreePerSecond the gyro volts scaling
* @param[in] handle the gyro handle
* @param[in] voltsPerDegreePerSecond the gyro volts scaling
* @param[out] status the error code, or 0 for success
*/
void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
double voltsPerDegreePerSecond,
@@ -73,7 +77,8 @@ void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
/**
* Resets the analog gyro value to 0.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status the error code, or 0 for success
*/
void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status);
@@ -84,15 +89,17 @@ void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status);
* setting that as the center. Note that this call blocks for 5 seconds to
* perform this.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status);
/**
* Sets the deadband of the analog gyro.
*
* @param handle the gyro handle
* @param volts the voltage deadband
* @param[in] handle the gyro handle
* @param[in] volts the voltage deadband
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
int32_t* status);
@@ -100,7 +107,8 @@ void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
/**
* Gets the gyro angle in degrees.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status Error status variable. 0 on success.
* @return the gyro angle in degrees
*/
double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status);
@@ -108,7 +116,8 @@ double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status);
/**
* Gets the gyro rate in degrees/second.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status Error status variable. 0 on success.
* @return the gyro rate in degrees/second
*/
double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status);
@@ -118,7 +127,8 @@ double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status);
*
* Can be used to not repeat a calibration but reconstruct the gyro object.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status Error status variable. 0 on success.
* @return the gryo offset
*/
double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status);
@@ -128,7 +138,8 @@ double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status);
*
* Can be used to not repeat a calibration but reconstruct the gyro object.
*
* @param handle the gyro handle
* @param[in] handle the gyro handle
* @param[out] status Error status variable. 0 on success.
* @return the gyro center
*/
int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status);

View File

@@ -21,10 +21,11 @@ extern "C" {
/**
* Initializes the analog input port using the given port object.
*
* @param portHandle Handle to the port to initialize.
* @param allocationLocation the location where the allocation is occuring
* (can be null)
* @return the created analog input handle
* @param[in] portHandle Handle to the port to initialize.
* @param[in] allocationLocation the location where the allocation is occuring
* (can be null)
* @param[out] status the error code, or 0 for success
* @return the created analog input handle
*/
HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
HAL_PortHandle portHandle, const char* allocationLocation, int32_t* status);
@@ -68,7 +69,8 @@ void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle,
*
* This is a global setting for the Athena and effects all channels.
*
* @param samplesPerSecond The number of samples per channel per second.
* @param[in] samplesPerSecond The number of samples per channel per second.
* @param[out] status the error code, or 0 for success
*/
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status);
@@ -78,6 +80,7 @@ void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status);
* This assumes one entry in the scan list.
* This is a global setting for the Athena and effects all channels.
*
* @param[out] status the error code, or 0 for success
* @return Sample rate.
*/
double HAL_GetAnalogSampleRate(int32_t* status);
@@ -89,8 +92,9 @@ double HAL_GetAnalogSampleRate(int32_t* status);
* is 2**bits. Use averaging to improve the stability of your measurement at the
* expense of sampling rate. The averaging is done automatically in the FPGA.
*
* @param analogPortHandle Handle to the analog port to configure.
* @param bits Number of bits to average.
* @param[in] analogPortHandle Handle to the analog port to configure.
* @param[in] bits Number of bits to average.
* @param[out] status the error code, or 0 for success
*/
void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
int32_t bits, int32_t* status);
@@ -101,7 +105,8 @@ void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
* This gets the number of averaging bits from the FPGA. The actual number of
* averaged samples is 2**bits. The averaging is done automatically in the FPGA.
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return Bits to average.
*/
int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
@@ -115,8 +120,9 @@ int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
* measurements at the expense of sampling rate. The oversampling is done
* automatically in the FPGA.
*
* @param analogPortHandle Handle to the analog port to use.
* @param bits Number of bits to oversample.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[in] bits Number of bits to oversample.
* @param[out] status the error code, or 0 for success
*/
void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
int32_t bits, int32_t* status);
@@ -128,7 +134,8 @@ void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
* oversampled values is 2**bits. The oversampling is done automatically in the
* FPGA.
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return Bits to oversample.
*/
int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
@@ -141,7 +148,8 @@ int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
* converter in the module. The units are in A/D converter codes. Use
* GetVoltage() to get the analog value in calibrated units.
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return A sample straight from the channel on this module.
*/
int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
@@ -158,7 +166,8 @@ int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
* the module on this channel. Use GetAverageVoltage() to get the analog value
* in calibrated units.
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return A sample from the oversample and average engine for the channel.
*/
int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
@@ -172,8 +181,9 @@ int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
*
* @todo This assumes raw values. Oversampling not supported as is.
*
* @param analogPortHandle Handle to the analog port to use.
* @param voltage The voltage to convert.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[in] voltage The voltage to convert.
* @param[out] status the error code, or 0 for success
* @return The raw value for the channel.
*/
int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
@@ -185,7 +195,8 @@ int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
* The value is scaled to units of Volts using the calibrated scaling data from
* GetLSBWeight() and GetOffset().
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return A scaled sample straight from the channel on this module.
*/
double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
@@ -200,7 +211,8 @@ double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
* be higher resolution, but it will update more slowly. Using averaging will
* cause this value to be more stable, but it will update more slowly.
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return A scaled sample from the output of the oversample and average engine
* for the channel.
*/
@@ -214,7 +226,8 @@ double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
*
* Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status the error code, or 0 for success
* @return Least significant bit weight.
*/
int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
@@ -227,7 +240,8 @@ int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
*
* Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
*
* @param analogPortHandle Handle to the analog port to use.
* @param[in] analogPortHandle Handle to the analog port to use.
* @param[out] status Error status variable. 0 on success.
* @return Offset constant.
*/
int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
@@ -236,9 +250,11 @@ int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
/**
* Get the analog voltage from a raw value.
*
* @param analogPortHandle Handle to the analog port the values were read from.
* @param rawValue The raw analog value
* @return The voltage relating to the value
* @param[in] analogPortHandle Handle to the analog port the values were read
* from.
* @param[in] rawValue The raw analog value
* @param[out] status Error status variable. 0 on success.
* @return The voltage relating to the value
*/
double HAL_GetAnalogValueToVolts(HAL_AnalogInputHandle analogPortHandle,
int32_t rawValue, int32_t* status);

View File

@@ -21,10 +21,11 @@ extern "C" {
/**
* Initializes the analog output port using the given port object.
*
* @param handle handle to the port
* @param allocationLocation the location where the allocation is occuring
* (can be null)
* @return the created analog output handle
* @param[in] portHandle handle to the port
* @param[in] allocationLocation the location where the allocation is occuring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created analog output handle
*/
HAL_AnalogOutputHandle HAL_InitializeAnalogOutputPort(
HAL_PortHandle portHandle, const char* allocationLocation, int32_t* status);
@@ -39,8 +40,9 @@ void HAL_FreeAnalogOutputPort(HAL_AnalogOutputHandle analogOutputHandle);
/**
* Sets an analog output value.
*
* @param analogOutputHandle the analog output handle
* @param voltage the voltage (0-5v) to output
* @param[in] analogOutputHandle the analog output handle
* @param[in] voltage the voltage (0-5v) to output
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
double voltage, int32_t* status);
@@ -48,8 +50,9 @@ void HAL_SetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
/**
* Gets the current analog output value.
*
* @param analogOutputHandle the analog output handle
* @return the current output voltage (0-5v)
* @param[in] analogOutputHandle the analog output handle
* @param[out] status Error status variable. 0 on success.
* @return the current output voltage (0-5v)
*/
double HAL_GetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
int32_t* status);

View File

@@ -33,8 +33,9 @@ extern "C" {
/**
* Initializes an analog trigger.
*
* @param portHandle the analog input to use for triggering
* @return the created analog trigger handle
* @param[in] portHandle the analog input to use for triggering
* @param[out] status Error status variable. 0 on success.
* @return the created analog trigger handle
*/
HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger(
HAL_AnalogInputHandle portHandle, int32_t* status);
@@ -42,6 +43,8 @@ HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger(
/**
* Initializes an analog trigger with a Duty Cycle input
*
* @param[in] dutyCycleHandle the analog input to use for duty cycle
* @param[out] status Error status variable. 0 on success.
*/
HAL_AnalogTriggerHandle HAL_InitializeAnalogTriggerDutyCycle(
HAL_DutyCycleHandle dutyCycleHandle, int32_t* status);
@@ -49,7 +52,8 @@ HAL_AnalogTriggerHandle HAL_InitializeAnalogTriggerDutyCycle(
/**
* Frees an analog trigger.
*
* @param analogTriggerHandle the trigger handle
* @param[in] analogTriggerHandle the trigger handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CleanAnalogTrigger(HAL_AnalogTriggerHandle analogTriggerHandle,
int32_t* status);
@@ -60,9 +64,10 @@ void HAL_CleanAnalogTrigger(HAL_AnalogTriggerHandle analogTriggerHandle,
* HAL_SetAnalogTriggerLimitsVoltage or HAL_SetAnalogTriggerLimitsDutyCycle
* is likely better in most cases.
*
* @param analogTriggerHandle the trigger handle
* @param lower the lower ADC value
* @param upper the upper ADC value
* @param[in] analogTriggerHandle the trigger handle
* @param[in] lower the lower ADC value
* @param[in] upper the upper ADC value
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAnalogTriggerLimitsRaw(HAL_AnalogTriggerHandle analogTriggerHandle,
int32_t lower, int32_t upper,
@@ -73,14 +78,25 @@ void HAL_SetAnalogTriggerLimitsRaw(HAL_AnalogTriggerHandle analogTriggerHandle,
*
* The limits are given as floating point voltage values.
*
* @param analogTriggerHandle the trigger handle
* @param lower the lower voltage value
* @param upper the upper voltage value
* @param[in] analogTriggerHandle the trigger handle
* @param[in] lower the lower voltage value
* @param[in] upper the upper voltage value
* @param[out] status Error status variable. 0 on success.
*/
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 duty cycle values.
*
* @param[in] analogTriggerHandle the trigger handle
* @param[in] lower the lower duty cycle value
* @param[in] upper the upper duty cycle value
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAnalogTriggerLimitsDutyCycle(
HAL_AnalogTriggerHandle analogTriggerHandle, double lower, double upper,
int32_t* status);
@@ -94,8 +110,9 @@ void HAL_SetAnalogTriggerLimitsDutyCycle(
* This is not allowed to be used if filtered mode is set.
* This is not allowed to be used with Duty Cycle based inputs.
*
* @param analogTriggerHandle the trigger handle
* @param useAveragedValue true to use averaged values, false for raw
* @param[in] analogTriggerHandle the trigger handle
* @param[in] useAveragedValue true to use averaged values, false for raw
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAnalogTriggerAveraged(HAL_AnalogTriggerHandle analogTriggerHandle,
HAL_Bool useAveragedValue, int32_t* status);
@@ -109,9 +126,10 @@ void HAL_SetAnalogTriggerAveraged(HAL_AnalogTriggerHandle analogTriggerHandle,
*
* This is not allowed to be used if averaged mode is set.
*
* @param analogTriggerHandle the trigger handle
* @param useFilteredValue true to use filtered values, false for average or
* raw
* @param[in] analogTriggerHandle the trigger handle
* @param[in] useFilteredValue true to use filtered values, false for average
* or raw
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetAnalogTriggerFiltered(HAL_AnalogTriggerHandle analogTriggerHandle,
HAL_Bool useFilteredValue, int32_t* status);
@@ -121,8 +139,9 @@ void HAL_SetAnalogTriggerFiltered(HAL_AnalogTriggerHandle analogTriggerHandle,
*
* True if the analog input is between the upper and lower limits.
*
* @param analogTriggerHandle the trigger handle
* @return the InWindow output of the analog trigger
* @param[in] analogTriggerHandle the trigger handle
* @param[out] status Error status variable. 0 on success.
* @return the InWindow output of the analog trigger
*/
HAL_Bool HAL_GetAnalogTriggerInWindow(
HAL_AnalogTriggerHandle analogTriggerHandle, int32_t* status);
@@ -134,8 +153,9 @@ HAL_Bool HAL_GetAnalogTriggerInWindow(
* False if below lower limit.
* If in Hysteresis, maintain previous state.
*
* @param analogTriggerHandle the trigger handle
* @return the TriggerState output of the analog trigger
* @param[in] analogTriggerHandle the trigger handle
* @param[out] status Error status variable. 0 on success.
* @return the TriggerState output of the analog trigger
*/
HAL_Bool HAL_GetAnalogTriggerTriggerState(
HAL_AnalogTriggerHandle analogTriggerHandle, int32_t* status);
@@ -143,9 +163,10 @@ HAL_Bool HAL_GetAnalogTriggerTriggerState(
/**
* Gets the state of the analog trigger output.
*
* @param analogTriggerHandle the trigger handle
* @param type the type of trigger to trigger on
* @return the state of the analog trigger output
* @param[in] analogTriggerHandle the trigger handle
* @param[in] type the type of trigger to trigger on
* @param[out] status Error status variable. 0 on success.
* @return the state of the analog trigger output
*/
HAL_Bool HAL_GetAnalogTriggerOutput(HAL_AnalogTriggerHandle analogTriggerHandle,
HAL_AnalogTriggerType type,
@@ -154,7 +175,8 @@ HAL_Bool HAL_GetAnalogTriggerOutput(HAL_AnalogTriggerHandle analogTriggerHandle,
/**
* Get the FPGA index for the AnlogTrigger.
*
* @param analogTriggerHandle the trigger handle
* @param[in] analogTriggerHandle the trigger handle
* @param[out] status Error status variable. 0 on success.
* @return the FPGA index
*/
int32_t HAL_GetAnalogTriggerFPGAIndex(

View File

@@ -45,11 +45,12 @@ extern "C" {
/**
* Sends a CAN message.
*
* @param messageID the CAN ID to send
* @param data the data to send (0-8 bytes)
* @param dataSize the size of the data to send (0-8 bytes)
* @param periodMs the period to repeat the packet at. Use
* HAL_CAN_SEND_PERIOD_NO_REPEAT to not repeat.
* @param[in] messageID the CAN ID to send
* @param[in] data the data to send (0-8 bytes)
* @param[in] dataSize the size of the data to send (0-8 bytes)
* @param[in] periodMs the period to repeat the packet at. Use
* HAL_CAN_SEND_PERIOD_NO_REPEAT to not repeat.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CAN_SendMessage(uint32_t messageID, const uint8_t* data,
uint8_t dataSize, int32_t periodMs, int32_t* status);
@@ -57,12 +58,13 @@ void HAL_CAN_SendMessage(uint32_t messageID, const uint8_t* data,
/**
* Receives a CAN message.
*
* @param messageID store for the received message ID
* @param messageIDMask the message ID mask to look for
* @param data data output (8 bytes)
* @param dataSize data length (0-8 bytes)
* @param timeStamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[out] messageID store for the received message ID
* @param[in] messageIDMask the message ID mask to look for
* @param[out] data data output (8 bytes)
* @param[out] dataSize data length (0-8 bytes)
* @param[out] timeStamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CAN_ReceiveMessage(uint32_t* messageID, uint32_t messageIDMask,
uint8_t* data, uint8_t* dataSize,
@@ -71,10 +73,11 @@ void HAL_CAN_ReceiveMessage(uint32_t* messageID, uint32_t messageIDMask,
/**
* Opens a CAN stream.
*
* @param sessionHandle output for the session handle
* @param messageID the message ID to read
* @param messageIDMask the mssage ID mask
* @param maxMessages the maximum number of messages to stream
* @param[out] sessionHandle output for the session handle
* @param[in] messageID the message ID to read
* @param[in] messageIDMask the mssage ID mask
* @param[in] maxMessages the maximum number of messages to stream
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CAN_OpenStreamSession(uint32_t* sessionHandle, uint32_t messageID,
uint32_t messageIDMask, uint32_t maxMessages,
@@ -90,10 +93,11 @@ void HAL_CAN_CloseStreamSession(uint32_t sessionHandle);
/**
* Reads a CAN stream message.
*
* @param sessionHandle the session handle
* @param messages array of messages
* @param messagesToRead the max number of messages to read
* @param messageRead the number of messages actually read
* @param[in] sessionHandle the session handle
* @param[in] messages array of messages
* @param[in] messagesToRead the max number of messages to read
* @param[out] messagesRead the number of messages actually read
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CAN_ReadStreamSession(uint32_t sessionHandle,
struct HAL_CANStreamMessage* messages,
@@ -103,11 +107,12 @@ void HAL_CAN_ReadStreamSession(uint32_t sessionHandle,
/**
* Gets CAN status information.
*
* @param percentBusUtilization the bus utilization
* @param busOffCount the number of bus off errors
* @param txFullCount the number of tx full errors
* @param receiveErrorCount the number of receive errors
* @param transmitErrorCount the number of transmit errors
* @param[out] percentBusUtilization the bus utilization
* @param[out] busOffCount the number of bus off errors
* @param[out] txFullCount the number of tx full errors
* @param[out] receiveErrorCount the number of receive errors
* @param[out] transmitErrorCount the number of transmit errors
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CAN_GetCANStatus(float* percentBusUtilization, uint32_t* busOffCount,
uint32_t* txFullCount, uint32_t* receiveErrorCount,

View File

@@ -24,10 +24,11 @@ extern "C" {
*
* These follow the FIRST standard CAN layout. Link TBD
*
* @param manufacturer the can manufacturer
* @param deviceId the device ID (0-63)
* @param deviceType the device type
* @return the created CAN handle
* @param[in] manufacturer the can manufacturer
* @param[in] deviceId the device ID (0-63)
* @param[in] deviceType the device type
* @param[out] status Error status variable. 0 on success.
* @return the created CAN handle
*/
HAL_CANHandle HAL_InitializeCAN(HAL_CANManufacturer manufacturer,
int32_t deviceId, HAL_CANDeviceType deviceType,
@@ -45,10 +46,11 @@ void HAL_CleanCAN(HAL_CANHandle handle);
*
* This ID is 10 bits.
*
* @param handle the CAN handle
* @param data the data to write (0-8 bytes)
* @param length the length of data (0-8)
* @param apiId the ID to write (0-1023 bits)
* @param[in] handle the CAN handle
* @param[in] data the data to write (0-8 bytes)
* @param[in] length the length of data (0-8)
* @param[in] apiId the ID to write (0-1023 bits)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_WriteCANPacket(HAL_CANHandle handle, const uint8_t* data,
int32_t length, int32_t apiId, int32_t* status);
@@ -60,11 +62,12 @@ void HAL_WriteCANPacket(HAL_CANHandle handle, const uint8_t* data,
*
* The RoboRIO will automatically repeat the packet at the specified interval
*
* @param handle the CAN handle
* @param data the data to write (0-8 bytes)
* @param length the length of data (0-8)
* @param apiId the ID to write (0-1023)
* @param repeatMs the period to repeat in ms
* @param[in] handle the CAN handle
* @param[in] data the data to write (0-8 bytes)
* @param[in] length the length of data (0-8)
* @param[in] apiId the ID to write (0-1023)
* @param[in] repeatMs the period to repeat in ms
* @param[out] status Error status variable. 0 on success.
*/
void HAL_WriteCANPacketRepeating(HAL_CANHandle handle, const uint8_t* data,
int32_t length, int32_t apiId,
@@ -77,9 +80,10 @@ void HAL_WriteCANPacketRepeating(HAL_CANHandle handle, const uint8_t* data,
* By spec, the length must be equal to the length sent by the other device,
* otherwise behavior is unspecified.
*
* @param handle the CAN handle
* @param length the length of data to request (0-8)
* @param apiId the ID to write (0-1023)
* @param[in] handle the CAN handle
* @param[in] length the length of data to request (0-8)
* @param[in] apiId the ID to write (0-1023)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_WriteCANRTRFrame(HAL_CANHandle handle, int32_t length, int32_t apiId,
int32_t* status);
@@ -89,8 +93,9 @@ void HAL_WriteCANRTRFrame(HAL_CANHandle handle, int32_t length, int32_t apiId,
*
* This ID is 10 bits.
*
* @param handle the CAN handle
* @param apiId the ID to stop repeating (0-1023)
* @param[in] handle the CAN handle
* @param[in] apiId the ID to stop repeating (0-1023)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_StopCANPacketRepeating(HAL_CANHandle handle, int32_t apiId,
int32_t* status);
@@ -101,12 +106,13 @@ void HAL_StopCANPacketRepeating(HAL_CANHandle handle, int32_t apiId,
* This will only return properly once per packet received. Multiple calls
* without receiving another packet will return an error code.
*
* @param handle the CAN handle
* @param apiId the ID to read (0-1023)
* @param data the packet data (8 bytes)
* @param length the received length (0-8 bytes)
* @param receivedTimestamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[in] handle the CAN handle
* @param[in] apiId the ID to read (0-1023)
* @param[out] data the packet data (8 bytes)
* @param[out] length the received length (0-8 bytes)
* @param[out] receivedTimestamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ReadCANPacketNew(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
int32_t* length, uint64_t* receivedTimestamp,
@@ -116,12 +122,13 @@ void HAL_ReadCANPacketNew(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
* Reads a CAN packet. The will continuously return the last packet received,
* without accounting for packet age.
*
* @param handle the CAN handle
* @param apiId the ID to read (0-1023)
* @param data the packet data (8 bytes)
* @param length the received length (0-8 bytes)
* @param receivedTimestamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[in] handle the CAN handle
* @param[in] apiId the ID to read (0-1023)
* @param[out] data the packet data (8 bytes)
* @param[out] length the received length (0-8 bytes)
* @param[out] receivedTimestamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ReadCANPacketLatest(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
int32_t* length, uint64_t* receivedTimestamp,
@@ -132,13 +139,14 @@ void HAL_ReadCANPacketLatest(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
* packet is older then the requested timeout. Then it will return an error
* code.
*
* @param handle the CAN handle
* @param apiId the ID to read (0-1023)
* @param data the packet data (8 bytes)
* @param length the received length (0-8 bytes)
* @param receivedTimestamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param timeoutMs the timeout time for the packet
* @param[in] handle the CAN handle
* @param[in] apiId the ID to read (0-1023)
* @param[out] data the packet data (8 bytes)
* @param[out] length the received length (0-8 bytes)
* @param[out] receivedTimestamp the packet received timestamp (based off of
* CLOCK_MONOTONIC)
* @param[out] timeoutMs the timeout time for the packet
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ReadCANPacketTimeout(HAL_CANHandle handle, int32_t apiId,
uint8_t* data, int32_t* length,

View File

@@ -34,9 +34,10 @@ extern "C" {
/**
* Initializes a counter.
*
* @param mode the counter mode
* @param index the compressor index (output)
* @return the created handle
* @param[in] mode the counter mode
* @param[in] index the compressor index (output)
* @param[out] status Error status variable. 0 on success.
* @return the created handle
*/
HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
int32_t* status);
@@ -44,15 +45,17 @@ HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
/**
* Frees a counter.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status);
/**
* Sets the average sample size of a counter.
*
* @param counterHandle the counter handle
* @param size the size of samples to average
* @param[in] counterHandle the counter handle
* @param[in] size the size of samples to average
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
int32_t* status);
@@ -60,11 +63,13 @@ void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
/**
* Sets the source object that causes the counter to count up.
*
* @param counterHandle the counter handle
* @param digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a HAL_DigitalHandle)
* @param analogTriggerType the analog trigger type if the source is an analog
* trigger
* @param[in] counterHandle the counter handle
* @param[in] digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a
* HAL_DigitalHandle)
* @param[in] analogTriggerType the analog trigger type if the source is an
* analog trigger
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
HAL_Handle digitalSourceHandle,
@@ -76,9 +81,10 @@ void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
*
* Note that both are allowed to be set true at the same time without issues.
*
* @param counterHandle the counter handle
* @param risingEdge true to trigger on rising
* @param fallingEdge true to trigger on falling
* @param[in] counterHandle the counter handle
* @param[in] risingEdge true to trigger on rising
* @param[in] fallingEdge true to trigger on falling
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
HAL_Bool risingEdge, HAL_Bool fallingEdge,
@@ -87,18 +93,21 @@ void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
/**
* Disables the up counting source to the counter.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle, int32_t* status);
/**
* Sets the source object that causes the counter to count down.
*
* @param counterHandle the counter handle
* @param digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a HAL_DigitalHandle)
* @param analogTriggerType the analog trigger type if the source is an analog
* trigger
* @param[in] counterHandle the counter handle
* @param[in] digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a
* HAL_DigitalHandle)
* @param[in] analogTriggerType the analog trigger type if the source is an
* analog trigger
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
HAL_Handle digitalSourceHandle,
@@ -109,9 +118,10 @@ void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
* Sets the down source to either detect rising edges or falling edges.
* Note that both are allowed to be set true at the same time without issues.
*
* @param counterHandle the counter handle
* @param risingEdge true to trigger on rising
* @param fallingEdge true to trigger on falling
* @param[in] counterHandle the counter handle
* @param[in] risingEdge true to trigger on rising
* @param[in] fallingEdge true to trigger on falling
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
HAL_Bool risingEdge, HAL_Bool fallingEdge,
@@ -120,7 +130,8 @@ void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
/**
* Disables the down counting source to the counter.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
int32_t* status);
@@ -130,7 +141,8 @@ void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
*
* Up and down counts are sourced independently from two inputs.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle, int32_t* status);
@@ -140,7 +152,8 @@ void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle, int32_t* status);
* The direction is determined by the B input, with counting happening with the
* A input.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
int32_t* status);
@@ -151,8 +164,10 @@ void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
* The counter counts up based on the time the input is triggered. High or Low
* depends on the highSemiPeriod parameter.
*
* @param counterHandle the counter handle
* @param highSemiPeriod true for counting when the input is high, false for low
* @param[in] counterHandle the counter handle
* @param[in] highSemiPeriod true for counting when the input is high, false for
* low
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
HAL_Bool highSemiPeriod, int32_t* status);
@@ -163,9 +178,10 @@ void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
*
* This mode is most useful for direction sensitive gear tooth sensors.
*
* @param counterHandle the counter handle
* @param threshold The pulse length beyond which the counter counts the
* opposite direction (seconds)
* @param[in] counterHandle the counter handle
* @param[in] threshold The pulse length beyond which the counter counts the
* opposite direction (seconds)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
double threshold, int32_t* status);
@@ -175,7 +191,8 @@ void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
* timer to average when calculating the period. Perform averaging to account
* for mechanical imperfections or as oversampling to increase resolution.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return SamplesToAverage The number of samples being averaged (from 1 to 127)
*/
int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
@@ -186,8 +203,9 @@ int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
* timer to average when calculating the period. Perform averaging to account
* for mechanical imperfections or as oversampling to increase resolution.
*
* @param counterHandle the counter handle
* @param samplesToAverage The number of samples to average from 1 to 127
* @param[in] counterHandle the counter handle
* @param[in] samplesToAverage The number of samples to average from 1 to 127
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
int32_t samplesToAverage, int32_t* status);
@@ -198,7 +216,8 @@ void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
* Sets the counter value to zero. This does not effect the running state of the
* counter, just sets the current value to zero.
*
* @param counterHandle the counter handle
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status);
@@ -208,8 +227,9 @@ void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status);
* Reads the value at this instant. It may still be running, so it reflects the
* current value. Next time it is read, it might have a different value.
*
* @param counterHandle the counter handle
* @return the current counter value
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return the current counter value
*/
int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status);
@@ -219,8 +239,9 @@ int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status);
* Returns the time interval of the most recent count. This can be used for
* velocity calculations to determine shaft speed.
*
* @param counterHandle the counter handle
* @returns the period of the last two pulses in units of seconds
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return the period of the last two pulses in units of seconds
*/
double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status);
@@ -231,9 +252,10 @@ double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status);
* used to determine the "stopped" state of the counter using the
* HAL_GetCounterStopped method.
*
* @param counterHandle the counter handle
* @param maxPeriod the maximum period where the counted device is
* considered moving in seconds
* @param[in] counterHandle the counter handle
* @param[in] maxPeriod the maximum period where the counted device is
* considered moving in seconds
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
int32_t* status);
@@ -258,8 +280,9 @@ void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
* (since it is updated at the end of an average and there are no samples to
* average).
*
* @param counterHandle the counter handle
* @param enabled true to enable counter updating with no samples
* @param[in] counterHandle the counter handle
* @param[in] enabled true to enable counter updating with no samples
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
HAL_Bool enabled, int32_t* status);
@@ -271,9 +294,10 @@ void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
* using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
* device (and counter) are assumed to be stopped and it returns true.
*
* @param counterHandle the counter handle
* @return true if the most recent counter period exceeds the
* MaxPeriod value set by SetMaxPeriod
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return true if the most recent counter period exceeds the MaxPeriod value
* set by SetMaxPeriod
*/
HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
int32_t* status);
@@ -281,8 +305,9 @@ HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
/**
* Gets the last direction the counter value changed.
*
* @param counterHandle the counter handle
* @return the last direction the counter value changed
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return the last direction the counter value changed
*/
HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
int32_t* status);
@@ -293,8 +318,9 @@ HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
* This allows counters to change the direction they are counting in the case of
* 1X and 2X quadrature encoding only. Any other counter mode isn't supported.
*
* @param counterHandle the counter handle
* @param reverseDirection true if the value counted should be negated.
* @param[in] counterHandle the counter handle
* @param[in] reverseDirection true if the value counted should be negated.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
HAL_Bool reverseDirection, int32_t* status);

View File

@@ -21,11 +21,12 @@ extern "C" {
/**
* Creates a new instance of a digital port.
*
* @param portHandle the port handle to create from
* @param input true for input, false for output
* @param allocationLocation the location where the allocation is occuring
* (can be null)
* @return the created digital handle
* @param[in] portHandle the port handle to create from
* @param[in] input true for input, false for output
* @param[in] allocationLocation the location where the allocation is occuring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created digital handle
*/
HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
HAL_Bool input,
@@ -36,14 +37,14 @@ HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
* Checks if a DIO channel is valid.
*
* @param channel the channel number to check
* @return true if the channel is correct, otherwise false
* @return true if the channel is correct, otherwise false
*/
HAL_Bool HAL_CheckDIOChannel(int32_t channel);
/**
* Frees a DIO port.
*
* @param handle the DIO channel handle
* @param dioPortHandle the DIO channel handle
*/
void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle);
@@ -58,6 +59,7 @@ void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device);
/**
* Allocates a DO PWM Generator.
*
* @param[out] status Error status variable. 0 on success.
* @return the allocated digital PWM handle
*/
HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status);
@@ -65,7 +67,8 @@ HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status);
/**
* Frees the resource associated with a DO PWM generator.
*
* @param pwmGenerator the digital PWM handle
* @param[in] pwmGenerator the digital PWM handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status);
@@ -76,15 +79,17 @@ void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status);
*
* The frequency resolution is logarithmic.
*
* @param rate the frequency to output all digital output PWM signals
* @param[in] rate the frequency to output all digital output PWM signals
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDigitalPWMRate(double rate, int32_t* status);
/**
* Configures the duty-cycle of the PWM generator.
*
* @param pwmGenerator the digital PWM handle
* @param dutyCycle the percent duty cycle to output [0..1]
* @param[in] pwmGenerator the digital PWM handle
* @param[in] dutyCycle the percent duty cycle to output [0..1]
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
double dutyCycle, int32_t* status);
@@ -92,8 +97,9 @@ void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
/**
* Configures which DO channel the PWM signal is output on.
*
* @param pwmGenerator the digital PWM handle
* @param channel the channel to output on
* @param[in] pwmGenerator the digital PWM handle
* @param[in] channel the channel to output on
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
int32_t channel, int32_t* status);
@@ -101,9 +107,10 @@ void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
/**
* Writes a digital value to a DIO channel.
*
* @param dioPortHandle the digital port handle
* @param value the state to set the digital channel (if it is
* configured as an output)
* @param[in] dioPortHandle the digital port handle
* @param[in] value the state to set the digital channel (if it is
* configured as an output)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
int32_t* status);
@@ -111,8 +118,9 @@ void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
/**
* Sets the direction of a DIO channel.
*
* @param dioPortHandle the digital port handle
* @param input true to set input, false for output
* @param[in] dioPortHandle the digital port handle
* @param[in] input true to set input, false for output
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input,
int32_t* status);
@@ -120,16 +128,18 @@ void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input,
/**
* Reads a digital value from a DIO channel.
*
* @param dioPortHandle the digital port handle
* @return the state of the specified channel
* @param[in] dioPortHandle the digital port handle
* @param[out] status Error status variable. 0 on success.
* @return the state of the specified channel
*/
HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status);
/**
* Reads the direction of a DIO channel.
*
* @param dioPortHandle the digital port handle
* @return true for input, false for output
* @param[in] dioPortHandle the digital port handle
* @param[out] status Error status variable. 0 on success.
* @return true for input, false for output
*/
HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status);
@@ -139,8 +149,9 @@ HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status);
* Write a pulse to the specified digital output channel. There can only be a
* single pulse going at any time.
*
* @param dioPortHandle the digital port handle
* @param pulseLength the active length of the pulse (in seconds)
* @param[in] dioPortHandle the digital port handle
* @param[in] pulseLength the active length of the pulse (in seconds)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
int32_t* status);
@@ -148,6 +159,8 @@ void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
/**
* Checks a DIO line to see if it is currently generating a pulse.
*
* @param[in] dioPortHandle the digital port handle
* @param[out] status Error status variable. 0 on success.
* @return true if a pulse is in progress, otherwise false
*/
HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status);
@@ -155,6 +168,7 @@ HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status);
/**
* Checks if any DIO line is currently generating a pulse.
*
* @param[out] status Error status variable. 0 on success.
* @return true if a pulse on some line is in progress
*/
HAL_Bool HAL_IsAnyPulsing(int32_t* status);
@@ -164,9 +178,11 @@ HAL_Bool HAL_IsAnyPulsing(int32_t* status);
*
* Set the filter index used to filter out short pulses.
*
* @param dioPortHandle the digital port handle
* @param filterIndex the filter index (Must be in the range 0 - 3, where 0
* means "none" and 1 - 3 means filter # filterIndex - 1)
* @param[in] dioPortHandle the digital port handle
* @param[in] filterIndex the filter index (Must be in the range 0 - 3, where
* 0 means "none" and 1 - 3 means filter # filterIndex
* - 1)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
int32_t* status);
@@ -176,9 +192,10 @@ void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
*
* Gets the filter index used to filter out short pulses.
*
* @param dioPortHandle the digital port handle
* @return filterIndex the filter index (Must be in the range 0 - 3,
* where 0 means "none" and 1 - 3 means filter # filterIndex - 1)
* @param[in] dioPortHandle the digital port handle
* @param[out] status Error status variable. 0 on success.
* @return filterIndex the filter index (Must be in the range 0 - 3, where 0
* means "none" and 1 - 3 means filter # filterIndex - 1)
*/
int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status);
@@ -189,9 +206,10 @@ int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status);
* filter index domains (MXP vs HDR), ignore that distinction for now since it
* compilicates the interface. That can be changed later.
*
* @param filterIndex the filter index, 0 - 2
* @param value the number of cycles that the signal must not transition
* to be counted as a transition.
* @param[in] filterIndex the filter index, 0 - 2
* @param[in] value the number of cycles that the signal must not
* transition to be counted as a transition.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status);
@@ -203,9 +221,8 @@ void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status);
* compilicates the interface. Set status to NiFpga_Status_SoftwareFault if the
* filter values miss-match.
*
* @param filterIndex the filter index, 0 - 2
* @param value the number of cycles that the signal must not transition
* to be counted as a transition.
* @param[in] filterIndex the filter index, 0 - 2
* @param[out] status Error status variable. 0 on success.
*/
int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status);
#ifdef __cplusplus

View File

@@ -42,6 +42,7 @@ extern "C" {
/**
* Initializes an object for peforming DMA transfers.
*
* @param[out] status Error status variable. 0 on success.
* @return the created dma handle
*/
HAL_DMAHandle HAL_InitializeDMA(int32_t* status);
@@ -58,8 +59,9 @@ void HAL_FreeDMA(HAL_DMAHandle handle);
*
* This can only be called while DMA is running.
*
* @param handle the dma handle
* @param pause true to pause transfers, false to resume.
* @param[in] handle the dma handle
* @param[in] pause true to pause transfers, false to resume.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDMAPause(HAL_DMAHandle handle, HAL_Bool pause, int32_t* status);
@@ -72,8 +74,9 @@ void HAL_SetDMAPause(HAL_DMAHandle handle, HAL_Bool pause, int32_t* status);
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param periodSeconds the period to trigger in seconds
* @param[in] handle the dma handle
* @param[in] periodSeconds the period to trigger in seconds
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDMATimedTrigger(HAL_DMAHandle handle, double periodSeconds,
int32_t* status);
@@ -91,8 +94,9 @@ void HAL_SetDMATimedTrigger(HAL_DMAHandle handle, double periodSeconds,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param cycles the period to trigger in FPGA cycles
* @param[in] handle the dma handle
* @param[in] cycles the period to trigger in FPGA cycles
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetDMATimedTriggerCycles(HAL_DMAHandle handle, uint32_t cycles,
int32_t* status);
@@ -102,8 +106,9 @@ void HAL_SetDMATimedTriggerCycles(HAL_DMAHandle handle, uint32_t cycles,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param encoderHandle the encoder to add
* @param[in] handle the dma handle
* @param[in] encoderHandle the encoder to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMAEncoder(HAL_DMAHandle handle, HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -113,8 +118,9 @@ void HAL_AddDMAEncoder(HAL_DMAHandle handle, HAL_EncoderHandle encoderHandle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param encoderHandle the encoder to add
* @param[in] handle the dma handle
* @param[in] encoderHandle the encoder to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMAEncoderPeriod(HAL_DMAHandle handle,
HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -124,8 +130,9 @@ void HAL_AddDMAEncoderPeriod(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param counterHandle the counter to add
* @param[in] handle the dma handle
* @param[in] counterHandle the counter to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMACounter(HAL_DMAHandle handle, HAL_CounterHandle counterHandle,
int32_t* status);
@@ -133,8 +140,9 @@ void HAL_AddDMACounter(HAL_DMAHandle handle, HAL_CounterHandle counterHandle,
/**
* Adds timer data for an counter to be collected by DMA.
*
* @param handle the dma handle
* @param counterHandle the counter to add
* @param[in] handle the dma handle
* @param[in] counterHandle the counter to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMACounterPeriod(HAL_DMAHandle handle,
HAL_CounterHandle counterHandle, int32_t* status);
@@ -144,8 +152,9 @@ void HAL_AddDMACounterPeriod(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param digitalSourceHandle the digital source to add
* @param[in] handle the dma handle
* @param[in] digitalSourceHandle the digital source to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMADigitalSource(HAL_DMAHandle handle,
HAL_Handle digitalSourceHandle, int32_t* status);
@@ -155,8 +164,9 @@ void HAL_AddDMADigitalSource(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param aInHandle the analog input to add
* @param[in] handle the dma handle
* @param[in] aInHandle the analog input to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMAAnalogInput(HAL_DMAHandle handle,
HAL_AnalogInputHandle aInHandle, int32_t* status);
@@ -166,8 +176,9 @@ void HAL_AddDMAAnalogInput(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param aInHandle the analog input to add
* @param[in] handle the dma handle
* @param[in] aInHandle the analog input to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMAAveragedAnalogInput(HAL_DMAHandle handle,
HAL_AnalogInputHandle aInHandle,
@@ -178,8 +189,9 @@ void HAL_AddDMAAveragedAnalogInput(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param aInHandle the analog input to add
* @param[in] handle the dma handle
* @param[in] aInHandle the analog input to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMAAnalogAccumulator(HAL_DMAHandle handle,
HAL_AnalogInputHandle aInHandle,
@@ -190,8 +202,9 @@ void HAL_AddDMAAnalogAccumulator(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param dutyCycleHandle the duty cycle input to add
* @param[in] handle the dma handle
* @param[in] dutyCycleHandle the duty cycle input to add
* @param[out] status Error status variable. 0 on success.
*/
void HAL_AddDMADutyCycle(HAL_DMAHandle handle,
HAL_DutyCycleHandle dutyCycleHandle, int32_t* status);
@@ -205,13 +218,15 @@ void HAL_AddDMADutyCycle(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a HAL_DigitalHandle)
* @param analogTriggerType the analog trigger type if the source is an analog
* trigger
* @param risingEdge true to trigger on rising
* @param fallingEdge true to trigger on falling
* @param[in] handle the dma handle
* @param[in] digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a
* HAL_DigitalHandle)
* @param[in] analogTriggerType the analog trigger type if the source is an
* analog trigger
* @param[in] rising true to trigger on rising edge
* @param[in] falling true to trigger on falling edge
* @param[out] status Error status variable. 0 on success.
* @return the index of the trigger
*/
int32_t HAL_SetDMAExternalTrigger(HAL_DMAHandle handle,
@@ -225,7 +240,8 @@ int32_t HAL_SetDMAExternalTrigger(HAL_DMAHandle handle,
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param[in] handle the dma handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ClearDMASensors(HAL_DMAHandle handle, int32_t* status);
@@ -234,22 +250,25 @@ void HAL_ClearDMASensors(HAL_DMAHandle handle, int32_t* status);
*
* This can only be called if DMA is not started.
*
* @param handle the dma handle
* @param[in] handle the dma handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ClearDMAExternalTriggers(HAL_DMAHandle handle, int32_t* status);
/**
* Starts DMA Collection.
*
* @param handle the dma handle
* @param queueDepth the number of objects to be able to queue
* @param[in] handle the dma handle
* @param[in] queueDepth the number of objects to be able to queue
* @param[out] status Error status variable. 0 on success.
*/
void HAL_StartDMA(HAL_DMAHandle handle, int32_t queueDepth, int32_t* status);
/**
* Stops DMA Collection.
*
* @param handle the dma handle
* @param[in] handle the dma handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_StopDMA(HAL_DMAHandle handle, int32_t* status);
@@ -268,7 +287,12 @@ void* HAL_GetDMADirectPointer(HAL_DMAHandle handle);
*
* See HAL_ReadDMA for full documentation.
*
* @param handle the dma handle
* @param[in] dmaPointer direct DMA pointer
* @param[in] dmaSample the sample object to place data into
* @param[in] timeoutSeconds the time to wait for data to be queued before
* timing out
* @param[in] remainingOut the number of samples remaining in the queue
* @param[out] status Error status variable. 0 on success.
*/
enum HAL_DMAReadStatus HAL_ReadDMADirect(void* dmaPointer,
HAL_DMASample* dmaSample,
@@ -280,11 +304,12 @@ enum HAL_DMAReadStatus HAL_ReadDMADirect(void* dmaPointer,
* Reads a DMA sample from the queue.
*
*
* @param handle the dma handle
* @param dmaSample the sample object to place data into
* @param timeoutSeconds the time to wait for data to be queued before timing
* out
* @param remainingOut the number of samples remaining in the queue
* @param[in] handle the dma handle
* @param[in] dmaSample the sample object to place data into
* @param[in] timeoutSeconds the time to wait for data to be queued before
* timing out
* @param[in] remainingOut the number of samples remaining in the queue
* @param[out] status Error status variable. 0 on success.
* @return the succes result of the sample read
*/
enum HAL_DMAReadStatus HAL_ReadDMA(HAL_DMAHandle handle,
@@ -298,7 +323,8 @@ enum HAL_DMAReadStatus HAL_ReadDMA(HAL_DMAHandle handle,
* Returns the timestamp of the sample.
* This is in the same time domain as HAL_GetFPGATime().
*
* @param dmaSample the sample to read from
* @param[in] dmaSample the sample to read from
* @param[out] status Error status variable. 0 on success.
* @return timestamp in microseconds since FPGA Initialization
*/
uint64_t HAL_GetDMASampleTime(const HAL_DMASample* dmaSample, int32_t* status);
@@ -309,8 +335,9 @@ uint64_t HAL_GetDMASampleTime(const HAL_DMASample* dmaSample, int32_t* status);
* This can be scaled with DistancePerPulse and DecodingScaleFactor to match the
* result of GetDistance()
*
* @param dmaSample the sample to read from
* @param encoderHandle the encoder handle
* @param[in] dmaSample the sample to read from
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return raw encoder ticks
*/
int32_t HAL_GetDMASampleEncoderRaw(const HAL_DMASample* dmaSample,
@@ -320,8 +347,9 @@ int32_t HAL_GetDMASampleEncoderRaw(const HAL_DMASample* dmaSample,
/**
* Returns the distance data for an counter from the sample.
*
* @param dmaSample the sample to read from
* @param counterHandle the counter handle
* @param[in] dmaSample the sample to read from
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return counter ticks
*/
int32_t HAL_GetDMASampleCounter(const HAL_DMASample* dmaSample,
@@ -334,8 +362,9 @@ int32_t HAL_GetDMASampleCounter(const HAL_DMASample* dmaSample,
* This can be scaled with DistancePerPulse and DecodingScaleFactor to match the
* result of GetRate()
*
* @param dmaSample the sample to read from
* @param encoderHandle the encoder handle
* @param[in] dmaSample the sample to read from
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return raw encoder period
*/
int32_t HAL_GetDMASampleEncoderPeriodRaw(const HAL_DMASample* dmaSample,
@@ -345,8 +374,9 @@ int32_t HAL_GetDMASampleEncoderPeriodRaw(const HAL_DMASample* dmaSample,
/**
* Returns the period data for an counter from the sample.
*
* @param dmaSample the sample to read from
* @param counterHandle the counter handle
* @param[in] dmaSample the sample to read from
* @param[in] counterHandle the counter handle
* @param[out] status Error status variable. 0 on success.
* @return counter period
*/
int32_t HAL_GetDMASampleCounterPeriod(const HAL_DMASample* dmaSample,
@@ -356,8 +386,9 @@ int32_t HAL_GetDMASampleCounterPeriod(const HAL_DMASample* dmaSample,
/**
* Returns the state of a digital source from the sample.
*
* @param dmaSample the sample to read from
* @param dSourceHandle the digital source handle
* @param[in] dmaSample the sample to read from
* @param[in] dSourceHandle the digital source handle
* @param[out] status Error status variable. 0 on success.
* @return digital source state
*/
HAL_Bool HAL_GetDMASampleDigitalSource(const HAL_DMASample* dmaSample,
@@ -369,8 +400,9 @@ HAL_Bool HAL_GetDMASampleDigitalSource(const HAL_DMASample* dmaSample,
*
* This can be scaled with HAL_GetAnalogValueToVolts to match GetVoltage().
*
* @param dmaSample the sample to read from
* @param aInHandle the analog input handle
* @param[in] dmaSample the sample to read from
* @param[in] aInHandle the analog input handle
* @param[out] status Error status variable. 0 on success.
* @return raw analog data
*/
int32_t HAL_GetDMASampleAnalogInputRaw(const HAL_DMASample* dmaSample,
@@ -383,8 +415,9 @@ int32_t HAL_GetDMASampleAnalogInputRaw(const HAL_DMASample* dmaSample,
* This can be scaled with HAL_GetAnalogValueToVolts to match
* GetAveragedVoltage().
*
* @param dmaSample the sample to read from
* @param aInHandle the analog input handle
* @param[in] dmaSample the sample to read from
* @param[in] aInHandle the analog input handle
* @param[out] status Error status variable. 0 on success.
* @return raw averaged analog data
*/
int32_t HAL_GetDMASampleAveragedAnalogInputRaw(const HAL_DMASample* dmaSample,
@@ -394,10 +427,11 @@ int32_t HAL_GetDMASampleAveragedAnalogInputRaw(const HAL_DMASample* dmaSample,
/**
* Returns the analog accumulator data for an analog input from the sample.
*
* @param dmaSample the sample to read from
* @param aInHandle the analog input handle
* @param count the accumulator count
* @param value the accumulator value
* @param[in] dmaSample the sample to read from
* @param[in] aInHandle the analog input handle
* @param[in] count the accumulator count
* @param[in] value the accumulator value
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetDMASampleAnalogAccumulator(const HAL_DMASample* dmaSample,
HAL_AnalogInputHandle aInHandle,
@@ -409,8 +443,9 @@ void HAL_GetDMASampleAnalogAccumulator(const HAL_DMASample* dmaSample,
*
* Use HAL_GetDutyCycleOutputScaleFactor to scale this to a percentage.
*
* @param dmaSample the sample to read from
* @param dutyCycleHandle the duty cycle handle
* @param[in] dmaSample the sample to read from
* @param[in] dutyCycleHandle the duty cycle handle
* @param[out] status Error status variable. 0 on success.
* @return raw duty cycle input data
*/
int32_t HAL_GetDMASampleDutyCycleOutputRaw(const HAL_DMASample* dmaSample,

View File

@@ -27,7 +27,7 @@ extern "C" {
* @param isLVCode true for a LV error code, false for a standard error code
* @param details the details of the error
* @param location the file location of the errror
* @param callstack the callstack of the error
* @param callStack the callstack of the error
* @param printMsg true to print the error message to stdout as well as to the
* DS
*/
@@ -47,15 +47,15 @@ int32_t HAL_SendConsoleLine(const char* line);
* The control work contains the robot state.
*
* @param controlWord the control word (out)
* @return the error code, or 0 for success
* @return the error code, or 0 for success
*/
int32_t HAL_GetControlWord(HAL_ControlWord* controlWord);
/**
* Gets the current alliance station ID.
*
* @param status the error code, or 0 for success
* @return the alliance station ID
* @param[out] status the error code, or 0 for success
* @return the alliance station ID
*/
HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status);
@@ -64,7 +64,7 @@ HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status);
*
* @param joystickNum the joystick number
* @param axes the axes values (output)
* @return the error code, or 0 for success
* @return the error code, or 0 for success
*/
int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes);
@@ -73,7 +73,7 @@ int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes);
*
* @param joystickNum the joystick number
* @param povs the POV values (output)
* @return the error code, or 0 for success
* @return the error code, or 0 for success
*/
int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs* povs);
@@ -82,7 +82,7 @@ int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs* povs);
*
* @param joystickNum the joystick number
* @param buttons the button values (output)
* @return the error code, or 0 for success
* @return the error code, or 0 for success
*/
int32_t HAL_GetJoystickButtons(int32_t joystickNum,
HAL_JoystickButtons* buttons);
@@ -90,14 +90,15 @@ int32_t HAL_GetJoystickButtons(int32_t joystickNum,
/**
* Retrieves the Joystick Descriptor for particular slot.
*
* @param desc [out] descriptor (data transfer object) to fill in. desc is
* filled in regardless of success. In other words, if descriptor is not
* available, desc is filled in with default values matching the init-values in
* Java and C++ Driverstation for when caller requests a too-large joystick
* index.
*
* @param joystickNum the joystick number
* @param[out] desc descriptor (data transfer object) to fill in. desc is
* filled in regardless of success. In other words, if
* descriptor is not available, desc is filled in with
* default values matching the init-values in Java and C++
* Driver Station for when caller requests a too-large
* joystick index.
* @return error code reported from Network Comm back-end. Zero is good,
* nonzero is bad.
* nonzero is bad.
*/
int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
HAL_JoystickDescriptor* desc);
@@ -106,7 +107,7 @@ int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
* Gets is a specific joystick is considered to be an XBox controller.
*
* @param joystickNum the joystick number
* @return true if xbox, false otherwise
* @return true if xbox, false otherwise
*/
HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum);
@@ -117,7 +118,7 @@ HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum);
* the joystick uses.
*
* @param joystickNum the joystick number
* @return the enumerated joystick type
* @return the enumerated joystick type
*/
int32_t HAL_GetJoystickType(int32_t joystickNum);
@@ -129,7 +130,7 @@ int32_t HAL_GetJoystickType(int32_t joystickNum);
* Will be null terminated.
*
* @param joystickNum the joystick number
* @return the joystick name
* @return the joystick name
*/
char* HAL_GetJoystickName(int32_t joystickNum);
@@ -148,7 +149,7 @@ void HAL_FreeJoystickName(char* name);
*
* @param joystickNum the joystick number
* @param axis the axis number
* @return the enumerated axis type
* @return the enumerated axis type
*/
int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis);
@@ -159,7 +160,7 @@ int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis);
* @param outputs bitmask of outputs, 1 for on 0 for off
* @param leftRumble the left rumble value (0-FFFF)
* @param rightRumble the right rumble value (0-FFFF)
* @return the error code, or 0 for success
* @return the error code, or 0 for success
*/
int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
int32_t leftRumble, int32_t rightRumble);
@@ -177,7 +178,7 @@ int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
* The Practice Match function of the DS approximates the behavior seen on
* the field.
*
* @param status the error code, or 0 for success
* @param[out] status the error code, or 0 for success
* @return time remaining in current match period (auto or teleop)
*/
double HAL_GetMatchTime(int32_t* status);
@@ -185,8 +186,8 @@ double HAL_GetMatchTime(int32_t* status);
/**
* Gets info about a specific match.
*
* @param info the match info (output)
* @return the error code, or 0 for success
* @param[in] info the match info (output)
* @return the error code, or 0 for success
*/
int32_t HAL_GetMatchInfo(HAL_MatchInfo* info);
@@ -217,8 +218,8 @@ void HAL_WaitForDSData(void);
* forever. Otherwise, it will wait until either a new packet, or the timeout
* time has passed.
*
* @param timeout timeout in seconds
* @return true for new data, false for timeout
* @param[in] timeout timeout in seconds
* @return true for new data, false for timeout
*/
HAL_Bool HAL_WaitForDSDataTimeout(double timeout);

View File

@@ -20,10 +20,12 @@ extern "C" {
/**
* Initialize a DutyCycle input.
*
* @param digitalSourceHandle the digital source to use (either a
* HAL_DigitalHandle or a HAL_AnalogTriggerHandle)
* @param triggerType the analog trigger type of the source if it is
* an analog trigger
* @param[in] digitalSourceHandle the digital source to use (either a
* HAL_DigitalHandle or a
* HAL_AnalogTriggerHandle)
* @param[in] triggerType the analog trigger type of the source if it is
* an analog trigger
* @param[out] status Error status variable. 0 on success.
* @return thre created duty cycle handle
*/
HAL_DutyCycleHandle HAL_InitializeDutyCycle(HAL_Handle digitalSourceHandle,
@@ -49,7 +51,8 @@ void HAL_SetDutyCycleSimDevice(HAL_DutyCycleHandle handle,
/**
* Get the frequency of the duty cycle signal.
*
* @param dutyCycleHandle the duty cycle handle
* @param[in] dutyCycleHandle the duty cycle handle
* @param[out] status Error status variable. 0 on success.
* @return frequency in Hertz
*/
int32_t HAL_GetDutyCycleFrequency(HAL_DutyCycleHandle dutyCycleHandle,
@@ -60,7 +63,8 @@ int32_t HAL_GetDutyCycleFrequency(HAL_DutyCycleHandle dutyCycleHandle,
*
* <p> 0 means always low, 1 means always high.
*
* @param dutyCycleHandle the duty cycle handle
* @param[in] dutyCycleHandle the duty cycle handle
* @param[out] status Error status variable. 0 on success.
* @return output ratio between 0 and 1
*/
double HAL_GetDutyCycleOutput(HAL_DutyCycleHandle dutyCycleHandle,
@@ -72,7 +76,8 @@ double HAL_GetDutyCycleOutput(HAL_DutyCycleHandle dutyCycleHandle,
* <p> 0 means always low, an output equal to
* GetOutputScaleFactor() means always high.
*
* @param dutyCycleHandle the duty cycle handle
* @param[in] dutyCycleHandle the duty cycle handle
* @param[out] status Error status variable. 0 on success.
* @return output ratio in raw units
*/
int32_t HAL_GetDutyCycleOutputRaw(HAL_DutyCycleHandle dutyCycleHandle,
@@ -85,7 +90,8 @@ int32_t HAL_GetDutyCycleOutputRaw(HAL_DutyCycleHandle dutyCycleHandle,
* down to 0. Divide the result of getOutputRaw by this in order to get the
* percentage between 0 and 1.
*
* @param dutyCycleHandle the duty cycle handle
* @param[in] dutyCycleHandle the duty cycle handle
* @param[out] status Error status variable. 0 on success.
* @return the output scale factor
*/
int32_t HAL_GetDutyCycleOutputScaleFactor(HAL_DutyCycleHandle dutyCycleHandle,
@@ -94,7 +100,8 @@ int32_t HAL_GetDutyCycleOutputScaleFactor(HAL_DutyCycleHandle dutyCycleHandle,
/**
* Get the FPGA index for the DutyCycle.
*
* @param dutyCycleHandle the duty cycle handle
* @param[in] dutyCycleHandle the duty cycle handle
* @param[out] status Error status variable. 0 on success.
* @return the FPGA index
*/
int32_t HAL_GetDutyCycleFPGAIndex(HAL_DutyCycleHandle dutyCycleHandle,

View File

@@ -43,18 +43,19 @@ extern "C" {
/**
* Initializes an encoder.
*
* @param digitalSourceHandleA the A source (either a HAL_DigitalHandle or a
* HAL_AnalogTriggerHandle)
* @param analogTriggerTypeA the analog trigger type of the A source if it is
* an analog trigger
* @param digitalSourceHandleB the B source (either a HAL_DigitalHandle or a
* HAL_AnalogTriggerHandle)
* @param analogTriggerTypeB the analog trigger type of the B source if it is
* an analog trigger
* @param reverseDirection true to reverse the counting direction from
* standard, otherwise false
* @param encodingType the encoding type
@return the created encoder handle
* @param[in] digitalSourceHandleA the A source (either a HAL_DigitalHandle or a
* HAL_AnalogTriggerHandle)
* @param[in] analogTriggerTypeA the analog trigger type of the A source if it
* is an analog trigger
* @param[in] digitalSourceHandleB the B source (either a HAL_DigitalHandle or a
* HAL_AnalogTriggerHandle)
* @param[in] analogTriggerTypeB the analog trigger type of the B source if it
* is an analog trigger
* @param[in] reverseDirection true to reverse the counting direction from
* standard, otherwise false
* @param[in] encodingType the encoding type
* @param[out] status Error status variable. 0 on success.
* @return the created encoder handle
*/
HAL_EncoderHandle HAL_InitializeEncoder(
HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA,
@@ -65,7 +66,8 @@ HAL_EncoderHandle HAL_InitializeEncoder(
/**
* Frees an encoder.
*
* @param encoderHandle the encoder handle
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_FreeEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -83,7 +85,8 @@ void HAL_SetEncoderSimDevice(HAL_EncoderHandle handle,
*
* This is scaled by the value passed duing initialization to encodingType.
*
* @param encoderHandle the encoder handle
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the current scaled count
*/
int32_t HAL_GetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -93,8 +96,9 @@ int32_t HAL_GetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
*
* This is not scaled by any values.
*
* @param encoderHandle the encoder handle
* @return the raw encoder count
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the raw encoder count
*/
int32_t HAL_GetEncoderRaw(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -103,8 +107,9 @@ int32_t HAL_GetEncoderRaw(HAL_EncoderHandle encoderHandle, int32_t* status);
*
* This is set by the value passed during initialization to encodingType.
*
* @param encoderHandle the encoder handle
* @return the encoder scale value
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the encoder scale value
*/
int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -115,8 +120,8 @@ int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoderHandle,
* Read the value at this instant. It may still be running, so it reflects the
* current value. Next time it is read, it might have a different value.
*
* @param encoderHandle the encoder handle
* @return the current encoder value
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ResetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -126,8 +131,9 @@ void HAL_ResetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
* Returns the time interval of the most recent count. This can be used for
* velocity calculations to determine shaft speed.
*
* @param encoderHandle the encoder handle
* @returns the period of the last two pulses in units of seconds
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @returns the period of the last two pulses in units of seconds
*/
double HAL_GetEncoderPeriod(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -138,9 +144,10 @@ double HAL_GetEncoderPeriod(HAL_EncoderHandle encoderHandle, int32_t* status);
* used to determine the "stopped" state of the encoder using the
* HAL_GetEncoderStopped method.
*
* @param encoderHandle the encoder handle
* @param maxPeriod the maximum period where the counted device is
* considered moving in seconds
* @param[in] encoderHandle the encoder handle
* @param[in] maxPeriod the maximum period where the counted device is
* considered moving in seconds
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetEncoderMaxPeriod(HAL_EncoderHandle encoderHandle, double maxPeriod,
int32_t* status);
@@ -152,9 +159,10 @@ void HAL_SetEncoderMaxPeriod(HAL_EncoderHandle encoderHandle, double maxPeriod,
* using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
* device (and encoder) are assumed to be stopped and it returns true.
*
* @param encoderHandle the encoder handle
* @return true if the most recent encoder period exceeds the
* MaxPeriod value set by SetMaxPeriod
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return true if the most recent encoder period exceeds the MaxPeriod value
* set by SetMaxPeriod
*/
HAL_Bool HAL_GetEncoderStopped(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -162,8 +170,9 @@ HAL_Bool HAL_GetEncoderStopped(HAL_EncoderHandle encoderHandle,
/**
* Gets the last direction the encoder value changed.
*
* @param encoderHandle the encoder handle
* @return the last direction the encoder value changed
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the last direction the encoder value changed
*/
HAL_Bool HAL_GetEncoderDirection(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -174,9 +183,10 @@ HAL_Bool HAL_GetEncoderDirection(HAL_EncoderHandle encoderHandle,
* This is the encoder count scaled by the distance per pulse set for the
* encoder.
*
* @param encoderHandle the encoder handle
* @return the encoder distance (units are determined by the units
* passed to HAL_SetEncoderDistancePerPulse)
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the encoder distance (units are determined by the units
* passed to HAL_SetEncoderDistancePerPulse)
*/
double HAL_GetEncoderDistance(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -186,9 +196,10 @@ double HAL_GetEncoderDistance(HAL_EncoderHandle encoderHandle, int32_t* status);
* This is the encoder period scaled by the distance per pulse set for the
* encoder.
*
* @param encoderHandle the encoder handle
* @return the encoder rate (units are determined by the units
* passed to HAL_SetEncoderDistancePerPulse, time value is seconds)
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the encoder rate (units are determined by the units passed to
* HAL_SetEncoderDistancePerPulse, time value is seconds)
*/
double HAL_GetEncoderRate(HAL_EncoderHandle encoderHandle, int32_t* status);
@@ -198,10 +209,12 @@ double HAL_GetEncoderRate(HAL_EncoderHandle encoderHandle, int32_t* status);
* Units need to match what is set by HAL_SetEncoderDistancePerPulse, with time
* as seconds.
*
* @param encoderHandle the encoder handle
* @param minRate the minimum rate to be considered moving (units are
* determined by the units passed to HAL_SetEncoderDistancePerPulse, time value
* is seconds)
* @param[in] encoderHandle the encoder handle
* @param[in] minRate the minimum rate to be considered moving (units are
* determined by the units passed to
* HAL_SetEncoderDistancePerPulse, time value is
* seconds)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetEncoderMinRate(HAL_EncoderHandle encoderHandle, double minRate,
int32_t* status);
@@ -210,9 +223,10 @@ void HAL_SetEncoderMinRate(HAL_EncoderHandle encoderHandle, double minRate,
* Sets the distance traveled per encoder pulse. This is used as a scaling
* factor for the rate and distance calls.
*
* @param encoderHandle the encoder handle
* @param distancePerPulse the distance traveled per encoder pulse (units user
* defined)
* @param[in] encoderHandle the encoder handle
* @param[in] distancePerPulse the distance traveled per encoder pulse (units
* user defined)
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
double distancePerPulse, int32_t* status);
@@ -222,8 +236,9 @@ void HAL_SetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
*
* Note that this is not a toggle. It is an absolute set.
*
* @param encoderHandle the encoder handle
* @param reverseDirection true to reverse the direction, false to not.
* @param[in] encoderHandle the encoder handle
* @param[in] reverseDirection true to reverse the direction, false to not.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetEncoderReverseDirection(HAL_EncoderHandle encoderHandle,
HAL_Bool reverseDirection, int32_t* status);
@@ -231,8 +246,9 @@ void HAL_SetEncoderReverseDirection(HAL_EncoderHandle encoderHandle,
/**
* Sets the number of encoder samples to average when calculating encoder rate.
*
* @param encoderHandle the encoder handle
* @param samplesToAverage the number of samples to average
* @param[in] encoderHandle the encoder handle
* @param[in] samplesToAverage the number of samples to average
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
int32_t samplesToAverage, int32_t* status);
@@ -240,8 +256,9 @@ void HAL_SetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
/**
* Gets the current samples to average value.
*
* @param encoderHandle the encoder handle
* @return the current samples to average value
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the current samples to average value
*/
int32_t HAL_GetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -252,12 +269,14 @@ int32_t HAL_GetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
* The index pulse can be used to cause an encoder to reset based on an external
* input.
*
* @param encoderHandle the encoder handle
* @param digitalSourceHandle the index source handle (either a
* HAL_AnalogTriggerHandle or a HAL_DigitalHandle)
* @param analogTriggerType the analog trigger type if the source is an analog
* trigger
* @param type the index triggering type
* @param[in] encoderHandle the encoder handle
* @param[in] digitalSourceHandle the index source handle (either a
* HAL_AnalogTriggerHandle or a
* HAL_DigitalHandle)
* @param[in] analogTriggerType the analog trigger type if the source is an
* analog trigger
* @param[in] type the index triggering type
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetEncoderIndexSource(HAL_EncoderHandle encoderHandle,
HAL_Handle digitalSourceHandle,
@@ -267,8 +286,9 @@ void HAL_SetEncoderIndexSource(HAL_EncoderHandle encoderHandle,
/**
* Gets the FPGA index of the encoder.
*
* @param encoderHandle the encoder handle
* @return the FPGA index of the encoder
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the FPGA index of the encoder
*/
int32_t HAL_GetEncoderFPGAIndex(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -278,8 +298,9 @@ int32_t HAL_GetEncoderFPGAIndex(HAL_EncoderHandle encoderHandle,
*
* This is used to perform the scaling from raw to type scaled values.
*
* @param encoderHandle the encoder handle
* @return the scale value for the encoder
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the scale value for the encoder
*/
double HAL_GetEncoderDecodingScaleFactor(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -287,8 +308,9 @@ double HAL_GetEncoderDecodingScaleFactor(HAL_EncoderHandle encoderHandle,
/**
* Gets the user set distance per pulse of the encoder.
*
* @param encoderHandle the encoder handle
* @return the set distance per pulse
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the set distance per pulse
*/
double HAL_GetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
int32_t* status);
@@ -296,8 +318,9 @@ double HAL_GetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
/**
* Gets the encoding type of the encoder.
*
* @param encoderHandle the encoder handle
* @return the encoding type
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
* @return the encoding type
*/
HAL_EncoderEncodingType HAL_GetEncoderEncodingType(
HAL_EncoderHandle encoderHandle, int32_t* status);

View File

@@ -32,7 +32,7 @@ extern "C" {
* Expected to be called internally, not by users.
*
* @param library the library path
* @return the succes state of the initialization
* @return the succes state of the initialization
*/
int HAL_LoadOneExtension(const char* library);
@@ -40,7 +40,7 @@ int HAL_LoadOneExtension(const char* library);
* Loads any extra halsim libraries provided in the HALSIM_EXTENSIONS
* environment variable.
*
* @return the succes state of the initialization
* @return the succes state of the initialization
*/
int HAL_LoadExtensions(void);

View File

@@ -28,10 +28,10 @@ extern "C" {
* If passed HAL_USE_LAST_ERROR, the last error set on the thread will be
* returned.
*
* @param code the status code, set to the error status code if input is
* HAL_USE_LAST_ERROR
* @return the error message for the code. This does not need to be freed,
* but can be overwritten by another hal call on the same thread.
* @param[out] status the status code, set to the error status code if input is
* HAL_USE_LAST_ERROR
* @return the error message for the code. This does not need to be freed,
* but can be overwritten by another hal call on the same thread.
*/
const char* HAL_GetLastError(int32_t* status);
@@ -39,7 +39,7 @@ const char* HAL_GetLastError(int32_t* status);
* Gets the error message for a specific status code.
*
* @param code the status code
* @return the error message for the code. This does not need to be freed.
* @return the error message for the code. This does not need to be freed.
*/
const char* HAL_GetErrorMessage(int32_t code);
@@ -48,6 +48,7 @@ const char* HAL_GetErrorMessage(int32_t code);
*
* For now, expect this to be competition year.
*
* @param[out] status the error code, or 0 for success
* @return FPGA Version number.
*/
int32_t HAL_GetFPGAVersion(int32_t* status);
@@ -60,6 +61,7 @@ int32_t HAL_GetFPGAVersion(int32_t* status);
* the next 8 bits are the Minor Revision.
* The 12 least significant bits are the Build Number.
*
* @param[out] status the error code, or 0 for success
* @return FPGA Revision number.
*/
int64_t HAL_GetFPGARevision(int32_t* status);
@@ -74,6 +76,7 @@ HAL_RuntimeType HAL_GetRuntimeType(void);
/**
* Gets the state of the "USER" button on the roboRIO.
*
* @param[out] status the error code, or 0 for success
* @return true if the button is currently pressed down
*/
HAL_Bool HAL_GetFPGAButton(int32_t* status);
@@ -81,6 +84,7 @@ HAL_Bool HAL_GetFPGAButton(int32_t* status);
/**
* Gets if the system outputs are currently active
*
* @param[out] status the error code, or 0 for success
* @return true if the system outputs are active, false if disabled
*/
HAL_Bool HAL_GetSystemActive(int32_t* status);
@@ -88,6 +92,7 @@ HAL_Bool HAL_GetSystemActive(int32_t* status);
/**
* Gets if the system is in a browned out state.
*
* @param[out] status the error code, or 0 for success
* @return true if the system is in a low voltage brown out, false otherwise
*/
HAL_Bool HAL_GetBrownedOut(int32_t* status);
@@ -98,7 +103,7 @@ HAL_Bool HAL_GetBrownedOut(int32_t* status);
* The created handle does not need to be freed.
*
* @param channel the channel number
* @return the created port
* @return the created port
*/
HAL_PortHandle HAL_GetPort(int32_t channel);
@@ -112,13 +117,14 @@ HAL_PortHandle HAL_GetPort(int32_t channel);
*
* @param module the module number
* @param channel the channel number
* @return the created port
* @return the created port
*/
HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
/**
* Reads the microsecond-resolution timer on the FPGA.
*
* @param[out] status the error code, or 0 for success
* @return The current time in microseconds according to the FPGA (since FPGA
* reset).
*/
@@ -133,10 +139,12 @@ uint64_t HAL_GetFPGATime(int32_t* status);
* bottom 32 bits of the timestamp and expanding it, you will be off by
* multiples of 1<<32 microseconds.
*
* @param[in] unexpandedLower 32 bit FPGA time
* @param[out] status the error code, or 0 for success
* @return The current time in microseconds according to the FPGA (since FPGA
* reset) as a 64 bit number.
* reset) as a 64 bit number.
*/
uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status);
uint64_t HAL_ExpandFPGATime(uint32_t unexpandedLower, int32_t* status);
/**
* Call this to start up HAL. This is required for robot programs.
@@ -160,7 +168,7 @@ uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status);
*
* @param timeout the initialization timeout (ms)
* @param mode the initialization mode (see remarks)
* @return true if initialization was successful, otherwise false.
* @return true if initialization was successful, otherwise false.
*/
HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode);

View File

@@ -24,7 +24,8 @@ extern "C" {
* Opens the port if necessary and saves the handle.
* If opening the MXP port, also sets up the channel functions appropriately.
*
* @param port The port to open, 0 for the on-board, 1 for the MXP.
* @param[in] port The port to open, 0 for the on-board, 1 for the MXP.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_InitializeI2C(HAL_I2CPort port, int32_t* status);
@@ -35,6 +36,8 @@ void HAL_InitializeI2C(HAL_I2CPort port, int32_t* status);
* over each transaction.
*
* @param port The I2C port, 0 for the on-board, 1 for the MXP.
* @param deviceAddress The address of the register on the device to be
* read/written.
* @param dataToSend Buffer of data to send as part of the transaction.
* @param sendSize Number of bytes to send as part of the transaction.
* @param dataReceived Buffer to read data into.
@@ -52,9 +55,10 @@ int32_t HAL_TransactionI2C(HAL_I2CPort port, int32_t deviceAddress,
* transaction is complete.
*
* @param port The I2C port, 0 for the on-board, 1 for the MXP.
* @param registerAddress The address of the register on the device to be
* written.
* @param data The byte to write to the register on the device.
* @param deviceAddress The address of the register on the device to be
* written.
* @param dataToSend The byte to write to the register on the device.
* @param sendSize Number of bytes to send.
* @return >= 0 on success or -1 on transfer abort.
*/
int32_t HAL_WriteI2C(HAL_I2CPort port, int32_t deviceAddress,
@@ -68,7 +72,7 @@ int32_t HAL_WriteI2C(HAL_I2CPort port, int32_t deviceAddress,
* you to read consecutive registers on a device in a single transaction.
*
* @param port The I2C port, 0 for the on-board, 1 for the MXP.
* @param registerAddress The register to read first in the transaction.
* @param deviceAddress The register to read first in the transaction.
* @param count The number of bytes to read in the transaction.
* @param buffer A pointer to the array of bytes to store the data read from the
* device.

View File

@@ -22,8 +22,8 @@ extern "C" {
/**
* Initializes an interrupt.
*
* @param watcher true for synchronous interrupts, false for asynchronous
* @return the created interrupt handle
* @param[out] status Error status variable. 0 on success.
* @return the created interrupt handle
*/
HAL_InterruptHandle HAL_InitializeInterrupts(int32_t* status);
@@ -37,11 +37,12 @@ void HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle);
/**
* In synchronous mode, waits for the defined interrupt to occur.
*
* @param interruptHandle the interrupt handle
* @param timeout timeout in seconds
* @param ignorePrevious if true, ignore interrupts that happened before
* waitForInterrupt was called
* @return the mask of interrupts that fired
* @param[in] interruptHandle the interrupt handle
* @param[in] timeout timeout in seconds
* @param[in] ignorePrevious if true, ignore interrupts that happened before
* waitForInterrupt was called
* @param[out] status Error status variable. 0 on success.
* @return the mask of interrupts that fired
*/
int64_t HAL_WaitForInterrupt(HAL_InterruptHandle interruptHandle,
double timeout, HAL_Bool ignorePrevious,
@@ -54,8 +55,9 @@ int64_t HAL_WaitForInterrupt(HAL_InterruptHandle interruptHandle,
* bottom 32 bits of the timestamp. If your robot has been running for over 1
* hour, you will need to fill in the upper 32 bits yourself.
*
* @param interruptHandle the interrupt handle
* @return timestamp in microseconds since FPGA Initialization
* @param[in] interruptHandle the interrupt handle
* @param[out] status Error status variable. 0 on success.
* @return timestamp in microseconds since FPGA Initialization
*/
int64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
int32_t* status);
@@ -67,8 +69,9 @@ int64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
* bottom 32 bits of the timestamp. If your robot has been running for over 1
* hour, you will need to fill in the upper 32 bits yourself.
*
* @param interruptHandle the interrupt handle
* @return timestamp in microseconds since FPGA Initialization
* @param[in] interruptHandle the interrupt handle
* @param[out] status Error status variable. 0 on success.
* @return timestamp in microseconds since FPGA Initialization
*/
int64_t HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
int32_t* status);
@@ -76,10 +79,13 @@ int64_t HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
/**
* Requests interrupts on a specific digital source.
*
* @param interruptHandle the interrupt handle
* @param digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a HAL_DigitalHandle)
* @param analogTriggerType the trigger type if the source is an AnalogTrigger
* @param[in] interruptHandle the interrupt handle
* @param[in] digitalSourceHandle the digital source handle (either a
* HAL_AnalogTriggerHandle or a
* HAL_DigitalHandle)
* @param[in] analogTriggerType the trigger type if the source is an
* AnalogTrigger
* @param[out] status Error status variable. 0 on success.
*/
void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
HAL_Handle digitalSourceHandle,
@@ -91,9 +97,10 @@ void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
*
* Note that both edges triggered is a valid configuration.
*
* @param interruptHandle the interrupt handle
* @param risingEdge true for triggering on rising edge
* @param fallingEdge true for triggering on falling edge
* @param[in] interruptHandle the interrupt handle
* @param[in] risingEdge true for triggering on rising edge
* @param[in] fallingEdge true for triggering on falling edge
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
HAL_Bool risingEdge, HAL_Bool fallingEdge,
@@ -104,7 +111,8 @@ void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
*
* This will release both rising and falling waiters.
*
* @param interruptHandle the interrupt handle to release
* @param[in] interruptHandle the interrupt handle to release
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ReleaseWaitingInterrupt(HAL_InterruptHandle interruptHandle,
int32_t* status);

View File

@@ -26,6 +26,7 @@ extern "C" {
* A notifier is an FPGA controller timer that triggers at requested intervals
* based on the FPGA time. This can be used to make precise control loops.
*
* @param[out] status Error status variable. 0 on success.
* @return the created notifier
*/
HAL_NotifierHandle HAL_InitializeNotifier(int32_t* status);
@@ -38,13 +39,13 @@ HAL_NotifierHandle HAL_InitializeNotifier(int32_t* status);
* Giving the HAL notifier thread real-time priority helps ensure the user's
* real-time Notifiers, if any, are notified to run in a timely manner.
*
* @param realTime Set to true to set a real-time priority, false for standard
* priority.
* @param priority Priority to set the thread to. For real-time, this is 1-99
* with 99 being highest. For non-real-time, this is forced to
* 0. See "man 7 sched" for more details.
* @param status Error status variable. 0 on success.
* @return True on success.
* @param[in] realTime Set to true to set a real-time priority, false for
* standard priority.
* @param[in] priority Priority to set the thread to. For real-time, this is
* 1-99 with 99 being highest. For non-real-time, this is
* forced to 0. See "man 7 sched" for more details.
* @param[out] status Error status variable. 0 on success.
* @return True on success.
*/
HAL_Bool HAL_SetNotifierThreadPriority(HAL_Bool realTime, int32_t priority,
int32_t* status);
@@ -52,8 +53,9 @@ HAL_Bool HAL_SetNotifierThreadPriority(HAL_Bool realTime, int32_t priority,
/**
* Sets the name of a notifier.
*
* @param notifierHandle the notifier handle
* @param name name
* @param[in] notifierHandle the notifier handle
* @param[in] name name
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetNotifierName(HAL_NotifierHandle notifierHandle, const char* name,
int32_t* status);
@@ -63,7 +65,8 @@ void HAL_SetNotifierName(HAL_NotifierHandle notifierHandle, const char* name,
*
* This will cause any call into HAL_WaitForNotifierAlarm to return.
*
* @param notifierHandle the notifier handle
* @param[in] notifierHandle the notifier handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_StopNotifier(HAL_NotifierHandle notifierHandle, int32_t* status);
@@ -72,7 +75,8 @@ void HAL_StopNotifier(HAL_NotifierHandle notifierHandle, int32_t* status);
*
* Note this also stops a notifier if it is already running.
*
* @param notifierHandle the notifier handle
* @param[in] notifierHandle the notifier handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status);
@@ -81,8 +85,9 @@ void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status);
*
* Note that this time is an absolute time relative to HAL_GetFPGATime()
*
* @param notifierHandle the notifier handle
* @param triggerTime the updated trigger time
* @param[in] notifierHandle the notifier handle
* @param[in] triggerTime the updated trigger time
* @param[out] status Error status variable. 0 on success.
*/
void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
uint64_t triggerTime, int32_t* status);
@@ -92,7 +97,8 @@ void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
*
* This does not cause HAL_WaitForNotifierAlarm to return.
*
* @param notifierHandle the notifier handle
* @param[in] notifierHandle the notifier handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_CancelNotifierAlarm(HAL_NotifierHandle notifierHandle,
int32_t* status);
@@ -105,8 +111,9 @@ void HAL_CancelNotifierAlarm(HAL_NotifierHandle notifierHandle,
* loops using this function should exit. Failing to do so can lead to
* use-after-frees.
*
* @param notifierHandle the notifier handle
* @return the FPGA time the notifier returned
* @param[in] notifierHandle the notifier handle
* @param[out] status Error status variable. 0 on success.
* @return the FPGA time the notifier returned
*/
WPI_NODISCARD
uint64_t HAL_WaitForNotifierAlarm(HAL_NotifierHandle notifierHandle,

View File

@@ -21,10 +21,11 @@ extern "C" {
/**
* Initializes a PWM port.
*
* @param portHandle the port to initialize
* @param allocationLocation the location where the allocation is occuring
* (can be null)
* @return the created pwm handle
* @param[in] portHandle the port to initialize
* @param[in] allocationLocation the location where the allocation is occuring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created pwm handle
*/
HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
const char* allocationLocation,
@@ -33,7 +34,8 @@ HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
/**
* Frees a PWM port.
*
* @param pwmPortHandle the pwm handle
* @param[in] pwmPortHandle the pwm handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_FreePWMPort(HAL_DigitalHandle pwmPortHandle, int32_t* status);
@@ -41,7 +43,7 @@ void HAL_FreePWMPort(HAL_DigitalHandle pwmPortHandle, int32_t* status);
* Checks if a pwm channel is valid.
*
* @param channel the channel to check
* @return true if the channel is valid, otherwise false
* @return true if the channel is valid, otherwise false
*/
HAL_Bool HAL_CheckPWMChannel(int32_t channel);
@@ -50,12 +52,13 @@ HAL_Bool HAL_CheckPWMChannel(int32_t channel);
*
* All values are in milliseconds.
*
* @param pwmPortHandle the PWM handle
* @param maxPwm the maximum PWM value
* @param deadbandMaxPwm the high range of the center deadband
* @param centerPwm the center PWM value
* @param deadbandMinPwm the low range of the center deadband
* @param minPwm the minimum PWM value
* @param[in] pwmPortHandle the PWM handle
* @param[in] maxPwm the maximum PWM value
* @param[in] deadbandMaxPwm the high range of the center deadband
* @param[in] centerPwm the center PWM value
* @param[in] deadbandMinPwm the low range of the center deadband
* @param[in] minPwm the minimum PWM value
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMConfig(HAL_DigitalHandle pwmPortHandle, double maxPwm,
double deadbandMaxPwm, double centerPwm,
@@ -69,12 +72,13 @@ void HAL_SetPWMConfig(HAL_DigitalHandle pwmPortHandle, double maxPwm,
*
* Values are in raw FPGA units.
*
* @param pwmPortHandle the PWM handle
* @param maxPwm the maximum PWM value
* @param deadbandMaxPwm the high range of the center deadband
* @param centerPwm the center PWM value
* @param deadbandMinPwm the low range of the center deadband
* @param minPwm the minimum PWM value
* @param[in] pwmPortHandle the PWM handle
* @param[in] maxPwm the maximum PWM value
* @param[in] deadbandMaxPwm the high range of the center deadband
* @param[in] centerPwm the center PWM value
* @param[in] deadbandMinPwm the low range of the center deadband
* @param[in] minPwm the minimum PWM value
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t maxPwm,
int32_t deadbandMaxPwm, int32_t centerPwm,
@@ -87,12 +91,13 @@ void HAL_SetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t maxPwm,
* Values are in raw FPGA units. These units have the potential to change for
* any FPGA release.
*
* @param pwmPortHandle the PWM handle
* @param maxPwm the maximum PWM value
* @param deadbandMaxPwm the high range of the center deadband
* @param centerPwm the center PWM value
* @param deadbandMinPwm the low range of the center deadband
* @param minPwm the minimum PWM value
* @param[in] pwmPortHandle the PWM handle
* @param[in] maxPwm the maximum PWM value
* @param[in] deadbandMaxPwm the high range of the center deadband
* @param[in] centerPwm the center PWM value
* @param[in] deadbandMinPwm the low range of the center deadband
* @param[in] minPwm the minimum PWM value
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t* maxPwm,
int32_t* deadbandMaxPwm, int32_t* centerPwm,
@@ -103,8 +108,9 @@ void HAL_GetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t* maxPwm,
* Sets if the FPGA should output the center value if the input value is within
* the deadband.
*
* @param pwmPortHandle the PWM handle
* @param eliminateDeadband true to eliminate deadband, otherwise false
* @param[in] pwmPortHandle the PWM handle
* @param[in] eliminateDeadband true to eliminate deadband, otherwise false
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
HAL_Bool eliminateDeadband, int32_t* status);
@@ -112,8 +118,9 @@ void HAL_SetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
/**
* Gets the current eliminate deadband value.
*
* @param pwmPortHandle the PWM handle
* @return true if set, otherwise false
* @param[in] pwmPortHandle the PWM handle
* @param[out] status Error status variable. 0 on success.
* @return true if set, otherwise false
*/
HAL_Bool HAL_GetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
int32_t* status);
@@ -124,8 +131,9 @@ HAL_Bool HAL_GetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
* The values are in raw FPGA units, and have the potential to change with any
* FPGA release.
*
* @param pwmPortHandle the PWM handle
* @param value the PWM value to set
* @param[in] pwmPortHandle the PWM handle
* @param[in] value the PWM value to set
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t value,
int32_t* status);
@@ -136,8 +144,9 @@ void HAL_SetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t value,
* The values range from -1 to 1 and the period is controlled by the PWM Period
* and MinHigh registers.
*
* @param pwmPortHandle the PWM handle
* @param value the scaled PWM value to set
* @param[in] pwmPortHandle the PWM handle
* @param[in] speed the scaled PWM value to set
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMSpeed(HAL_DigitalHandle pwmPortHandle, double speed,
int32_t* status);
@@ -148,8 +157,9 @@ void HAL_SetPWMSpeed(HAL_DigitalHandle pwmPortHandle, double speed,
* The values range from 0 to 1 and the period is controlled by the PWM Period
* and MinHigh registers.
*
* @param pwmPortHandle the PWM handle
* @param value the positional PWM value to set
* @param[in] pwmPortHandle the PWM handle
* @param[in] position the positional PWM value to set
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMPosition(HAL_DigitalHandle pwmPortHandle, double position,
int32_t* status);
@@ -161,7 +171,8 @@ void HAL_SetPWMPosition(HAL_DigitalHandle pwmPortHandle, double position,
* from just setting a 0 speed, as this will actively stop all signaling on the
* channel.
*
* @param pwmPortHandle the PWM handle.
* @param[in] pwmPortHandle the PWM handle.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMDisabled(HAL_DigitalHandle pwmPortHandle, int32_t* status);
@@ -171,8 +182,9 @@ void HAL_SetPWMDisabled(HAL_DigitalHandle pwmPortHandle, int32_t* status);
* The values are in raw FPGA units, and have the potential to change with any
* FPGA release.
*
* @param pwmPortHandle the PWM handle
* @return the current raw PWM value
* @param[in] pwmPortHandle the PWM handle
* @param[out] status Error status variable. 0 on success.
* @return the current raw PWM value
*/
int32_t HAL_GetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t* status);
@@ -181,8 +193,9 @@ int32_t HAL_GetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t* status);
*
* The values range from -1 to 1.
*
* @param pwmPortHandle the PWM handle
* @return the current speed PWM value
* @param[in] pwmPortHandle the PWM handle
* @param[out] status Error status variable. 0 on success.
* @return the current speed PWM value
*/
double HAL_GetPWMSpeed(HAL_DigitalHandle pwmPortHandle, int32_t* status);
@@ -191,23 +204,26 @@ double HAL_GetPWMSpeed(HAL_DigitalHandle pwmPortHandle, int32_t* status);
*
* The values range from 0 to 1.
*
* @param pwmPortHandle the PWM handle
* @return the current positional PWM value
* @param[in] pwmPortHandle the PWM handle
* @param[out] status Error status variable. 0 on success.
* @return the current positional PWM value
*/
double HAL_GetPWMPosition(HAL_DigitalHandle pwmPortHandle, int32_t* status);
/**
* Forces a PWM signal to go to 0 temporarily.
*
* @param pwmPortHandle the PWM handle.
* @param[in] pwmPortHandle the PWM handle.
* @param[out] status Error status variable. 0 on success.
*/
void HAL_LatchPWMZero(HAL_DigitalHandle pwmPortHandle, int32_t* status);
/**
* Sets how how often the PWM signal is squelched, thus scaling the period.
*
* @param pwmPortHandle the PWM handle.
* @param squelchMask the 2-bit mask of outputs to squelch
* @param[in] pwmPortHandle the PWM handle.
* @param[in] squelchMask the 2-bit mask of outputs to squelch
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPWMPeriodScale(HAL_DigitalHandle pwmPortHandle, int32_t squelchMask,
int32_t* status);
@@ -215,6 +231,7 @@ void HAL_SetPWMPeriodScale(HAL_DigitalHandle pwmPortHandle, int32_t squelchMask,
/**
* Gets the loop timing of the PWM system.
*
* @param[out] status Error status variable. 0 on success.
* @return the loop time
*/
int32_t HAL_GetPWMLoopTiming(int32_t* status);
@@ -224,6 +241,7 @@ int32_t HAL_GetPWMLoopTiming(int32_t* status);
*
* This time is relative to the FPGA time.
*
* @param[out] status Error status variable. 0 on success.
* @return the pwm cycle start time
*/
uint64_t HAL_GetPWMCycleStartTime(int32_t* status);

View File

@@ -21,6 +21,7 @@ extern "C" {
/**
* Gets the roboRIO input voltage.
*
* @param[out] status the error code, or 0 for success
* @return the input voltage (volts)
*/
double HAL_GetVinVoltage(int32_t* status);
@@ -28,6 +29,7 @@ double HAL_GetVinVoltage(int32_t* status);
/**
* Gets the roboRIO input current.
*
* @param[out] status the error code, or 0 for success
* @return the input current (amps)
*/
double HAL_GetVinCurrent(int32_t* status);
@@ -35,6 +37,7 @@ double HAL_GetVinCurrent(int32_t* status);
/**
* Gets the 6V rail voltage.
*
* @param[out] status the error code, or 0 for success
* @return the 6V rail voltage (volts)
*/
double HAL_GetUserVoltage6V(int32_t* status);
@@ -42,6 +45,7 @@ double HAL_GetUserVoltage6V(int32_t* status);
/**
* Gets the 6V rail current.
*
* @param[out] status the error code, or 0 for success
* @return the 6V rail current (amps)
*/
double HAL_GetUserCurrent6V(int32_t* status);
@@ -49,6 +53,7 @@ double HAL_GetUserCurrent6V(int32_t* status);
/**
* Gets the active state of the 6V rail.
*
* @param[out] status the error code, or 0 for success
* @return true if the rail is active, otherwise false
*/
HAL_Bool HAL_GetUserActive6V(int32_t* status);
@@ -56,6 +61,7 @@ HAL_Bool HAL_GetUserActive6V(int32_t* status);
/**
* Gets the fault count for the 6V rail.
*
* @param[out] status the error code, or 0 for success
* @return the number of 6V fault counts
*/
int32_t HAL_GetUserCurrentFaults6V(int32_t* status);
@@ -63,6 +69,7 @@ int32_t HAL_GetUserCurrentFaults6V(int32_t* status);
/**
* Gets the 5V rail voltage.
*
* @param[out] status the error code, or 0 for success
* @return the 5V rail voltage (volts)
*/
double HAL_GetUserVoltage5V(int32_t* status);
@@ -70,6 +77,7 @@ double HAL_GetUserVoltage5V(int32_t* status);
/**
* Gets the 5V rail current.
*
* @param[out] status the error code, or 0 for success
* @return the 5V rail current (amps)
*/
double HAL_GetUserCurrent5V(int32_t* status);
@@ -77,6 +85,7 @@ double HAL_GetUserCurrent5V(int32_t* status);
/**
* Gets the active state of the 5V rail.
*
* @param[out] status the error code, or 0 for success
* @return true if the rail is active, otherwise false
*/
HAL_Bool HAL_GetUserActive5V(int32_t* status);
@@ -84,6 +93,7 @@ HAL_Bool HAL_GetUserActive5V(int32_t* status);
/**
* Gets the fault count for the 5V rail.
*
* @param[out] status the error code, or 0 for success
* @return the number of 5V fault counts
*/
int32_t HAL_GetUserCurrentFaults5V(int32_t* status);
@@ -91,6 +101,7 @@ int32_t HAL_GetUserCurrentFaults5V(int32_t* status);
/**
* Gets the 3V3 rail voltage.
*
* @param[out] status the error code, or 0 for success
* @return the 3V3 rail voltage (volts)
*/
double HAL_GetUserVoltage3V3(int32_t* status);
@@ -98,6 +109,7 @@ double HAL_GetUserVoltage3V3(int32_t* status);
/**
* Gets the 3V3 rail current.
*
* @param[out] status the error code, or 0 for success
* @return the 3V3 rail current (amps)
*/
double HAL_GetUserCurrent3V3(int32_t* status);
@@ -105,6 +117,7 @@ double HAL_GetUserCurrent3V3(int32_t* status);
/**
* Gets the active state of the 3V3 rail.
*
* @param[out] status the error code, or 0 for success
* @return true if the rail is active, otherwise false
*/
HAL_Bool HAL_GetUserActive3V3(int32_t* status);
@@ -112,6 +125,7 @@ HAL_Bool HAL_GetUserActive3V3(int32_t* status);
/**
* Gets the fault count for the 3V3 rail.
*
* @param[out] status the error code, or 0 for success
* @return the number of 3V3 fault counts
*/
int32_t HAL_GetUserCurrentFaults3V3(int32_t* status);
@@ -119,6 +133,7 @@ int32_t HAL_GetUserCurrentFaults3V3(int32_t* status);
/**
* Get the current brownout voltage setting.
*
* @param[out] status the error code, or 0 for success
* @return The brownout voltage
*/
double HAL_GetBrownoutVoltage(int32_t* status);
@@ -129,7 +144,8 @@ double HAL_GetBrownoutVoltage(int32_t* status);
* Note that this only does anything on the roboRIO 2.
* On the roboRIO it is a no-op.
*
* @param voltage The brownout voltage
* @param[in] voltage The brownout voltage
* @param[out] status the error code, or 0 for success
*/
void HAL_SetBrownoutVoltage(double voltage, int32_t* status);

View File

@@ -35,8 +35,10 @@ extern "C" {
/**
* Initializes a Power Distribution Panel.
*
* @param module the module number to initialize
* @param type the type of module to intialize
* @param[in] moduleNumber the module number to initialize
* @param[in] type the type of module to intialize
* @param[in] allocationLocation the location where the allocation is occuring
* @param[out] status Error status variable. 0 on success.
* @return the created PowerDistribution
*/
HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
@@ -46,7 +48,8 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
/**
* Gets the module number for a specific handle.
*
* @param handle the module handle
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the module number
*/
int32_t HAL_GetPowerDistributionModuleNumber(HAL_PowerDistributionHandle handle,
@@ -62,9 +65,9 @@ void HAL_CleanPowerDistribution(HAL_PowerDistributionHandle handle);
/**
* Checks if a PowerDistribution channel is valid.
*
* @param handle the module handle
* @param handle the module handle
* @param channel the channel to check
* @return true if the channel is valid, otherwise false
* @return true if the channel is valid, otherwise false
*/
HAL_Bool HAL_CheckPowerDistributionChannel(HAL_PowerDistributionHandle handle,
int32_t channel);
@@ -72,8 +75,9 @@ HAL_Bool HAL_CheckPowerDistributionChannel(HAL_PowerDistributionHandle handle,
/**
* Checks if a PowerDistribution module is valid.
*
* @param channel the module to check
* @return true if the module is valid, otherwise false
* @param module the module to check
* @param type the type of module
* @return true if the module is valid, otherwise false
*/
HAL_Bool HAL_CheckPowerDistributionModule(int32_t module,
HAL_PowerDistributionType type);
@@ -81,6 +85,8 @@ HAL_Bool HAL_CheckPowerDistributionModule(int32_t module,
/**
* Gets the type of PowerDistribution module.
*
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the type of module
*/
HAL_PowerDistributionType HAL_GetPowerDistributionType(
@@ -89,7 +95,8 @@ HAL_PowerDistributionType HAL_GetPowerDistributionType(
/**
* Gets the number of channels for this handle.
*
* @param handle the handle
* @param[in] handle the handle
* @param[out] status Error status variable. 0 on success.
* @return number of channels
*/
int32_t HAL_GetPowerDistributionNumChannels(HAL_PowerDistributionHandle handle,
@@ -98,8 +105,9 @@ int32_t HAL_GetPowerDistributionNumChannels(HAL_PowerDistributionHandle handle,
/**
* Gets the temperature of the PowerDistribution.
*
* @param handle the module handle
* @return the module temperature (celsius)
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the module temperature (celsius)
*/
double HAL_GetPowerDistributionTemperature(HAL_PowerDistributionHandle handle,
int32_t* status);
@@ -107,8 +115,9 @@ double HAL_GetPowerDistributionTemperature(HAL_PowerDistributionHandle handle,
/**
* Gets the PowerDistribution input voltage.
*
* @param handle the module handle
* @return the input voltage (volts)
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the input voltage (volts)
*/
double HAL_GetPowerDistributionVoltage(HAL_PowerDistributionHandle handle,
int32_t* status);
@@ -116,9 +125,10 @@ double HAL_GetPowerDistributionVoltage(HAL_PowerDistributionHandle handle,
/**
* Gets the current of a specific PowerDistribution channel.
*
* @param module the module
* @param channel the channel
* @return the channel current (amps)
* @param[in] handle the module handle
* @param[in] channel the channel
* @param[out] status Error status variable. 0 on success.
* @return the channel current (amps)
*/
double HAL_GetPowerDistributionChannelCurrent(
HAL_PowerDistributionHandle handle, int32_t channel, int32_t* status);
@@ -128,9 +138,10 @@ double HAL_GetPowerDistributionChannelCurrent(
*
* The array must be large enough to hold all channels.
*
* @param handle the module handle
* @param currents the currents (output)
* @param currentsLength the length of the currents array
* @param[in] handle the module handle
* @param[out] currents the currents
* @param[in] currentsLength the length of the currents array
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetPowerDistributionAllChannelCurrents(
HAL_PowerDistributionHandle handle, double* currents,
@@ -139,8 +150,9 @@ void HAL_GetPowerDistributionAllChannelCurrents(
/**
* Gets the total current of the PowerDistribution.
*
* @param handle the module handle
* @return the total current (amps)
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the total current (amps)
*/
double HAL_GetPowerDistributionTotalCurrent(HAL_PowerDistributionHandle handle,
int32_t* status);
@@ -148,8 +160,9 @@ double HAL_GetPowerDistributionTotalCurrent(HAL_PowerDistributionHandle handle,
/**
* Gets the total power of the PowerDistribution.
*
* @param handle the module handle
* @return the total power (watts)
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the total power (watts)
*/
double HAL_GetPowerDistributionTotalPower(HAL_PowerDistributionHandle handle,
int32_t* status);
@@ -157,8 +170,9 @@ double HAL_GetPowerDistributionTotalPower(HAL_PowerDistributionHandle handle,
/**
* Gets the total energy of the PowerDistribution.
*
* @param handle the module handle
* @return the total energy (joules)
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the total energy (joules)
*/
double HAL_GetPowerDistributionTotalEnergy(HAL_PowerDistributionHandle handle,
int32_t* status);
@@ -166,7 +180,8 @@ double HAL_GetPowerDistributionTotalEnergy(HAL_PowerDistributionHandle handle,
/**
* Resets the PowerDistribution accumulated energy.
*
* @param handle the module handle
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ResetPowerDistributionTotalEnergy(HAL_PowerDistributionHandle handle,
int32_t* status);
@@ -174,15 +189,32 @@ void HAL_ResetPowerDistributionTotalEnergy(HAL_PowerDistributionHandle handle,
/**
* Clears any PowerDistribution sticky faults.
*
* @param handle the module handle
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ClearPowerDistributionStickyFaults(HAL_PowerDistributionHandle handle,
int32_t* status);
// REV PDH Specific functions. This functions will no-op on CTRE PDP
/**
* Power on/off switchable channel.
*
* This is a REV PDH-specific function. This function will no-op on CTRE PDP.
*
* @param[in] handle the module handle
* @param[in] enabled true to turn on switchable channel
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetPowerDistributionSwitchableChannel(
HAL_PowerDistributionHandle handle, HAL_Bool enabled, int32_t* status);
/**
* Returns true if switchable channel is powered on.
*
* This is a REV PDH-specific function. This function will no-op on CTRE PDP.
*
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
*/
HAL_Bool HAL_GetPowerDistributionSwitchableChannel(
HAL_PowerDistributionHandle handle, int32_t* status);

View File

@@ -24,11 +24,13 @@ extern "C" {
* Note this call will only initialize either the forward or reverse port of the
* relay. If you need both, you will need to initialize 2 relays.
*
* @param portHandle the port handle to initialize
* @param fwd true for the forward port, false for the reverse port
* @param allocationLocation the location where the allocation is occuring
* (can be null)
* @return the created relay handle
* @param[in] portHandle the port handle to initialize
* @param[in] fwd true for the forward port, false for the
* reverse port
* @param[in] allocationLocation the location where the allocation is occuring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created relay handle
*/
HAL_RelayHandle HAL_InitializeRelayPort(HAL_PortHandle portHandle, HAL_Bool fwd,
const char* allocationLocation,
@@ -45,15 +47,16 @@ void HAL_FreeRelayPort(HAL_RelayHandle relayPortHandle);
* Checks if a relay channel is valid.
*
* @param channel the channel to check
* @return true if the channel is valid, otherwise false
* @return true if the channel is valid, otherwise false
*/
HAL_Bool HAL_CheckRelayChannel(int32_t channel);
/**
* Sets the state of a relay output.
*
* @param relayPortHandle the relay handle
* @param on true for on, false for off
* @param[in] relayPortHandle the relay handle
* @param[in] on true for on, false for off
* @param[out] status Error status variable. 0 on success.
*/
void HAL_SetRelay(HAL_RelayHandle relayPortHandle, HAL_Bool on,
int32_t* status);
@@ -61,8 +64,9 @@ void HAL_SetRelay(HAL_RelayHandle relayPortHandle, HAL_Bool on,
/**
* Gets the current state of the relay channel.
*
* @param relayPortHandle the relay handle
* @return true for on, false for off
* @param[in] relayPortHandle the relay handle
* @param[out] status Error status variable. 0 on success.
* @return true for on, false for off
*/
HAL_Bool HAL_GetRelay(HAL_RelayHandle relayPortHandle, int32_t* status);
#ifdef __cplusplus

View File

@@ -25,7 +25,9 @@ extern "C" {
*
* If opening the MXP port, also sets up the channel functions appropriately.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS3, 4 for MXP
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS3, 4
* for MXP
* @param[out] status the error code, or 0 for success
*/
void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status);
@@ -36,11 +38,11 @@ void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status);
* over each transaction.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP
* for MXP
* @param dataToSend Buffer of data to send as part of the transaction.
* @param dataReceived Buffer to read data into.
* @param size Number of bytes to transfer. [0..7]
* @return Number of bytes transferred, -1 for error
* @return Number of bytes transferred, -1 for error
*/
int32_t HAL_TransactionSPI(HAL_SPIPort port, const uint8_t* dataToSend,
uint8_t* dataReceived, int32_t size);
@@ -50,11 +52,11 @@ int32_t HAL_TransactionSPI(HAL_SPIPort port, const uint8_t* dataToSend,
*
* Writes to a device and wait until the transaction is complete.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP
* @param datToSend The data to write to the register on the device.
* @param sendSize The number of bytes to be written
* @return The number of bytes written. -1 for an error
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP
* @param dataToSend The data to write to the register on the device.
* @param sendSize The number of bytes to be written
* @return The number of bytes written. -1 for an error
*/
int32_t HAL_WriteSPI(HAL_SPIPort port, const uint8_t* dataToSend,
int32_t sendSize);
@@ -68,11 +70,11 @@ int32_t HAL_WriteSPI(HAL_SPIPort port, const uint8_t* dataToSend,
* begin returning data.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP
* MXP
* @param buffer A pointer to the array of bytes to store the data read from the
* device.
* device.
* @param count The number of bytes to read in the transaction. [1..7]
* @return Number of bytes read. -1 for error.
* @return Number of bytes read. -1 for error.
*/
int32_t HAL_ReadSPI(HAL_SPIPort port, uint8_t* buffer, int32_t count);
@@ -87,7 +89,7 @@ void HAL_CloseSPI(HAL_SPIPort port);
* Sets the clock speed for the SPI bus.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP
* MXP
* @param speed The speed in Hz (0-1MHz)
*/
void HAL_SetSPISpeed(HAL_SPIPort port, int32_t speed);
@@ -96,12 +98,12 @@ void HAL_SetSPISpeed(HAL_SPIPort port, int32_t speed);
* Sets the SPI options.
*
* @param port The number of the port to use. 0-3 for Onboard
* CS0-CS2, 4 for MXP
* CS0-CS2, 4 for MXP
* @param msbFirst True to write the MSB first, False for LSB first
* @param sampleOnTrailing True to sample on the trailing edge, False to sample
* on the leading edge
* on the leading edge
* @param clkIdleHigh True to set the clock to active low, False to set the
* clock active high
* clock active high
*/
void HAL_SetSPIOpts(HAL_SPIPort port, HAL_Bool msbFirst,
HAL_Bool sampleOnTrailing, HAL_Bool clkIdleHigh);
@@ -109,14 +111,18 @@ void HAL_SetSPIOpts(HAL_SPIPort port, HAL_Bool msbFirst,
/**
* Sets the CS Active high for a SPI port.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSPIChipSelectActiveHigh(HAL_SPIPort port, int32_t* status);
/**
* Sets the CS Active low for a SPI port.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSPIChipSelectActiveLow(HAL_SPIPort port, int32_t* status);
@@ -124,8 +130,8 @@ void HAL_SetSPIChipSelectActiveLow(HAL_SPIPort port, int32_t* status);
* Gets the stored handle for a SPI port.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
* @return The stored handle for the SPI port. 0 represents no stored
* handle.
* @return The stored handle for the SPI port. 0 represents no stored
* handle.
*/
int32_t HAL_GetSPIHandle(HAL_SPIPort port);
@@ -133,7 +139,7 @@ int32_t HAL_GetSPIHandle(HAL_SPIPort port);
* Sets the stored handle for a SPI port.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* MXP.
* @param handle The value of the handle for the port.
*/
void HAL_SetSPIHandle(HAL_SPIPort port, int32_t handle);
@@ -141,26 +147,29 @@ void HAL_SetSPIHandle(HAL_SPIPort port, int32_t handle);
/**
* Initializes the SPI automatic accumulator.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param bufferSize The accumulator buffer size.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2,
* 4 for MXP.
* @param[in] bufferSize The accumulator buffer size.
* @param[out] status the error code, or 0 for success
*/
void HAL_InitSPIAuto(HAL_SPIPort port, int32_t bufferSize, int32_t* status);
/**
* Frees an SPI automatic accumulator.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param[out] status the error code, or 0 for success
*/
void HAL_FreeSPIAuto(HAL_SPIPort port, int32_t* status);
/**
* Sets the period for automatic SPI accumulation.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @param period The accumlation period (seconds).
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param[in] period The accumlation period (seconds).
* @param[out] status the error code, or 0 for success
*/
void HAL_StartSPIAutoRate(HAL_SPIPort port, double period, int32_t* status);
@@ -170,14 +179,15 @@ void HAL_StartSPIAutoRate(HAL_SPIPort port, double period, int32_t* status);
* Note that triggering on both rising and falling edges is a valid
* configuration.
*
* @param port The number of the port to use. 0-3 for Onboard
* CS0-CS2, 4 for MXP.
* @param digitalSourceHandle The trigger source to use (Either
* HAL_AnalogTriggerHandle or HAL_DigitalHandle).
* @param analogTriggerType The analog trigger type, if the source is an
* analog trigger.
* @param triggerRising Trigger on the rising edge if true.
* @param triggerFalling Trigger on the falling edge if true.
* @param[in] port The number of the port to use. 0-3 for Onboard
* CS0-CS2, 4 for MXP.
* @param[in] digitalSourceHandle The trigger source to use (Either
* HAL_AnalogTriggerHandle or HAL_DigitalHandle).
* @param[in] analogTriggerType The analog trigger type, if the source is an
* analog trigger.
* @param[in] triggerRising Trigger on the rising edge if true.
* @param[in] triggerFalling Trigger on the falling edge if true.
* @param[out] status the error code, or 0 for success
*/
void HAL_StartSPIAutoTrigger(HAL_SPIPort port, HAL_Handle digitalSourceHandle,
HAL_AnalogTriggerType analogTriggerType,
@@ -187,20 +197,22 @@ void HAL_StartSPIAutoTrigger(HAL_SPIPort port, HAL_Handle digitalSourceHandle,
/**
* Stops an automatic SPI accumlation.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param[out] status the error code, or 0 for success
*/
void HAL_StopSPIAuto(HAL_SPIPort port, int32_t* status);
/**
* Sets the data to be transmitted to the device to initiate a read.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param dataToSend Pointer to the data to send (Gets copied for continue use,
* so no need to keep alive).
* @param dataSize The length of the data to send.
* @param zeroSize The number of zeros to send after the data.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2,
* 4 for MXP.
* @param[in] dataToSend Pointer to the data to send (Gets copied for continue
* use, so no need to keep alive).
* @param[in] dataSize The length of the data to send.
* @param[in] zeroSize The number of zeros to send after the data.
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSPIAutoTransmitData(HAL_SPIPort port, const uint8_t* dataToSend,
int32_t dataSize, int32_t zeroSize,
@@ -209,8 +221,9 @@ void HAL_SetSPIAutoTransmitData(HAL_SPIPort port, const uint8_t* dataToSend,
/**
* Immediately forces an SPI read to happen.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param[out] status the error code, or 0 for success
*/
void HAL_ForceSPIAutoRead(HAL_SPIPort port, int32_t* status);
@@ -221,12 +234,13 @@ void HAL_ForceSPIAutoRead(HAL_SPIPort port, int32_t* status);
* sequence is the same as the combined dataSize + zeroSize set in
* HAL_SetSPIAutoTransmitData.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param buffer The buffer to store the data into.
* @param numToRead The number of words to read.
* @param timeout The read timeout (in seconds).
* @return The number of words actually read.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2,
* 4 for MXP.
* @param[out] buffer The buffer to store the data into.
* @param[in] numToRead The number of words to read.
* @param[in] timeout The read timeout (in seconds).
* @param[out] status the error code, or 0 for success
* @return The number of words actually read.
*/
int32_t HAL_ReadSPIAutoReceivedData(HAL_SPIPort port, uint32_t* buffer,
int32_t numToRead, double timeout,
@@ -235,20 +249,23 @@ int32_t HAL_ReadSPIAutoReceivedData(HAL_SPIPort port, uint32_t* buffer,
/**
* Gets the count of how many SPI accumulations have been missed.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @return The number of missed accumulations.
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.
* @param[out] status the error code, or 0 for success
* @return The number of missed accumulations.
*/
int32_t HAL_GetSPIAutoDroppedCount(HAL_SPIPort port, int32_t* status);
/**
* Configure the Auto SPI Stall time between reads.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @param csToSclkTicks the number of ticks to wait before asserting the cs pin
* @param stallTicks the number of ticks to stall for
* @param pow2BytesPerRead the number of bytes to read before stalling
* @param[in] port The number of the port to use. 0-3 for Onboard
* CS0-CS2, 4 for MXP.
* @param[in] csToSclkTicks the number of ticks to wait before asserting the
* cs pin
* @param[in] stallTicks the number of ticks to stall for
* @param[in] pow2BytesPerRead the number of bytes to read before stalling
* @param[out] status the error code, or 0 for success
*/
void HAL_ConfigureSPIAutoStall(HAL_SPIPort port, int32_t csToSclkTicks,
int32_t stallTicks, int32_t pow2BytesPerRead,

View File

@@ -33,7 +33,8 @@ extern "C" {
* The channels are either the onboard RS232, the mxp uart, or 2 USB ports. The
* top port is USB1, the bottom port is USB2.
*
* @param port the serial port to initialize
* @param[in] port the serial port to initialize
* @param[out] status the error code, or 0 for success
*/
HAL_SerialPortHandle HAL_InitializeSerialPort(HAL_SerialPort port,
int32_t* status);
@@ -44,8 +45,9 @@ HAL_SerialPortHandle HAL_InitializeSerialPort(HAL_SerialPort port,
* This name is the /dev name for a specific port.
* Note these are not always consistent between roboRIO reboots.
*
* @param port the serial port to initialize
* @param portName the dev port name
* @param[in] port the serial port to initialize
* @param[in] portName the dev port name
* @param[out] status the error code, or 0 for success
*/
HAL_SerialPortHandle HAL_InitializeSerialPortDirect(HAL_SerialPort port,
const char* portName,
@@ -54,8 +56,9 @@ HAL_SerialPortHandle HAL_InitializeSerialPortDirect(HAL_SerialPort port,
/**
* Gets the raw serial port file descriptor from a handle.
*
* @param handle the serial port handle
* @return the raw port descriptor
* @param[in] handle the serial port handle
* @param[out] status the error code, or 0 for success
* @return the raw port descriptor
*/
int HAL_GetSerialFD(HAL_SerialPortHandle handle, int32_t* status);
@@ -64,8 +67,9 @@ int HAL_GetSerialFD(HAL_SerialPortHandle handle, int32_t* status);
*
* Any value between 0 and 0xFFFFFFFF may be used. Default is 9600.
*
* @param handle the serial port handle
* @param baud the baud rate to set
* @param[in] handle the serial port handle
* @param[in] baud the baud rate to set
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialBaudRate(HAL_SerialPortHandle handle, int32_t baud,
int32_t* status);
@@ -75,8 +79,9 @@ void HAL_SetSerialBaudRate(HAL_SerialPortHandle handle, int32_t baud,
*
* Defaults to 8.
*
* @param handle the serial port handle
* @param bits the number of data bits (5-8)
* @param[in] handle the serial port handle
* @param[in] bits the number of data bits (5-8)
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialDataBits(HAL_SerialPortHandle handle, int32_t bits,
int32_t* status);
@@ -91,8 +96,9 @@ void HAL_SetSerialDataBits(HAL_SerialPortHandle handle, int32_t bits,
* 3: Mark - Means exists and always 1
* 4: Space - Means exists and always 0
*
* @param handle the serial port handle
* @param parity the parity bit mode (see remarks for valid values)
* @param[in] handle the serial port handle
* @param[in] parity the parity bit mode (see remarks for valid values)
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialParity(HAL_SerialPortHandle handle, int32_t parity,
int32_t* status);
@@ -105,8 +111,9 @@ void HAL_SetSerialParity(HAL_SerialPortHandle handle, int32_t parity,
* 15: One and a half stop bits
* 20: Two stop bits
*
* @param handle the serial port handle
* @param stopBits the stop bit value (see remarks for valid values)
* @param[in] handle the serial port handle
* @param[in] stopBits the stop bit value (see remarks for valid values)
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialStopBits(HAL_SerialPortHandle handle, int32_t stopBits,
int32_t* status);
@@ -118,8 +125,9 @@ void HAL_SetSerialStopBits(HAL_SerialPortHandle handle, int32_t stopBits,
* 1: Flush on access
* 2: Flush when full (default)
*
* @param handle the serial port handle
* @param mode the mode to set (see remarks for valid values)
* @param[in] handle the serial port handle
* @param[in] mode the mode to set (see remarks for valid values)
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialWriteMode(HAL_SerialPortHandle handle, int32_t mode,
int32_t* status);
@@ -133,8 +141,9 @@ void HAL_SetSerialWriteMode(HAL_SerialPortHandle handle, int32_t mode,
* 2: RTS-CTS
* 3: DTR-DSR
*
* @param handle the serial port handle
* @param flow the mode to set (see remarks for valid values)
* @param[in] handle the serial port handle
* @param[in] flow the mode to set (see remarks for valid values)
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialFlowControl(HAL_SerialPortHandle handle, int32_t flow,
int32_t* status);
@@ -142,8 +151,9 @@ void HAL_SetSerialFlowControl(HAL_SerialPortHandle handle, int32_t flow,
/**
* Sets the minimum serial read timeout of a port.
*
* @param handle the serial port handle
* @param timeout the timeout in milliseconds
* @param[in] handle the serial port handle
* @param[in] timeout the timeout in milliseconds
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialTimeout(HAL_SerialPortHandle handle, double timeout,
int32_t* status);
@@ -153,8 +163,9 @@ void HAL_SetSerialTimeout(HAL_SerialPortHandle handle, double timeout,
*
* By default this is disabled.
*
* @param handle the serial port handle
* @param terminator the termination character to set
* @param[in] handle the serial port handle
* @param[in] terminator the termination character to set
* @param[out] status the error code, or 0 for success
*/
void HAL_EnableSerialTermination(HAL_SerialPortHandle handle, char terminator,
int32_t* status);
@@ -162,15 +173,17 @@ void HAL_EnableSerialTermination(HAL_SerialPortHandle handle, char terminator,
/**
* Disables a termination character for reads.
*
* @param handle the serial port handle
* @param[in] handle the serial port handle
* @param[out] status the error code, or 0 for success
*/
void HAL_DisableSerialTermination(HAL_SerialPortHandle handle, int32_t* status);
/**
* Sets the size of the read buffer.
*
* @param handle the serial port handle
* @param size the read buffer size
* @param[in] handle the serial port handle
* @param[in] size the read buffer size
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialReadBufferSize(HAL_SerialPortHandle handle, int32_t size,
int32_t* status);
@@ -178,8 +191,9 @@ void HAL_SetSerialReadBufferSize(HAL_SerialPortHandle handle, int32_t size,
/**
* Sets the size of the write buffer.
*
* @param handle the serial port handle
* @param size the write buffer size
* @param[in] handle the serial port handle
* @param[in] size the write buffer size
* @param[out] status the error code, or 0 for success
*/
void HAL_SetSerialWriteBufferSize(HAL_SerialPortHandle handle, int32_t size,
int32_t* status);
@@ -187,8 +201,9 @@ void HAL_SetSerialWriteBufferSize(HAL_SerialPortHandle handle, int32_t size,
/**
* Gets the number of bytes currently in the read buffer.
*
* @param handle the serial port handle
* @return the number of bytes in the read buffer
* @param[in] handle the serial port handle
* @param[out] status the error code, or 0 for success
* @return the number of bytes in the read buffer
*/
int32_t HAL_GetSerialBytesReceived(HAL_SerialPortHandle handle,
int32_t* status);
@@ -199,9 +214,11 @@ int32_t HAL_GetSerialBytesReceived(HAL_SerialPortHandle handle,
* Will wait for either timeout (if set), the termination char (if set), or the
* count to be full. Whichever one comes first.
*
* @param handle the serial port handle
* @param count the number of bytes maximum to read
* @return the number of bytes actually read
* @param[in] handle the serial port handle
* @param[out] buffer the buffer in which to store bytes read
* @param[in] count the number of bytes maximum to read
* @param[out] status the error code, or 0 for success
* @return the number of bytes actually read
*/
int32_t HAL_ReadSerial(HAL_SerialPortHandle handle, char* buffer, int32_t count,
int32_t* status);
@@ -209,10 +226,11 @@ int32_t HAL_ReadSerial(HAL_SerialPortHandle handle, char* buffer, int32_t count,
/**
* Writes data to the serial port.
*
* @param handle the serial port handle
* @param buffer the buffer to write
* @param count the number of bytes to write from the buffer
* @return the number of bytes actually written
* @param[in] handle the serial port handle
* @param[in] buffer the buffer to write
* @param[in] count the number of bytes to write from the buffer
* @param[out] status the error code, or 0 for success
* @return the number of bytes actually written
*/
int32_t HAL_WriteSerial(HAL_SerialPortHandle handle, const char* buffer,
int32_t count, int32_t* status);
@@ -220,21 +238,24 @@ int32_t HAL_WriteSerial(HAL_SerialPortHandle handle, const char* buffer,
/**
* Flushes the serial write buffer out to the port.
*
* @param handle the serial port handle
* @param[in] handle the serial port handle
* @param[out] status the error code, or 0 for success
*/
void HAL_FlushSerial(HAL_SerialPortHandle handle, int32_t* status);
/**
* Clears the receive buffer of the serial port.
*
* @param handle the serial port handle
* @param[in] handle the serial port handle
* @param[out] status the error code, or 0 for success
*/
void HAL_ClearSerial(HAL_SerialPortHandle handle, int32_t* status);
/**
* Closes a serial port.
*
* @param handle the serial port handle to close
* @param[in] handle the serial port handle to close
* @param[out] status the error code, or 0 for success
*/
void HAL_CloseSerial(HAL_SerialPortHandle handle, int32_t* status);
#ifdef __cplusplus

View File

@@ -21,13 +21,13 @@ extern "C" {
/**
* Gets the thread priority for the specified thread.
*
* @param handle Native handle pointer to the thread to get the priority
* for.
* @param isRealTime Set to true if thread is real-time, otherwise false.
* @param status Error status variable. 0 on success.
* @return The current thread priority. For real-time, this is 1-99
* with 99 being highest. For non-real-time, this is 0. See
* "man 7 sched" for details.
* @param[in] handle Native handle pointer to the thread to get the
* priority for.
* @param[out] isRealTime Set to true if thread is real-time, otherwise false.
* @param[out] status Error status variable. 0 on success.
* @return The current thread priority. For real-time, this is 1-99 with 99
* being highest. For non-real-time, this is 0. See "man 7 sched" for
* details.
*/
int32_t HAL_GetThreadPriority(NativeThreadHandle handle, HAL_Bool* isRealTime,
int32_t* status);
@@ -35,26 +35,25 @@ int32_t HAL_GetThreadPriority(NativeThreadHandle handle, HAL_Bool* isRealTime,
/**
* Gets the thread priority for the current thread.
*
* @param handle Native handle pointer to the thread to get the priority for
* @param isRealTime Set to true if thread is real-time, otherwise false.
* @param status Error status variable. 0 on success.
* @return The current thread priority. For real-time, this is 1-99
* with 99 being highest. For non-real-time, this is 0. See
* "man 7 sched" for details.
* @param[out] isRealTime Set to true if thread is real-time, otherwise false.
* @param[out] status Error status variable. 0 on success.
* @return The current thread priority. For real-time, this is 1-99 with 99
* being highest. For non-real-time, this is 0. See "man 7 sched" for
* details.
*/
int32_t HAL_GetCurrentThreadPriority(HAL_Bool* isRealTime, int32_t* status);
/**
* Sets the thread priority for the specified thread.
*
* @param thread Reference to the thread to set the priority of.
* @param realTime Set to true to set a real-time priority, false for standard
* priority.
* @param priority Priority to set the thread to. For real-time, this is 1-99
* with 99 being highest. For non-real-time, this is forced to
* 0. See "man 7 sched" for more details.
* @param status Error status variable. 0 on success.
* @return True on success.
* @param[in] handle Reference to the thread to set the priority of.
* @param[in] realTime Set to true to set a real-time priority, false for
* standard priority.
* @param[in] priority Priority to set the thread to. For real-time, this is
* 1-99 with 99 being highest. For non-real-time, this is
* forced to 0. See "man 7 sched" for more details.
* @param[out] status Error status variable. 0 on success.
* @return True on success.
*/
HAL_Bool HAL_SetThreadPriority(NativeThreadHandle handle, HAL_Bool realTime,
int32_t priority, int32_t* status);
@@ -62,14 +61,13 @@ HAL_Bool HAL_SetThreadPriority(NativeThreadHandle handle, HAL_Bool realTime,
/**
* Sets the thread priority for the current thread.
*
* @param thread Reference to the thread to set the priority of.
* @param realTime Set to true to set a real-time priority, false for standard
* priority.
* @param priority Priority to set the thread to. For real-time, this is 1-99
* with 99 being highest. For non-real-time, this is forced to
* 0. See "man 7 sched" for more details.
* @param status Error status variable. 0 on success.
* @return True on success.
* @param[in] realTime Set to true to set a real-time priority, false for
* standard priority.
* @param[in] priority Priority to set the thread to. For real-time, this is
* 1-99 with 99 being highest. For non-real-time, this is
* forced to 0. See "man 7 sched" for more details.
* @param[out] status Error status variable. 0 on success.
* @return True on success.
*/
HAL_Bool HAL_SetCurrentThreadPriority(HAL_Bool realTime, int32_t priority,
int32_t* status);

View File

@@ -26,34 +26,34 @@ class SerialHelper {
/**
* Get the VISA name of a serial port.
*
* @param port the serial port index
* @param status status check
* @return the VISA name
* @param[in] port the serial port index
* @param[out] status status check
* @return the VISA name
*/
std::string GetVISASerialPortName(HAL_SerialPort port, int32_t* status);
/**
* Get the OS name of a serial port.
*
* @param port the serial port index
* @param status status check
* @return the OS name
* @param[in] port the serial port index
* @param[out] status status check
* @return the OS name
*/
std::string GetOSSerialPortName(HAL_SerialPort port, int32_t* status);
/**
* Get a vector of all serial port VISA names.
*
* @param status status check
* @return vector of serial port VISA names
* @param[out] status status check
* @return vector of serial port VISA names
*/
std::vector<std::string> GetVISASerialPortList(int32_t* status);
/**
* Get a vector of all serial port OS names.
*
* @param status status check
* @return vector of serial port OS names
* @param[out] status status check
* @return vector of serial port OS names
*/
std::vector<std::string> GetOSSerialPortList(int32_t* status);

View File

@@ -58,9 +58,9 @@ int32_t ComputeDigitalMask(HAL_DigitalHandle handle, int32_t* status);
* functions on the Proxy object passed as a parameter can deadlock your
* program.
*
* @param handle the HAL digital handle of the pin to toggle.
* @param status status check
* @param func A functor taking a ref to a DIOSetProxy object.
* @param[in] handle the HAL digital handle of the pin to toggle.
* @param[out] status status check
* @param[in] func A functor taking a ref to a DIOSetProxy object.
*/
template <typename Functor>
void UnsafeManipulateDIO(HAL_DigitalHandle handle, int32_t* status,

View File

@@ -76,7 +76,7 @@ enum class HAL_HandleEnum {
* Get the handle index from a handle.
*
* @param handle the handle
* @return the index
* @return the index
*/
static inline int16_t getHandleIndex(HAL_Handle handle) {
// mask and return last 16 bits
@@ -87,7 +87,7 @@ static inline int16_t getHandleIndex(HAL_Handle handle) {
* Get the handle type from a handle.
*
* @param handle the handle
* @return the type
* @return the type
*/
static inline HAL_HandleEnum getHandleType(HAL_Handle handle) {
// mask first 8 bits and cast to enum
@@ -99,7 +99,7 @@ static inline HAL_HandleEnum getHandleType(HAL_Handle handle) {
*
* @param handle the handle
* @param handleType the type to check
* @return true if the type is correct, otherwise false
* @return true if the type is correct, otherwise false
*/
static inline bool isHandleType(HAL_Handle handle, HAL_HandleEnum handleType) {
return handleType == getHandleType(handle);
@@ -112,7 +112,7 @@ static inline bool isHandleType(HAL_Handle handle, HAL_HandleEnum handleType) {
*
* @param handle the handle
* @param version the handle version to check
* @return true if the handle is the right version, otherwise false
* @return true if the handle is the right version, otherwise false
*/
static inline bool isHandleCorrectVersion(HAL_Handle handle, int16_t version) {
return (((handle & 0xFF0000) >> 16) & version) == version;
@@ -124,10 +124,10 @@ static inline bool isHandleCorrectVersion(HAL_Handle handle, int16_t version) {
* Note the version is not checked on the roboRIO.
*
* @param handle the handle
* @param handleType the type to check
* @param enumType the type to check
* @param version the handle version to check
* @return true if the handle is proper version and type, otherwise
* false.
* @return true if the handle is proper version and type, otherwise
* false.
*/
inline int16_t getHandleTypedIndex(HAL_Handle handle, HAL_HandleEnum enumType,
int16_t version) {
@@ -156,7 +156,7 @@ inline int16_t getHandleTypedIndex(HAL_Handle handle, HAL_HandleEnum enumType,
* Gets the port channel of a port handle.
*
* @param handle the port handle
* @return the port channel
* @return the port channel
*/
inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
@@ -170,7 +170,7 @@ inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
* Gets the port module of a port handle.
*
* @param handle the port handle
* @return the port module
* @return the port module
*/
inline int16_t getPortHandleModule(HAL_PortHandle handle) {
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
@@ -184,7 +184,7 @@ inline int16_t getPortHandleModule(HAL_PortHandle handle) {
* Gets the SPI channel of a port handle.
*
* @param handle the port handle
* @return the port SPI channel
* @return the port SPI channel
*/
inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
@@ -198,7 +198,7 @@ inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
*
* @param channel the channel
* @param module the module
* @return port handle for the module and channel
* @return port handle for the module and channel
*/
HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module);
@@ -206,7 +206,7 @@ HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module);
* Create a port handle for SPI.
*
* @param channel the SPI channel
* @return port handle for the channel
* @return port handle for the channel
*/
HAL_PortHandle createPortHandleForSPI(uint8_t channel);
@@ -218,7 +218,7 @@ HAL_PortHandle createPortHandleForSPI(uint8_t channel);
* @param index the index
* @param handleType the handle type
* @param version the handle version
* @return the created handle
* @return the created handle
*/
HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType,
int16_t version);

View File

@@ -280,10 +280,10 @@ uint64_t HAL_GetFPGATime(int32_t* status) {
return hal::GetFPGATime();
}
uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status) {
uint64_t HAL_ExpandFPGATime(uint32_t unexpandedLower, int32_t* status) {
// Capture the current FPGA time. This will give us the upper half of the
// clock.
uint64_t fpga_time = HAL_GetFPGATime(status);
uint64_t fpgaTime = HAL_GetFPGATime(status);
if (*status != 0) {
return 0;
}
@@ -293,15 +293,15 @@ uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status) {
// be.
// Break it into lower and upper portions.
uint32_t lower = fpga_time & 0xffffffffull;
uint64_t upper = (fpga_time >> 32) & 0xffffffff;
uint32_t lower = fpgaTime & 0xffffffffull;
uint64_t upper = (fpgaTime >> 32) & 0xffffffff;
// The time was sampled *before* the current time, so roll it back.
if (lower < unexpanded_lower) {
if (lower < unexpandedLower) {
--upper;
}
return (upper << 32) + static_cast<uint64_t>(unexpanded_lower);
return (upper << 32) + static_cast<uint64_t>(unexpandedLower);
}
HAL_Bool HAL_GetFPGAButton(int32_t* status) {