Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2008-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 <stdint.h> |
| 11 | |
| 12 | #include "Base.h" |
| 13 | #include "ErrorBase.h" |
| 14 | |
| 15 | namespace frc { |
| 16 | |
| 17 | /** |
| 18 | * Base class for all sensors. |
| 19 | * Stores most recent status information as well as containing utility functions |
| 20 | * for checking channels and error processing. |
| 21 | */ |
| 22 | class SensorBase : public ErrorBase { |
| 23 | public: |
| 24 | SensorBase() = default; |
| 25 | virtual ~SensorBase() = default; |
| 26 | |
| 27 | SensorBase(const SensorBase&) = delete; |
| 28 | SensorBase& operator=(const SensorBase&) = delete; |
| 29 | |
| 30 | static int GetDefaultSolenoidModule() { return 0; } |
| 31 | |
| 32 | static bool CheckSolenoidModule(int moduleNumber); |
| 33 | static bool CheckDigitalChannel(int channel); |
| 34 | static bool CheckRelayChannel(int channel); |
| 35 | static bool CheckPWMChannel(int channel); |
| 36 | static bool CheckAnalogInputChannel(int channel); |
| 37 | static bool CheckAnalogOutputChannel(int channel); |
| 38 | static bool CheckSolenoidChannel(int channel); |
| 39 | static bool CheckPDPChannel(int channel); |
| 40 | |
| 41 | static const int kDigitalChannels; |
| 42 | static const int kAnalogInputs; |
| 43 | static const int kAnalogOutputs; |
| 44 | static const int kSolenoidChannels; |
| 45 | static const int kSolenoidModules; |
| 46 | static const int kPwmChannels; |
| 47 | static const int kRelayChannels; |
| 48 | static const int kPDPChannels; |
| 49 | }; |
| 50 | |
| 51 | } // namespace frc |