blob: c358ce1242b4c9b6d566122e8bad4eacf5a4d689 [file] [log] [blame]
Parker Schuhd3b7a8872018-02-19 16:42:27 -08001/*----------------------------------------------------------------------------*/
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 Schuhf6b94632019-02-02 22:11:27 -080013#include "hal/Types.h"
Parker Schuhd3b7a8872018-02-19 16:42:27 -080014#include "frc971/wpilib/ahal/SensorBase.h"
15
16namespace frc {
17
18/**
19 * PCM compressor
20 */
21class 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