WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
DigitalInput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2016. 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 <stdint.h>
11 
12 #include <memory>
13 #include <string>
14 
15 #include "DigitalSource.h"
16 #include "LiveWindow/LiveWindowSendable.h"
17 
18 namespace frc {
19 
21 
31  public:
32  explicit DigitalInput(int channel);
33  virtual ~DigitalInput();
34  bool Get() const;
35  int GetChannel() const override;
36 
37  // Digital Source Interface
38  HAL_Handle GetPortHandleForRouting() const override;
39  AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
40  bool IsAnalogTrigger() const override;
41 
42  void UpdateTable();
43  void StartLiveWindowMode();
44  void StopLiveWindowMode();
45  std::string GetSmartDashboardType() const;
46  void InitTable(std::shared_ptr<ITable> subTable);
47  std::shared_ptr<ITable> GetTable() const;
48 
49  private:
50  int m_channel;
51  HAL_DigitalHandle m_handle;
52 
53  std::shared_ptr<ITable> m_table;
54  friend class DigitalGlitchFilter;
55 };
56 
57 } // namespace frc
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: DigitalInput.cpp:111
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:84
Class to enable glitch filtering on a set of digital inputs.
Definition: DigitalGlitchFilter.h:26
std::string GetSmartDashboardType() const
Definition: DigitalInput.cpp:113
bool Get() const
Get the value from a digital input channel.
Definition: DigitalInput.cpp:73
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: DigitalInput.cpp:109
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: DigitalInput.cpp:103
HAL_Handle GetPortHandleForRouting() const override
Definition: DigitalInput.cpp:89
std::shared_ptr< ITable > GetTable() const
Definition: DigitalInput.cpp:122
DigitalInput(int channel)
Create an instance of a Digital Input class.
Definition: DigitalInput.cpp:28
virtual ~DigitalInput()
Free resources associated with the Digital Input class.
Definition: DigitalInput.cpp:56
DigitalSource Interface.
Definition: DigitalSource.h:25
void InitTable(std::shared_ptr< ITable > subTable)
Initializes a table for this sendable object.
Definition: DigitalInput.cpp:117
bool IsAnalogTrigger() const override
Is source an AnalogTrigger.
Definition: DigitalInput.cpp:94
Class to read a digital input.
Definition: DigitalInput.h:30
AnalogTriggerType GetAnalogTriggerTypeForRouting() const override
Definition: DigitalInput.cpp:99