WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
DigitalInput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <memory>
11 #include <string>
12 
13 #include "DigitalSource.h"
14 #include "LiveWindow/LiveWindowSendable.h"
15 
16 namespace frc {
17 
19 
29  public:
30  explicit DigitalInput(int channel);
31  virtual ~DigitalInput();
32  bool Get() const;
33  int GetChannel() const override;
34 
35  // Digital Source Interface
36  HAL_Handle GetPortHandleForRouting() const override;
37  AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
38  bool IsAnalogTrigger() const override;
39 
40  void UpdateTable();
41  void StartLiveWindowMode();
42  void StopLiveWindowMode();
43  std::string GetSmartDashboardType() const;
44  void InitTable(std::shared_ptr<ITable> subTable);
45  std::shared_ptr<ITable> GetTable() const;
46 
47  private:
48  int m_channel;
49  HAL_DigitalHandle m_handle;
50 
51  std::shared_ptr<ITable> m_table;
52  friend class DigitalGlitchFilter;
53 };
54 
55 } // namespace frc
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: DigitalInput.cpp:113
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:17
int GetChannel() const override
Definition: DigitalInput.cpp:86
Class to enable glitch filtering on a set of digital inputs.
Definition: DigitalGlitchFilter.h:28
std::string GetSmartDashboardType() const
Definition: DigitalInput.cpp:115
bool Get() const
Get the value from a digital input channel.
Definition: DigitalInput.cpp:75
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: DigitalInput.cpp:111
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: DigitalInput.cpp:105
HAL_Handle GetPortHandleForRouting() const override
Definition: DigitalInput.cpp:91
std::shared_ptr< ITable > GetTable() const
Definition: DigitalInput.cpp:124
DigitalInput(int channel)
Create an instance of a Digital Input class.
Definition: DigitalInput.cpp:29
virtual ~DigitalInput()
Free resources associated with the Digital Input class.
Definition: DigitalInput.cpp:58
DigitalSource Interface.
Definition: DigitalSource.h:25
void InitTable(std::shared_ptr< ITable > subTable)
Initializes a table for this sendable object.
Definition: DigitalInput.cpp:119
bool IsAnalogTrigger() const override
Is source an AnalogTrigger.
Definition: DigitalInput.cpp:96
Class to read a digital input.
Definition: DigitalInput.h:28
AnalogTriggerType GetAnalogTriggerTypeForRouting() const override
Definition: DigitalInput.cpp:101