WPILibC++  unspecified
DigitalInput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2017 FIRST. 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 #include "networktables/NetworkTableEntry.h"
16 
17 namespace frc {
18 
20 
30  public:
31  explicit DigitalInput(int channel);
32  virtual ~DigitalInput();
33  bool Get() const;
34  int GetChannel() const override;
35 
36  // Digital Source Interface
37  HAL_Handle GetPortHandleForRouting() const override;
38  AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
39  bool IsAnalogTrigger() const override;
40 
41  void UpdateTable() override;
42  void StartLiveWindowMode() override;
43  void StopLiveWindowMode() override;
44  std::string GetSmartDashboardType() const override;
45  void InitTable(std::shared_ptr<nt::NetworkTable> subTable) override;
46 
47  private:
48  int m_channel;
49  HAL_DigitalHandle m_handle;
50 
51  nt::NetworkTableEntry m_valueEntry;
52  friend class DigitalGlitchFilter;
53 };
54 
55 } // namespace frc
Definition: Timer.cpp:18
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:87
Class to enable glitch filtering on a set of digital inputs.
Definition: DigitalGlitchFilter.h:28
bool Get() const
Get the value from a digital input channel.
Definition: DigitalInput.cpp:76
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: DigitalInput.cpp:110
HAL_Handle GetPortHandleForRouting() const override
Definition: DigitalInput.cpp:92
DigitalInput(int channel)
Create an instance of a Digital Input class.
Definition: DigitalInput.cpp:30
virtual ~DigitalInput()
Free resources associated with the Digital Input class.
Definition: DigitalInput.cpp:59
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: DigitalInput.cpp:112
DigitalSource Interface.
Definition: DigitalSource.h:26
void InitTable(std::shared_ptr< nt::NetworkTable > subTable) override
Initializes a table for this sendable object.
Definition: DigitalInput.cpp:118
std::string GetSmartDashboardType() const override
Definition: DigitalInput.cpp:114
bool IsAnalogTrigger() const override
Is source an AnalogTrigger.
Definition: DigitalInput.cpp:97
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: DigitalInput.cpp:106
NetworkTables Entry.
Definition: NetworkTableEntry.h:30
Class to read a digital input.
Definition: DigitalInput.h:29
AnalogTriggerType GetAnalogTriggerTypeForRouting() const override
Definition: DigitalInput.cpp:102