Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2008. All Rights Reserved. |
| 3 | */ |
| 4 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 5 | /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ |
| 6 | /*----------------------------------------------------------------------------*/ |
| 7 | #pragma once |
| 8 | |
| 9 | #include "Resource.h" |
| 10 | #include "SensorBase.h" |
| 11 | #include "HAL/HAL.hpp" |
| 12 | #include "HAL/Port.h" |
| 13 | |
| 14 | #include <memory> |
| 15 | |
| 16 | /** |
| 17 | * SolenoidBase class is the common base class for the Solenoid and |
| 18 | * DoubleSolenoid classes. |
| 19 | */ |
| 20 | class SolenoidBase : public SensorBase { |
| 21 | public: |
| 22 | virtual ~SolenoidBase() = default; |
| 23 | uint8_t GetAll(int module = 0) const; |
| 24 | |
| 25 | uint8_t GetPCMSolenoidBlackList(int module) const; |
| 26 | bool GetPCMSolenoidVoltageStickyFault(int module) const; |
| 27 | bool GetPCMSolenoidVoltageFault(int module) const; |
| 28 | void ClearAllPCMStickyFaults(int module); |
| 29 | |
| 30 | protected: |
| 31 | explicit SolenoidBase(uint8_t pcmID); |
| 32 | void Set(uint8_t value, uint8_t mask, int module); |
| 33 | const static int m_maxModules = 63; |
| 34 | const static int m_maxPorts = 8; |
| 35 | static void* m_ports[m_maxModules][m_maxPorts]; |
| 36 | uint32_t m_moduleNumber; ///< Slot number where the module is plugged into |
| 37 | ///the chassis. |
| 38 | static std::unique_ptr<Resource> m_allocated; |
| 39 | }; |