WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
frc::DigitalInput Class Reference

Class to read a digital input. More...

#include <frc/DigitalInput.h>

Inheritance diagram for frc::DigitalInput:
frc::DigitalSource wpi::Sendable wpi::SendableHelper< DigitalInput >

Public Member Functions

 DigitalInput (int channel)
 Create an instance of a Digital Input class.
 
 DigitalInput (DigitalInput &&)=default
 
DigitalInputoperator= (DigitalInput &&)=default
 
 ~DigitalInput () override=default
 
bool Get () const
 Get the value from a digital input channel.
 
HAL_Handle GetPortHandleForRouting () const override
 
AnalogTriggerType GetAnalogTriggerTypeForRouting () const override
 
bool IsAnalogTrigger () const override
 Is source an AnalogTrigger.
 
int GetChannel () const override
 
void SetSimDevice (HAL_SimDeviceHandle device)
 Indicates this input is used by a simulated device.
 
void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object.
 
- Public Member Functions inherited from frc::DigitalSource
 DigitalSource ()=default
 
 DigitalSource (DigitalSource &&)=default
 
DigitalSourceoperator= (DigitalSource &&)=default
 
- Public Member Functions inherited from wpi::Sendable
virtual constexpr ~Sendable ()=default
 
- Public Member Functions inherited from wpi::SendableHelper< DigitalInput >
constexpr SendableHelper (const SendableHelper &rhs)=default
 
constexpr SendableHelper (SendableHelper &&rhs)
 
constexpr SendableHelperoperator= (const SendableHelper &rhs)=default
 
constexpr SendableHelperoperator= (SendableHelper &&rhs)
 

Friends

class DigitalGlitchFilter
 

Additional Inherited Members

- Protected Member Functions inherited from wpi::SendableHelper< DigitalInput >
constexpr SendableHelper ()=default
 
constexpr ~SendableHelper ()
 

Detailed Description

Class to read a digital input.

This class will read digital inputs and return the current value on the channel. Other devices such as encoders, gear tooth sensors, etc. that are implemented elsewhere will automatically allocate digital inputs and outputs as required. This class is only for devices like switches etc. that aren't implemented anywhere else.

Constructor & Destructor Documentation

◆ DigitalInput() [1/2]

frc::DigitalInput::DigitalInput ( int channel)
explicit

Create an instance of a Digital Input class.

Creates a digital input given a channel.

Parameters
channelThe DIO channel 0-9 are on-board, 10-25 are on the MXP port

◆ DigitalInput() [2/2]

frc::DigitalInput::DigitalInput ( DigitalInput && )
default

◆ ~DigitalInput()

frc::DigitalInput::~DigitalInput ( )
overridedefault

Member Function Documentation

◆ Get()

bool frc::DigitalInput::Get ( ) const

Get the value from a digital input channel.

Retrieve the value of a single digital input channel from the FPGA.

◆ GetAnalogTriggerTypeForRouting()

AnalogTriggerType frc::DigitalInput::GetAnalogTriggerTypeForRouting ( ) const
overridevirtual
Returns
The type of analog trigger output to be used. 0 for Digitals

Implements frc::DigitalSource.

◆ GetChannel()

int frc::DigitalInput::GetChannel ( ) const
overridevirtual
Returns
The GPIO channel number that this object represents.

Implements frc::DigitalSource.

◆ GetPortHandleForRouting()

HAL_Handle frc::DigitalInput::GetPortHandleForRouting ( ) const
overridevirtual
Returns
The HAL Handle to the specified source.

Implements frc::DigitalSource.

◆ InitSendable()

void frc::DigitalInput::InitSendable ( wpi::SendableBuilder & builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::Sendable.

◆ IsAnalogTrigger()

bool frc::DigitalInput::IsAnalogTrigger ( ) const
overridevirtual

Is source an AnalogTrigger.

Implements frc::DigitalSource.

◆ operator=()

DigitalInput & frc::DigitalInput::operator= ( DigitalInput && )
default

◆ SetSimDevice()

void frc::DigitalInput::SetSimDevice ( HAL_SimDeviceHandle device)

Indicates this input is used by a simulated device.

Parameters
devicesimulated device handle

Friends And Related Symbol Documentation

◆ DigitalGlitchFilter

friend class DigitalGlitchFilter
friend

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