WPILibC++  unspecified
SensorBase.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2018 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 <memory>
11 
12 #include "Base.h"
13 #include "ErrorBase.h"
14 #include "SmartDashboard/Sendable.h"
15 #include "SmartDashboard/SendableBase.h"
16 
17 namespace frc {
18 
25 class SensorBase : public ErrorBase, public SendableBase {
26  public:
27  SensorBase() = default;
28 
29  SensorBase(const SensorBase&) = delete;
30  SensorBase& operator=(const SensorBase&) = delete;
31 
32  static int GetDefaultSolenoidModule() { return 0; }
33 
34  static bool CheckSolenoidModule(int moduleNumber);
35  static bool CheckDigitalChannel(int channel);
36  static bool CheckRelayChannel(int channel);
37  static bool CheckPWMChannel(int channel);
38  static bool CheckAnalogInputChannel(int channel);
39  static bool CheckAnalogOutputChannel(int channel);
40  static bool CheckSolenoidChannel(int channel);
41  static bool CheckPDPChannel(int channel);
42 
43  static const int kDigitalChannels;
44  static const int kAnalogInputs;
45  static const int kAnalogOutputs;
46  static const int kSolenoidChannels;
47  static const int kSolenoidModules;
48  static const int kPwmChannels;
49  static const int kRelayChannels;
50  static const int kPDPChannels;
51 };
52 
53 } // namespace frc
Definition: RobotController.cpp:14
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:25
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
Definition: SendableBase.h:19
static bool CheckPWMChannel(int channel)
Check that the digital channel number is valid.
Definition: SensorBase.cpp:73