diff --git a/wpilibc/src/main/native/include/frc/AsynchronousInterrupt.h b/wpilibc/src/main/native/include/frc/AsynchronousInterrupt.h index f550fea55a..4531dfdba2 100644 --- a/wpilibc/src/main/native/include/frc/AsynchronousInterrupt.h +++ b/wpilibc/src/main/native/include/frc/AsynchronousInterrupt.h @@ -16,7 +16,7 @@ namespace frc { /** - * Class for handling asynchronous interrupts. + * Class for handling asynchronous interrupts using a callback thread. * *
By default, interrupts will occur on rising edge. Callbacks are disabled * by default, and Enable() must be called before they will occur. @@ -24,7 +24,8 @@ namespace frc { *
Both rising and falling edges can be indicated in one callback if both a * rising and falling edge occurred since the previous callback. * - *
Synchronous interrupts are handled by the SynchronousInterrupt class. + *
Synchronous (blocking) interrupts are handled by the SynchronousInterrupt + * class. */ class AsynchronousInterrupt { public: @@ -33,7 +34,12 @@ class AsynchronousInterrupt { * *
At construction, the interrupt will trigger on the rising edge. * - *
The first bool in the callback is rising, the second is falling. + *
The first bool in the callback indicates the rising edge triggered the
+ * interrupt, the second bool is falling edge.
+ *
+ * @param source the DigitalSource the interrupts are triggered from
+ * @param callback the callback function to call when the interrupt is
+ * triggered
*/
AsynchronousInterrupt(DigitalSource& source,
std::function At construction, the interrupt will trigger on the rising edge.
*
- * The first bool in the callback is rising, the 2nd is falling.
+ * The first bool in the callback indicates the rising edge triggered the
+ * interrupt, the second bool is falling edge.
+ *
+ * @param source the DigitalSource the interrupts are triggered from
+ * @param callback the callback function to call when the interrupt is
+ * triggered
*/
AsynchronousInterrupt(DigitalSource* source,
std::function At construction, the interrupt will trigger on the rising edge.
*
- * The first bool in the callback is rising, the 2nd is falling.
+ * The first bool in the callback indicates the rising edge triggered the
+ * interrupt, the second bool is falling edge.
+ *
+ * @param source the DigitalSource the interrupts are triggered from
+ * @param callback the callback function to call when the interrupt is
+ * triggered
*/
AsynchronousInterrupt(std::shared_ptr At construction, the interrupt will trigger on the rising edge.
*
- * The first bool in the callback is rising, the 2nd is falling.
+ * @param source the DigitalSource the interrupts are triggered from
+ * @param f the callback function to call when the interrupt is triggered
+ * @param arg the first argument, interrupt was triggered on rising edge
+ * @param args the remaing arguments, interrupt was triggered on falling edge
*/
template At construction, the interrupt will trigger on the rising edge.
*
- * The first bool in the callback is rising, the 2nd is falling.
+ * @param source the DigitalSource the interrupts are triggered from
+ * @param f the callback function to call when the interrupt is triggered
+ * @param arg the first argument, interrupt was triggered on rising edge
+ * @param args the remaing arguments, interrupt was triggered on falling edge
*/
template At construction, the interrupt will trigger on the rising edge.
*
- * The first bool in the callback is rising, the 2nd is falling.
+ * @param source the DigitalSource the interrupts are triggered from
+ * @param f the callback function to call when the interrupt is triggered
+ * @param arg the first argument, interrupt was triggered on rising edge
+ * @param args the remaing arguments, interrupt was triggered on falling edge
*/
template This function does not require the interrupt to be enabled to work.
*
* This only works if rising edge was configured using SetInterruptEdges.
- * @return the timestamp in seconds relative to getFPGATime
+ * @return the timestamp in seconds relative to GetFPGATime
*/
units::second_t GetRisingTimestamp();
@@ -137,7 +162,7 @@ class AsynchronousInterrupt {
* This function does not require the interrupt to be enabled to work.
*
* This only works if falling edge was configured using SetInterruptEdges.
- * @return the timestamp in seconds relative to getFPGATime
+ * @return the timestamp in seconds relative to GetFPGATime
*/
units::second_t GetFallingTimestamp();
diff --git a/wpilibc/src/main/native/include/frc/SynchronousInterrupt.h b/wpilibc/src/main/native/include/frc/SynchronousInterrupt.h
index b7acd719b6..03cc4f8705 100644
--- a/wpilibc/src/main/native/include/frc/SynchronousInterrupt.h
+++ b/wpilibc/src/main/native/include/frc/SynchronousInterrupt.h
@@ -13,7 +13,7 @@ namespace frc {
class DigitalSource;
/**
- * Class for handling ssynchronous interrupts.
+ * Class for handling synchronous (blocking) interrupts.
*
* By default, interrupts will occur on rising edge.
*
@@ -30,16 +30,22 @@ class SynchronousInterrupt {
/**
* Construct a Synchronous Interrupt from a Digital Source.
+ *
+ * @param source the DigitalSource the interrupts are triggered from
*/
explicit SynchronousInterrupt(DigitalSource& source);
/**
* Construct a Synchronous Interrupt from a Digital Source.
+ *
+ * @param source the DigitalSource the interrupts are triggered from
*/
explicit SynchronousInterrupt(DigitalSource* source);
/**
* Construct a Synchronous Interrupt from a Digital Source.
+ *
+ * @param source the DigitalSource the interrupts are triggered from
*/
explicit SynchronousInterrupt(std::shared_ptr By default, interrupts will occur on rising edge. Callbacks are disabled by default, and
* enable() must be called before they will occur.
@@ -18,7 +18,7 @@ import java.util.function.BiConsumer;
* Both rising and falling edges can be indicated in one callback if both a rising and falling
* edge occurred since the previous callback.
*
- * Synchronous interrupts are handled by the SynchronousInterrupt class.
+ * Synchronous (blocking) interrupts are handled by the SynchronousInterrupt class.
*/
public class AsynchronousInterrupt implements AutoCloseable {
private final BiConsumer Callbacks will not be triggered until enable() is called.
*
+ * The first bool in the callback indicates the rising edge triggered the interrupt, the second
+ * bool is falling edge.
+ *
* @param source The digital source to use.
* @param callback The callback to call on an interrupt
*/
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SynchronousInterrupt.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SynchronousInterrupt.java
index 0477e9ec52..1e7a54de7c 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SynchronousInterrupt.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SynchronousInterrupt.java
@@ -9,7 +9,7 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.hal.InterruptJNI;
/**
- * Class for handling sychronous interrupts.
+ * Class for handling synchronous (blocking) interrupts.
*
* By default, interrupts will occur on rising edge.
*
@@ -36,11 +36,11 @@ public class SynchronousInterrupt implements AutoCloseable {
}
/**
- * Create a wait result.
+ * Create a wait result enum.
*
- * @param rising True if a rising edge occured.
- * @param falling True if a falling edge occured.
- * @return A wait result.
+ * @param rising True if a rising edge occurred.
+ * @param falling True if a falling edge occurred.
+ * @return A wait result enum.
*/
public static WaitResult getValue(boolean rising, boolean falling) {
if (rising && falling) {
@@ -83,11 +83,11 @@ public class SynchronousInterrupt implements AutoCloseable {
/**
* Wait for interrupt that returns the raw result value from the hardware.
*
- * Used by AsynchronousInterrupt. Users prefer to use waitForInterrupt.
+ * Used by AsynchronousInterrupt. Users should use waitForInterrupt.
*
* @param timeoutSeconds The timeout in seconds. 0 or less will return immediately.
- * @param ignorePrevious True to ignore if a previous interrupt has occured, and only wait for a
- * new trigger. False will consider if an interrupt has occured since the last time the
+ * @param ignorePrevious True to ignore if a previous interrupt has occurred, and only wait for a
+ * new trigger. False will consider if an interrupt has occurred since the last time the
* interrupt was read.
* @return The raw hardware interrupt result
*/
@@ -99,10 +99,10 @@ public class SynchronousInterrupt implements AutoCloseable {
* Wait for an interrupt.
*
* @param timeoutSeconds The timeout in seconds. 0 or less will return immediately.
- * @param ignorePrevious True to ignore if a previous interrupt has occured, and only wait for a
- * new trigger. False will consider if an interrupt has occured since the last time the
+ * @param ignorePrevious True to ignore if a previous interrupt has occurred, and only wait for a
+ * new trigger. False will consider if an interrupt has occurred since the last time the
* interrupt was read.
- * @return Result of which edges were triggered, or if an timeout occured.
+ * @return Result of which edges were triggered, or if an timeout occurred.
*/
public WaitResult waitForInterrupt(double timeoutSeconds, boolean ignorePrevious) {
int result = InterruptJNI.waitForInterrupt(m_handle, timeoutSeconds, ignorePrevious);
@@ -117,10 +117,10 @@ public class SynchronousInterrupt implements AutoCloseable {
}
/**
- * Wait for an interrupt, ingoring any previously occuring interrupts.
+ * Wait for an interrupt, ignoring any previously occurring interrupts.
*
* @param timeoutSeconds The timeout in seconds. 0 or less will return immediately.
- * @return Result of which edges were triggered, or if an timeout occured.
+ * @return Result of which edges were triggered, or if an timeout occurred.
*/
public WaitResult waitForInterrupt(double timeoutSeconds) {
return waitForInterrupt(timeoutSeconds, true);