Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame^] | 2 | /* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */ |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 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 | #include "frc/SolenoidBase.h" |
| 9 | |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame^] | 10 | #include <hal/FRCUsageReporting.h> |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 11 | #include <hal/Solenoid.h> |
| 12 | |
| 13 | using namespace frc; |
| 14 | |
| 15 | int SolenoidBase::GetAll(int module) { |
| 16 | int value = 0; |
| 17 | int32_t status = 0; |
| 18 | value = HAL_GetAllSolenoids(module, &status); |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame^] | 19 | wpi_setGlobalHALError(status); |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 20 | return value; |
| 21 | } |
| 22 | |
| 23 | int SolenoidBase::GetAll() const { |
| 24 | return SolenoidBase::GetAll(m_moduleNumber); |
| 25 | } |
| 26 | |
| 27 | int SolenoidBase::GetPCMSolenoidBlackList(int module) { |
| 28 | int32_t status = 0; |
| 29 | return HAL_GetPCMSolenoidBlackList(module, &status); |
| 30 | } |
| 31 | |
| 32 | int SolenoidBase::GetPCMSolenoidBlackList() const { |
| 33 | return SolenoidBase::GetPCMSolenoidBlackList(m_moduleNumber); |
| 34 | } |
| 35 | |
| 36 | bool SolenoidBase::GetPCMSolenoidVoltageStickyFault(int module) { |
| 37 | int32_t status = 0; |
| 38 | return HAL_GetPCMSolenoidVoltageStickyFault(module, &status); |
| 39 | } |
| 40 | |
| 41 | bool SolenoidBase::GetPCMSolenoidVoltageStickyFault() const { |
| 42 | return SolenoidBase::GetPCMSolenoidVoltageStickyFault(m_moduleNumber); |
| 43 | } |
| 44 | |
| 45 | bool SolenoidBase::GetPCMSolenoidVoltageFault(int module) { |
| 46 | int32_t status = 0; |
| 47 | return HAL_GetPCMSolenoidVoltageFault(module, &status); |
| 48 | } |
| 49 | |
| 50 | bool SolenoidBase::GetPCMSolenoidVoltageFault() const { |
| 51 | return SolenoidBase::GetPCMSolenoidVoltageFault(m_moduleNumber); |
| 52 | } |
| 53 | |
| 54 | void SolenoidBase::ClearAllPCMStickyFaults(int module) { |
| 55 | int32_t status = 0; |
| 56 | return HAL_ClearAllPCMStickyFaults(module, &status); |
| 57 | } |
| 58 | |
| 59 | void SolenoidBase::ClearAllPCMStickyFaults() { |
| 60 | SolenoidBase::ClearAllPCMStickyFaults(m_moduleNumber); |
| 61 | } |
| 62 | |
| 63 | SolenoidBase::SolenoidBase(int moduleNumber) : m_moduleNumber(moduleNumber) {} |