2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2013-12-15 18:30:16 -05:00
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Stores most recent status information as well as containing utility functions
|
2016-05-20 17:30:37 -07:00
|
|
|
* for checking channels and error processing.
|
2013-12-15 18:30:16 -05:00
|
|
|
*/
|
2018-05-23 20:22:30 -07:00
|
|
|
class SensorUtil final {
|
2015-06-25 15:07:55 -04:00
|
|
|
public:
|
2019-08-24 22:28:39 -07:00
|
|
|
SensorUtil() = delete;
|
|
|
|
|
|
2018-07-28 09:51:49 -07:00
|
|
|
/**
|
|
|
|
|
* Get the number of the default solenoid module.
|
|
|
|
|
*
|
|
|
|
|
* @return The number of the default solenoid module.
|
|
|
|
|
*/
|
2021-06-05 22:36:39 -07:00
|
|
|
static int GetDefaultCTREPCMModule();
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check that the digital channel number is valid.
|
|
|
|
|
*
|
|
|
|
|
* Verify that the channel number is one of the legal channel numbers. Channel
|
2018-07-28 09:51:49 -07:00
|
|
|
* numbers are 0-based.
|
2018-05-31 20:47:15 -07:00
|
|
|
*
|
|
|
|
|
* @return Digital channel is valid
|
|
|
|
|
*/
|
2016-07-20 22:47:29 -07:00
|
|
|
static bool CheckDigitalChannel(int channel);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check that the relay channel number is valid.
|
|
|
|
|
*
|
|
|
|
|
* Verify that the channel number is one of the legal channel numbers. Channel
|
|
|
|
|
* numbers are 0-based.
|
|
|
|
|
*
|
|
|
|
|
* @return Relay channel is valid
|
|
|
|
|
*/
|
2016-07-20 22:47:29 -07:00
|
|
|
static bool CheckRelayChannel(int channel);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check that the digital channel number is valid.
|
|
|
|
|
*
|
|
|
|
|
* Verify that the channel number is one of the legal channel numbers. Channel
|
2018-07-28 09:51:49 -07:00
|
|
|
* numbers are 0-based.
|
2018-05-31 20:47:15 -07:00
|
|
|
*
|
|
|
|
|
* @return PWM channel is valid
|
|
|
|
|
*/
|
2016-07-20 22:47:29 -07:00
|
|
|
static bool CheckPWMChannel(int channel);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check that the analog input number is value.
|
|
|
|
|
*
|
|
|
|
|
* Verify that the analog input number is one of the legal channel numbers.
|
|
|
|
|
* Channel numbers are 0-based.
|
|
|
|
|
*
|
|
|
|
|
* @return Analog channel is valid
|
|
|
|
|
*/
|
2016-07-21 23:24:06 -07:00
|
|
|
static bool CheckAnalogInputChannel(int channel);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check that the analog output number is valid.
|
|
|
|
|
*
|
|
|
|
|
* Verify that the analog output number is one of the legal channel numbers.
|
|
|
|
|
* Channel numbers are 0-based.
|
|
|
|
|
*
|
|
|
|
|
* @return Analog channel is valid
|
|
|
|
|
*/
|
2016-07-21 23:24:06 -07:00
|
|
|
static bool CheckAnalogOutputChannel(int channel);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
2016-07-20 22:47:29 -07:00
|
|
|
static const int kDigitalChannels;
|
|
|
|
|
static const int kAnalogInputs;
|
|
|
|
|
static const int kAnalogOutputs;
|
|
|
|
|
static const int kPwmChannels;
|
|
|
|
|
static const int kRelayChannels;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|