blob: c767a8fa2804799df3f2edc091367509a536a366 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
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
15namespace hal {
16std::unique_ptr<PCM> PCM_modules[kNumPCMModules];
17
18void 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