Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2016-2017. 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 | #include "PCMInternal.h" |
| 9 | |
| 10 | #include "HAL/Errors.h" |
| 11 | #include "HAL/Solenoid.h" |
| 12 | #include "HAL/cpp/make_unique.h" |
| 13 | #include "PortsInternal.h" |
| 14 | |
| 15 | namespace hal { |
| 16 | std::unique_ptr<PCM> PCM_modules[kNumPCMModules]; |
| 17 | |
| 18 | void initializePCM(int32_t module, int32_t* status) { |
| 19 | if (!HAL_CheckSolenoidModule(module)) { |
| 20 | *status = RESOURCE_OUT_OF_RANGE; |
| 21 | return; |
| 22 | } |
| 23 | if (!PCM_modules[module]) { |
| 24 | PCM_modules[module] = std::make_unique<PCM>(module); |
| 25 | } |
| 26 | } |
| 27 | } // namespace hal |