WPILibC++ 2023.4.3
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. More...
 
 ~DigitalInput () override
 
 DigitalInput (DigitalInput &&)=default
 
DigitalInputoperator= (DigitalInput &&)=default
 
bool Get () const
 Get the value from a digital input channel. More...
 
HAL_Handle GetPortHandleForRouting () const override
 
AnalogTriggerType GetAnalogTriggerTypeForRouting () const override
 
bool IsAnalogTrigger () const override
 Is source an AnalogTrigger. More...
 
int GetChannel () const override
 
void SetSimDevice (HAL_SimDeviceHandle device)
 Indicates this input is used by a simulated device. More...
 
void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::DigitalSource
 DigitalSource ()=default
 
 DigitalSource (DigitalSource &&)=default
 
DigitalSourceoperator= (DigitalSource &&)=default
 
virtual HAL_Handle GetPortHandleForRouting () const =0
 
virtual AnalogTriggerType GetAnalogTriggerTypeForRouting () const =0
 
virtual bool IsAnalogTrigger () const =0
 
virtual int GetChannel () const =0
 
- Public Member Functions inherited from wpi::Sendable
virtual ~Sendable ()=default
 
virtual void InitSendable (SendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from wpi::SendableHelper< DigitalInput >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 

Friends

class DigitalGlitchFilter
 

Additional Inherited Members

- Protected Member Functions inherited from wpi::SendableHelper< DigitalInput >
 SendableHelper ()=default
 
 ~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()

frc::DigitalInput::~DigitalInput ( )
override

◆ DigitalInput() [2/2]

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

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 Function Documentation

◆ DigitalGlitchFilter

friend class DigitalGlitchFilter
friend

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