[hal] Add javadocs for JNI (NFC) (#5298)

Docs are copied from the HAL and add references to the HAL files/methods
to aid discoverability.
This commit is contained in:
sciencewhiz
2023-06-19 23:36:56 -07:00
committed by GitHub
parent 1c20c69793
commit f4dda4bac0
45 changed files with 3685 additions and 65 deletions

View File

@@ -21,7 +21,7 @@ extern "C" {
/**
* Initializes an analog gyro.
*
* @param[in] handle handle to the analog port
* @param[in] handle handle to the analog input port
* @param[in] allocationLocation the location where the allocation is occurring
* (can be null)
* @param[out] status the error code, or 0 for success
@@ -43,7 +43,7 @@ void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status);
/**
* Frees an analog gyro.
*
* @param handle the gyro handle
* @param[in,out] handle the gyro handle
*/
void HAL_FreeAnalogGyro(HAL_GyroHandle handle);

View File

@@ -33,14 +33,14 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
/**
* Frees an analog input port.
*
* @param analogPortHandle Handle to the analog port.
* @param[in,out] analogPortHandle Handle to the analog port.
*/
void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle);
/**
* Checks that the analog module number is valid.
*
* @param module The analog module number.
* @param[in] module The analog module number.
* @return Analog module is valid and present
*/
HAL_Bool HAL_CheckAnalogModule(int32_t module);
@@ -50,7 +50,7 @@ HAL_Bool HAL_CheckAnalogModule(int32_t module);
* Verifies that the analog channel number is one of the legal channel numbers.
* Channel numbers are 0-based.
*
* @param channel The analog output channel number.
* @param[in] channel The analog output channel number.
* @return Analog channel is valid
*/
HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel);

View File

@@ -45,6 +45,7 @@ HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger(
*
* @param[in] dutyCycleHandle the analog input to use for duty cycle
* @param[out] status Error status variable. 0 on success.
* @return tbe created analog trigger handle
*/
HAL_AnalogTriggerHandle HAL_InitializeAnalogTriggerDutyCycle(
HAL_DutyCycleHandle dutyCycleHandle, int32_t* status);

View File

@@ -47,7 +47,7 @@ HAL_CANHandle HAL_InitializeCAN(HAL_CANManufacturer manufacturer,
/**
* Frees a CAN device
*
* @param handle the CAN handle
* @param[in,out] handle the CAN handle
*/
void HAL_CleanCAN(HAL_CANHandle handle);

View File

@@ -154,6 +154,8 @@ HAL_Bool HAL_GetCTREPCMCompressorShortedFault(HAL_CTREPCMHandle handle,
* were last cleared. This fault is persistent and can be cleared by
* HAL_ClearAllCTREPCMStickyFaults()
*
* @param[in] handle the PCM handle
* @param[out] status Error status variable. 0 on success.
* @return True if the compressor has been disconnected since sticky faults
* were last cleared, otherwise false.
* @see HAL_GetCTREPCMCompressorShortedFault()
@@ -207,6 +209,8 @@ int32_t HAL_GetCTREPCMSolenoidDisabledList(HAL_CTREPCMHandle handle,
* were last cleared. This fault is persistent and can be cleared by
* HAL_ClearAllCTREPCMStickyFaults()
*
* @param[in] handle the PCM handle
* @param[out] status Error status variable. 0 on success.
* @return True if solenoid is reporting a fault, otherwise false.
* @see HAL_GetCTREPCMSolenoidVoltageFault()
*/
@@ -223,7 +227,12 @@ HAL_Bool HAL_GetCTREPCMSolenoidVoltageStickyFault(HAL_CTREPCMHandle handle,
HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault(HAL_CTREPCMHandle handle,
int32_t* status);
/** Clears all sticky faults on this device. */
/**
* Clears all sticky faults on this device.
*
* @param[in] handle the PCM handle
* @param[out] status Error status variable. 0 on success.
*/
void HAL_ClearAllCTREPCMStickyFaults(HAL_CTREPCMHandle handle, int32_t* status);
/**

View File

@@ -233,7 +233,7 @@ void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status);
*/
int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status);
/*
/**
* Gets the Period of the most recent count.
*
* Returns the time interval of the most recent count. This can be used for

View File

@@ -37,7 +37,7 @@ 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 valid, otherwise false
*/
HAL_Bool HAL_CheckDIOChannel(int32_t channel);
@@ -77,7 +77,7 @@ void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status);
*
* The valid range is from 0.6 Hz to 19 kHz.
*
* The frequency resolution is logarithmic.
* The frequency resolution is logarithmic.
*
* @param[in] rate the frequency to output all digital output PWM signals
* @param[out] status Error status variable. 0 on success.
@@ -227,7 +227,7 @@ int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status);
*
* Sets the filter period in FPGA cycles. Even though there are 2 different
* filter index domains (MXP vs HDR), ignore that distinction for now since it
* compilicates the interface. That can be changed later.
* complicates the interface. That can be changed later.
*
* @param[in] filterIndex the filter index, 0 - 2
* @param[in] value the number of cycles that the signal must not
@@ -242,10 +242,11 @@ void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status);
* Gets the filter period in FPGA cycles. Even though there are 2 different
* filter index domains (MXP vs HDR), ignore that distinction for now since it
* complicates the interface. Set status to NiFpga_Status_SoftwareFault if the
* filter values miss-match.
* filter values mismatch.
*
* @param[in] filterIndex the filter index, 0 - 2
* @param[out] status Error status variable. 0 on success.
* @return The number of FPGA cycles of the filter period.
*/
int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status);
#ifdef __cplusplus

View File

@@ -185,7 +185,7 @@ void HAL_AddDMAAveragedAnalogInput(HAL_DMAHandle handle,
int32_t* status);
/**
* Adds acuumulator data of an analog input to be collected by DMA.
* Adds accumulator data of an analog input to be collected by DMA.
*
* This can only be called if DMA is not started.
*

View File

@@ -32,6 +32,7 @@ extern "C" {
* @param callStack the callstack of the error
* @param printMsg true to print the error message to stdout as well as to the
* DS
* @return the error code, or 0 for success
*/
int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
const char* details, const char* location,
@@ -48,13 +49,14 @@ void HAL_SetPrintErrorImpl(void (*func)(const char* line, size_t size));
* Sends a line to the driver station console.
*
* @param line the line to send (null terminated)
* @return the error code, or 0 for success
*/
int32_t HAL_SendConsoleLine(const char* line);
/**
* Gets the current control word of the driver station.
*
* The control work contains the robot state.
* The control word contains the robot state.
*
* @param controlWord the control word (out)
* @return the error code, or 0 for success
@@ -117,7 +119,7 @@ int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
HAL_JoystickDescriptor* desc);
/**
* Gets is a specific joystick is considered to be an XBox controller.
* Gets whether a specific joystick is considered to be an XBox controller.
*
* @param joystickNum the joystick number
* @return true if xbox, false otherwise
@@ -198,6 +200,8 @@ double HAL_GetMatchTime(int32_t* status);
/**
* Gets if outputs are enabled by the control system.
*
* @return true if outputs are enabled
*/
HAL_Bool HAL_GetOutputsEnabled(void);
@@ -209,6 +213,11 @@ HAL_Bool HAL_GetOutputsEnabled(void);
*/
int32_t HAL_GetMatchInfo(HAL_MatchInfo* info);
/**
* Refresh the DS control word.
*
* @return true if updated
*/
HAL_Bool HAL_RefreshDSData(void);
void HAL_ProvideNewDataEventHandle(WPI_EventHandle handle);

View File

@@ -26,7 +26,7 @@ extern "C" {
* @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
* @return the created duty cycle handle
*/
HAL_DutyCycleHandle HAL_InitializeDutyCycle(HAL_Handle digitalSourceHandle,
HAL_AnalogTriggerType triggerType,

View File

@@ -83,7 +83,7 @@ void HAL_SetEncoderSimDevice(HAL_EncoderHandle handle,
/**
* Gets the current counts of the encoder after encoding type scaling.
*
* This is scaled by the value passed duing initialization to encodingType.
* This is scaled by the value passed during initialization to encodingType.
*
* @param[in] encoderHandle the encoder handle
* @param[out] status Error status variable. 0 on success.
@@ -125,7 +125,7 @@ int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoderHandle,
*/
void HAL_ResetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
/*
/**
* Gets the Period of the most recent count.
*
* Returns the time interval of the most recent count. This can be used for

View File

@@ -18,7 +18,7 @@
/**
* @defgroup hal_capi WPILib HAL API
* Hardware Abstraction Layer to hardware or simulator
* Hardware Abstraction Layer (HAL) to hardware or simulator
* @{
*/
@@ -75,9 +75,9 @@ int32_t HAL_GetFPGAVersion(int32_t* status);
int64_t HAL_GetFPGARevision(int32_t* status);
/**
* Returns the serial number.
* Returns the roboRIO serial number.
*
* @param[out] buffer The serial number.
* @param[out] buffer The roboRIO serial number.
* @param size The maximum characters to copy into buffer.
* @return Number of characters copied into buffer.
*/
@@ -108,7 +108,7 @@ HAL_RuntimeType HAL_GetRuntimeType(void);
HAL_Bool HAL_GetFPGAButton(int32_t* status);
/**
* Gets if the system outputs are currently active
* 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
@@ -173,7 +173,8 @@ uint64_t HAL_GetFPGATime(int32_t* status);
uint64_t HAL_ExpandFPGATime(uint32_t unexpandedLower, int32_t* status);
/**
* Gets the current state of the Robot Signal Light (RSL)
* Gets the current state of the Robot Signal Light (RSL).
*
* @param[out] status the error code, or 0 for success
* @return The current state of the RSL- true if on, false if off
*/

View File

@@ -63,7 +63,8 @@ void HAL_SetNotifierName(HAL_NotifierHandle notifierHandle, const char* name,
/**
* Stops a notifier from running.
*
* This will cause any call into HAL_WaitForNotifierAlarm to return.
* This will cause any call into HAL_WaitForNotifierAlarm to return with time =
* 0.
*
* @param[in] notifierHandle the notifier handle
* @param[out] status Error status variable. 0 on success.

View File

@@ -45,7 +45,7 @@ int32_t HAL_GetNumAnalogInputs(void);
int32_t HAL_GetNumAnalogOutputs(void);
/**
* Gets the number of analog counters in the current system.
* Gets the number of counters in the current system.
*
* @return the number of counters
*/

View File

@@ -134,7 +134,7 @@ double HAL_GetPowerDistributionChannelCurrent(
HAL_PowerDistributionHandle handle, int32_t channel, int32_t* status);
/**
* Gets the current of all 24 channels on the PowerDistribution.
* Gets the current of all channels on the PowerDistribution.
*
* The array must be large enough to hold all channels.
*
@@ -214,6 +214,7 @@ void HAL_SetPowerDistributionSwitchableChannel(
*
* @param[in] handle the module handle
* @param[out] status Error status variable. 0 on success.
* @return the state of the switchable channel
*/
HAL_Bool HAL_GetPowerDistributionSwitchableChannel(
HAL_PowerDistributionHandle handle, int32_t* status);
@@ -291,12 +292,34 @@ struct HAL_PowerDistributionStickyFaults {
uint32_t hasReset : 1;
};
/**
* Get the version of the PowerDistribution.
*
* @param[in] handle the module handle
* @param[out] version the HAL_PowerDistributionVersion to populate
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetPowerDistributionVersion(HAL_PowerDistributionHandle handle,
HAL_PowerDistributionVersion* version,
int32_t* status);
/**
* Get the current faults of the PowerDistribution.
*
* @param[in] handle the module handle
* @param[out] faults the HAL_PowerDistributionFaults to populate
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetPowerDistributionFaults(HAL_PowerDistributionHandle handle,
HAL_PowerDistributionFaults* faults,
int32_t* status);
/**
* Gets the sticky faults of the PowerDistribution.
*
* @param[in] handle the module handle
* @param[out] stickyFaults the HAL_PowerDistributionStickyFaults to populate
* @param[out] status Error status variable. 0 on success.
*/
void HAL_GetPowerDistributionStickyFaults(
HAL_PowerDistributionHandle handle,
HAL_PowerDistributionStickyFaults* stickyFaults, int32_t* status);

View File

@@ -316,7 +316,7 @@ void HAL_GetREVPHVersion(HAL_REVPHHandle handle, HAL_REVPHVersion* version,
int32_t HAL_GetREVPHSolenoids(HAL_REVPHHandle handle, int32_t* status);
/**
* Sets solenoids on a pneumatics module.
* Sets solenoids on a PH.
*
* @param[in] handle the PH handle
* @param[in] mask bitmask to set

View File

@@ -108,7 +108,7 @@ void HAL_SetSPIMode(HAL_SPIPort port, HAL_SPIMode mode);
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP
* @returns The SPI mode currently set
* @return The SPI mode currently set
*/
HAL_SPIMode HAL_GetSPIMode(HAL_SPIPort port);
@@ -172,7 +172,7 @@ void HAL_FreeSPIAuto(HAL_SPIPort port, int32_t* status);
*
* @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[in] period The accumulation period (seconds).
* @param[out] status the error code, or 0 for success
*/
void HAL_StartSPIAutoRate(HAL_SPIPort port, double period, int32_t* status);
@@ -199,7 +199,7 @@ void HAL_StartSPIAutoTrigger(HAL_SPIPort port, HAL_Handle digitalSourceHandle,
int32_t* status);
/**
* Stops an automatic SPI accumlation.
* Stops an automatic SPI accumulation.
*
* @param[in] port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
* for MXP.

View File

@@ -30,11 +30,12 @@ extern "C" {
/**
* Initializes a serial port.
*
* The channels are either the onboard RS232, the mxp uart, or 2 USB ports. The
* 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[in] port the serial port to initialize
* @param[out] status the error code, or 0 for success
* @return Serial Port Handle
*/
HAL_SerialPortHandle HAL_InitializeSerialPort(HAL_SerialPort port,
int32_t* status);
@@ -48,6 +49,7 @@ HAL_SerialPortHandle HAL_InitializeSerialPort(HAL_SerialPort port,
* @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
* @return Serial Port Handle
*/
HAL_SerialPortHandle HAL_InitializeSerialPortDirect(HAL_SerialPort port,
const char* portName,