2021-09-16 18:50:27 -07: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.
|
|
|
|
|
|
|
|
|
|
#include "frc/PneumaticsBase.h"
|
|
|
|
|
|
|
|
|
|
#include "frc/Errors.h"
|
2021-10-29 00:00:31 -07:00
|
|
|
#include "frc/PneumaticHub.h"
|
2021-09-16 18:50:27 -07:00
|
|
|
#include "frc/PneumaticsControlModule.h"
|
|
|
|
|
#include "frc/SensorUtil.h"
|
|
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<PneumaticsBase> PneumaticsBase::GetForType(
|
|
|
|
|
int module, PneumaticsModuleType moduleType) {
|
|
|
|
|
if (moduleType == PneumaticsModuleType::CTREPCM) {
|
|
|
|
|
return PneumaticsControlModule::GetForModule(module);
|
2021-10-10 20:04:50 -07:00
|
|
|
} else if (moduleType == PneumaticsModuleType::REVPH) {
|
2021-10-29 00:00:31 -07:00
|
|
|
return PneumaticHub::GetForModule(module);
|
2021-09-16 18:50:27 -07:00
|
|
|
}
|
|
|
|
|
throw FRC_MakeError(err::InvalidParameter, "{}", moduleType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int PneumaticsBase::GetDefaultForType(PneumaticsModuleType moduleType) {
|
|
|
|
|
if (moduleType == PneumaticsModuleType::CTREPCM) {
|
|
|
|
|
return SensorUtil::GetDefaultCTREPCMModule();
|
2021-10-10 20:04:50 -07:00
|
|
|
} else if (moduleType == PneumaticsModuleType::REVPH) {
|
|
|
|
|
return SensorUtil::GetDefaultREVPHModule();
|
2021-09-16 18:50:27 -07:00
|
|
|
}
|
|
|
|
|
throw FRC_MakeError(err::InvalidParameter, "{}", moduleType);
|
|
|
|
|
}
|