Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 2 | /* Copyright (c) FIRST 2014-2016. All Rights Reserved. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 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/HAL.hpp" |
| 11 | #include "SensorBase.h" |
| 12 | #include "LiveWindow/LiveWindowSendable.h" |
| 13 | #include <memory> |
| 14 | #include <cstdint> |
| 15 | |
| 16 | /** |
| 17 | * MXP analog output class. |
| 18 | */ |
| 19 | class AnalogOutput : public SensorBase, public LiveWindowSendable { |
| 20 | public: |
| 21 | explicit AnalogOutput(uint32_t channel); |
| 22 | virtual ~AnalogOutput(); |
| 23 | |
| 24 | void SetVoltage(float voltage); |
| 25 | float GetVoltage() const; |
| 26 | |
| 27 | void UpdateTable() override; |
| 28 | void StartLiveWindowMode() override; |
| 29 | void StopLiveWindowMode() override; |
| 30 | std::string GetSmartDashboardType() const override; |
| 31 | void InitTable(std::shared_ptr<ITable> subTable) override; |
| 32 | std::shared_ptr<ITable> GetTable() const override; |
| 33 | |
| 34 | protected: |
| 35 | uint32_t m_channel; |
| 36 | void *m_port; |
| 37 | |
| 38 | std::shared_ptr<ITable> m_table; |
| 39 | }; |