WPILibC++  unspecified
SensorBase.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2017 FIRST. 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 "Base.h"
11 #include "ErrorBase.h"
12 
13 namespace frc {
14 
20 class SensorBase : public ErrorBase {
21  public:
22  SensorBase() = default;
23  virtual ~SensorBase() = default;
24 
25  SensorBase(const SensorBase&) = delete;
26  SensorBase& operator=(const SensorBase&) = delete;
27 
28  static int GetDefaultSolenoidModule() { return 0; }
29 
30  static bool CheckSolenoidModule(int moduleNumber);
31  static bool CheckDigitalChannel(int channel);
32  static bool CheckRelayChannel(int channel);
33  static bool CheckPWMChannel(int channel);
34  static bool CheckAnalogInputChannel(int channel);
35  static bool CheckAnalogOutputChannel(int channel);
36  static bool CheckSolenoidChannel(int channel);
37  static bool CheckPDPChannel(int channel);
38 
39  static const int kDigitalChannels;
40  static const int kAnalogInputs;
41  static const int kAnalogOutputs;
42  static const int kSolenoidChannels;
43  static const int kSolenoidModules;
44  static const int kPwmChannels;
45  static const int kRelayChannels;
46  static const int kPDPChannels;
47 };
48 
49 } // namespace frc
Definition: Timer.cpp:18
static bool CheckRelayChannel(int channel)
Check that the relay channel number is valid.
Definition: SensorBase.cpp:61
Base class for all sensors.
Definition: SensorBase.h:20
static bool CheckAnalogInputChannel(int channel)
Check that the analog input number is value.
Definition: SensorBase.cpp:85
static bool CheckSolenoidChannel(int channel)
Verify that the solenoid channel number is within limits.
Definition: SensorBase.cpp:106
static bool CheckSolenoidModule(int moduleNumber)
Check that the solenoid module number is valid.
Definition: SensorBase.cpp:37
static bool CheckDigitalChannel(int channel)
Check that the digital channel number is valid.
Definition: SensorBase.cpp:49
static bool CheckPDPChannel(int channel)
Verify that the power distribution channel number is within limits.
Definition: SensorBase.cpp:115
Base class for most objects.
Definition: ErrorBase.h:74
static bool CheckAnalogOutputChannel(int channel)
Check that the analog output number is valid.
Definition: SensorBase.cpp:97
static bool CheckPWMChannel(int channel)
Check that the digital channel number is valid.
Definition: SensorBase.cpp:73