WPILibC++  2020.3.2
AnalogOutput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2014-2019 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 <hal/Types.h>
11 
12 #include "frc/ErrorBase.h"
13 #include "frc/smartdashboard/Sendable.h"
14 #include "frc/smartdashboard/SendableHelper.h"
15 
16 namespace frc {
17 
18 class SendableBuilder;
19 
23 class AnalogOutput : public ErrorBase,
24  public Sendable,
25  public SendableHelper<AnalogOutput> {
26  public:
34  explicit AnalogOutput(int channel);
35 
36  ~AnalogOutput() override;
37 
38  AnalogOutput(AnalogOutput&&) = default;
39  AnalogOutput& operator=(AnalogOutput&&) = default;
40 
46  void SetVoltage(double voltage);
47 
53  double GetVoltage() const;
54 
58  int GetChannel();
59 
60  void InitSendable(SendableBuilder& builder) override;
61 
62  protected:
63  int m_channel;
64  hal::Handle<HAL_AnalogOutputHandle> m_port;
65 };
66 
67 } // namespace frc
frc::AnalogOutput::SetVoltage
void SetVoltage(double voltage)
Set the value of the analog output.
frc::AnalogOutput
MXP analog output class.
Definition: AnalogOutput.h:23
frc::AnalogOutput::AnalogOutput
AnalogOutput(int channel)
Construct an analog output on the given channel.
frc::AnalogOutput::GetVoltage
double GetVoltage() const
Get the voltage of the analog output.
frc::ErrorBase
Base class for most objects.
Definition: ErrorBase.h:104
frc::AnalogOutput::InitSendable
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
frc::Sendable
Interface for Sendable objects.
Definition: Sendable.h:17
frc
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
frc::AnalogOutput::GetChannel
int GetChannel()
Get the channel of this AnalogOutput.
frc::SendableHelper
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28
frc::SendableBuilder
Definition: SendableBuilder.h:23