Parker Schuh | d3b7a887 | 2018-02-19 16:42:27 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2014-2017. 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 <memory> |
| 11 | #include <string> |
| 12 | |
Austin Schuh | f6b9463 | 2019-02-02 22:11:27 -0800 | [diff] [blame] | 13 | #include "hal/Types.h" |
Parker Schuh | d3b7a887 | 2018-02-19 16:42:27 -0800 | [diff] [blame] | 14 | #include "frc971/wpilib/ahal/SensorBase.h" |
| 15 | |
| 16 | namespace frc { |
| 17 | |
| 18 | /** |
| 19 | * PCM compressor |
| 20 | */ |
| 21 | class Compressor { |
| 22 | public: |
| 23 | // Default PCM ID is 0 |
| 24 | explicit Compressor(int pcmID = GetDefaultSolenoidModule()); |
| 25 | virtual ~Compressor() = default; |
| 26 | |
| 27 | void Start(); |
| 28 | void Stop(); |
| 29 | bool Enabled() const; |
| 30 | |
| 31 | bool GetPressureSwitchValue() const; |
| 32 | |
| 33 | double GetCompressorCurrent() const; |
| 34 | |
| 35 | void SetClosedLoopControl(bool on); |
| 36 | bool GetClosedLoopControl() const; |
| 37 | |
| 38 | bool GetCompressorCurrentTooHighFault() const; |
| 39 | bool GetCompressorCurrentTooHighStickyFault() const; |
| 40 | bool GetCompressorShortedStickyFault() const; |
| 41 | bool GetCompressorShortedFault() const; |
| 42 | bool GetCompressorNotConnectedStickyFault() const; |
| 43 | bool GetCompressorNotConnectedFault() const; |
| 44 | void ClearAllPCMStickyFaults(); |
| 45 | |
| 46 | protected: |
| 47 | HAL_CompressorHandle m_compressorHandle; |
| 48 | |
| 49 | private: |
| 50 | void SetCompressor(bool on); |
| 51 | int m_module; |
| 52 | }; |
| 53 | |
| 54 | } // namespace frc |