Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) 2016-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 <stdint.h> |
| 11 | |
| 12 | #include <memory> |
| 13 | |
| 14 | #include "PortsInternal.h" |
| 15 | #include "ctre/PCM.h" |
| 16 | #include "hal/Errors.h" |
| 17 | #include "hal/Ports.h" |
| 18 | #include "hal/Solenoid.h" |
| 19 | |
| 20 | namespace hal { |
| 21 | |
| 22 | extern std::unique_ptr<PCM> PCM_modules[kNumPCMModules]; |
| 23 | |
| 24 | static inline bool checkPCMInit(int32_t module, int32_t* status) { |
| 25 | if (!HAL_CheckSolenoidModule(module)) { |
| 26 | *status = RESOURCE_OUT_OF_RANGE; |
| 27 | return false; |
| 28 | } |
| 29 | if (!PCM_modules[module]) { |
| 30 | *status = INCOMPATIBLE_STATE; |
| 31 | return false; |
| 32 | } |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | void initializePCM(int32_t module, int32_t* status); |
| 37 | |
| 38 | } // namespace hal |