RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
org.wpilib.event.BooleanEvent Class Reference
Inheritance diagram for org.wpilib.event.BooleanEvent:

Public Member Functions

 BooleanEvent (EventLoop loop, BooleanSupplier signal)
final boolean getAsBoolean ()
final void ifHigh (Runnable action)
BooleanEvent negate ()
BooleanEvent and (BooleanSupplier other)
BooleanEvent or (BooleanSupplier other)
BooleanEvent rising ()
BooleanEvent falling ()
BooleanEvent debounce (Time period)
BooleanEvent debounce (double seconds)
BooleanEvent debounce (Time period, Debouncer.DebounceType type)
BooleanEvent debounce (double seconds, Debouncer.DebounceType type)

Protected Attributes

final EventLoop m_loop

Detailed Description

This class provides an easy way to link actions to active high logic signals. Each object represents a digital signal to which callback actions can be bound using ifHigh(Runnable).

BooleanEvents can easily be composed for advanced functionality using and(BooleanSupplier), or(BooleanSupplier), and negate().

To get a new BooleanEvent that triggers when this one changes see falling() and rising().

Definition at line 27 of file BooleanEvent.java.

Constructor & Destructor Documentation

◆ BooleanEvent()

org.wpilib.event.BooleanEvent.BooleanEvent ( EventLoop loop,
BooleanSupplier signal )

Creates a new event that is active when the condition is true.

Parameters
loopthe loop that polls this event.
signalthe digital signal represented by this object.

Definition at line 42 of file BooleanEvent.java.

Member Function Documentation

◆ and()

BooleanEvent org.wpilib.event.BooleanEvent.and ( BooleanSupplier other)

Composes this event with another event, returning a new event that is active when both events are active.

The events must use the same event loop. If the events use different event loops, the composed signal won't update until both loops are polled.

Parameters
otherthe event to compose with.
Returns
the new event.

Definition at line 106 of file BooleanEvent.java.

◆ debounce() [1/4]

BooleanEvent org.wpilib.event.BooleanEvent.debounce ( double seconds)

Creates a new debounced event from this event - it will become active when this event has been active for longer than the specified period.

Parameters
secondsThe debounce period in seconds.
Returns
The debounced event (rising edges debounced only).

Definition at line 186 of file BooleanEvent.java.

◆ debounce() [2/4]

BooleanEvent org.wpilib.event.BooleanEvent.debounce ( double seconds,
Debouncer.DebounceType type )

Creates a new debounced event from this event - it will become active when this event has been active for longer than the specified period.

Parameters
secondsThe debounce period in seconds.
typeThe debounce type.
Returns
The debounced event.

Definition at line 210 of file BooleanEvent.java.

◆ debounce() [3/4]

BooleanEvent org.wpilib.event.BooleanEvent.debounce ( Time period)

Creates a new debounced event from this event - it will become active when this event has been active for longer than the specified period.

Parameters
periodThe debounce period.
Returns
The debounced event (rising edges debounced only).

Definition at line 175 of file BooleanEvent.java.

◆ debounce() [4/4]

BooleanEvent org.wpilib.event.BooleanEvent.debounce ( Time period,
Debouncer.DebounceType type )

Creates a new debounced event from this event - it will become active when this event has been active for longer than the specified period.

Parameters
periodThe debounce period.
typeThe debounce type.
Returns
The debounced event.

Definition at line 198 of file BooleanEvent.java.

◆ falling()

BooleanEvent org.wpilib.event.BooleanEvent.falling ( )

Creates a new event that triggers when this one changes from true to false.

Returns
the event.

Definition at line 152 of file BooleanEvent.java.

◆ getAsBoolean()

final boolean org.wpilib.event.BooleanEvent.getAsBoolean ( )

Returns the state of this signal (high or low) as of the last loop poll.

Returns
true for the high state, false for the low state. If the event was never polled, it returns the state at event construction.

Definition at line 56 of file BooleanEvent.java.

◆ ifHigh()

final void org.wpilib.event.BooleanEvent.ifHigh ( Runnable action)

Bind an action to this event.

Parameters
actionthe action to run if this event is active.

Definition at line 65 of file BooleanEvent.java.

◆ negate()

BooleanEvent org.wpilib.event.BooleanEvent.negate ( )

Creates a new event that is active when this event is inactive.

Returns
the new event.

Definition at line 92 of file BooleanEvent.java.

◆ or()

BooleanEvent org.wpilib.event.BooleanEvent.or ( BooleanSupplier other)

Composes this event with another event, returning a new event that is active when either event is active.

The events must use the same event loop. If the events use different event loops, the composed signal won't update until both loops are polled.

Parameters
otherthe event to compose with.
Returns
the new event.

Definition at line 121 of file BooleanEvent.java.

◆ rising()

BooleanEvent org.wpilib.event.BooleanEvent.rising ( )

Creates a new event that triggers when this one changes from false to true.

Returns
the new event.

Definition at line 131 of file BooleanEvent.java.

Member Data Documentation

◆ m_loop

final EventLoop org.wpilib.event.BooleanEvent.m_loop
protected

Poller loop.

Definition at line 29 of file BooleanEvent.java.


The documentation for this class was generated from the following file: