2014-06-12 18:07:45 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2017-08-23 22:06:13 -07:00
|
|
|
/* Copyright (c) 2014-2017 FIRST. All Rights Reserved. */
|
2014-06-12 18:07:45 -04:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
#include <memory>
|
2016-09-05 13:55:31 -07:00
|
|
|
#include <string>
|
2016-05-25 22:38:11 -07:00
|
|
|
|
2017-08-27 00:11:52 -07:00
|
|
|
#include <HAL/AnalogOutput.h>
|
|
|
|
|
|
2014-06-12 18:07:45 -04:00
|
|
|
#include "LiveWindow/LiveWindowSendable.h"
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "SensorBase.h"
|
2017-09-02 00:17:43 -07:00
|
|
|
#include "networktables/NetworkTableEntry.h"
|
2014-06-12 18:07:45 -04:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2014-06-12 18:07:45 -04:00
|
|
|
/**
|
|
|
|
|
* MXP analog output class.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
class AnalogOutput : public SensorBase, public LiveWindowSendable {
|
|
|
|
|
public:
|
2016-09-06 00:01:45 -07:00
|
|
|
explicit AnalogOutput(int channel);
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual ~AnalogOutput();
|
2014-06-12 18:07:45 -04:00
|
|
|
|
2016-11-20 07:25:03 -08:00
|
|
|
void SetVoltage(double voltage);
|
|
|
|
|
double GetVoltage() const;
|
2016-12-23 11:20:13 -08:00
|
|
|
int GetChannel();
|
2014-06-12 18:07:45 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
void UpdateTable() override;
|
|
|
|
|
void StartLiveWindowMode() override;
|
|
|
|
|
void StopLiveWindowMode() override;
|
|
|
|
|
std::string GetSmartDashboardType() const override;
|
2017-09-02 00:17:43 -07:00
|
|
|
void InitTable(std::shared_ptr<nt::NetworkTable> subTable) override;
|
2014-06-12 18:07:45 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
protected:
|
2016-09-06 00:01:45 -07:00
|
|
|
int m_channel;
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_AnalogOutputHandle m_port;
|
2014-06-12 18:07:45 -04:00
|
|
|
|
2017-09-02 00:17:43 -07:00
|
|
|
nt::NetworkTableEntry m_valueEntry;
|
2014-06-12 18:07:45 -04:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|