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