WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
AnalogOutput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2014-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 "HAL/AnalogOutput.h"
16 #include "LiveWindow/LiveWindowSendable.h"
17 #include "SensorBase.h"
18 
19 namespace frc {
20 
24 class AnalogOutput : public SensorBase, public LiveWindowSendable {
25  public:
26  explicit AnalogOutput(int channel);
27  virtual ~AnalogOutput();
28 
29  void SetVoltage(double voltage);
30  double GetVoltage() const;
31 
32  void UpdateTable() override;
33  void StartLiveWindowMode() override;
34  void StopLiveWindowMode() override;
35  std::string GetSmartDashboardType() const override;
36  void InitTable(std::shared_ptr<ITable> subTable) override;
37  std::shared_ptr<ITable> GetTable() const override;
38 
39  protected:
40  int m_channel;
41  HAL_AnalogOutputHandle m_port;
42 
43  std::shared_ptr<ITable> m_table;
44 };
45 
46 } // namespace frc
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:17
Base class for all sensors.
Definition: SensorBase.h:22
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: AnalogOutput.cpp:88
std::string GetSmartDashboardType() const override
Definition: AnalogOutput.cpp:98
virtual ~AnalogOutput()
Destructor.
Definition: AnalogOutput.cpp:60
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: AnalogOutput.cpp:94
double GetVoltage() const
Get the voltage of the analog output.
Definition: AnalogOutput.cpp:79
AnalogOutput(int channel)
Construct an analog output on the given channel.
Definition: AnalogOutput.cpp:27
void InitTable(std::shared_ptr< ITable > subTable) override
Initializes a table for this sendable object.
Definition: AnalogOutput.cpp:102
MXP analog output class.
Definition: AnalogOutput.h:24
std::shared_ptr< ITable > GetTable() const override
Definition: AnalogOutput.cpp:107
void SetVoltage(double voltage)
Set the value of the analog output.
Definition: AnalogOutput.cpp:67
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: AnalogOutput.cpp:96